Skip to content

Commit

Permalink
Merge branch 'main' into keyao/remove-block-api
Browse files Browse the repository at this point in the history
  • Loading branch information
shenkeyao committed Sep 13, 2023
2 parents 2aca006 + 7b76e67 commit 9ed28f3
Show file tree
Hide file tree
Showing 44 changed files with 1,231 additions and 739 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ jobs:

- name: Setup Docker BuildKit (buildx)
if: matrix.just_variants == 'async_std'
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Repo
uses: docker/login-action@v2
uses: docker/login-action@v3
if: github.event_name != 'pull_request' && matrix.just_variants == 'async_std'
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Generate docker metadata (web-server)
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
if: matrix.just_variants == 'async_std'
id: web-server
with:
images: ghcr.io/espressosystems/hotshot/web-server

- name: Build and push web-server docker
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
if: matrix.just_variants == 'async_std'
with:
context: ./
Expand Down
27 changes: 20 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

80 changes: 41 additions & 39 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ members = [
"crates/testing",
"crates/types",
"crates/utils",
"crates/constants",
# "testing-macros",
"crates/task",
"crates/task-impls",
"crates/hotshot-qc",
"crates/hotshot-signature-key",
"crates/hotshot-stake-table",
"crates/hotshot"
"crates/hotshot",
]
resolver = "2"

Expand Down Expand Up @@ -61,53 +62,54 @@ nll = { git = "https://github.com/EspressoSystems/nll.git" }
rand = "0.8.5"
rand_chacha = { version = "0.3.1", default-features = false }
serde = { version = "1.0.188", features = ["derive"] }
sha2 = "0.10"
snafu = "0.7.5"
surf-disco = { git = "https://github.com/EspressoSystems/surf-disco.git", tag = "v0.4.2" }
time = "0.3.28"
toml = "0.7.7"
toml = "0.7.8"
tracing = "0.1.37"
typenum = "1.16.0"
libp2p = { package = "libp2p", version = "0.52.3", features = [
"macros",
"autonat",
"deflate",
"dns",
"floodsub",
"gossipsub",
"identify",
"kad",
"mdns",
"noise",
"ping",
"plaintext",
"pnet",
"quic",
"relay",
"request-response",
"rendezvous",
"secp256k1",
"serde",
"tcp",
"uds",
"wasm-ext",
"websocket",
"yamux",
"macros",
"autonat",
"deflate",
"dns",
"floodsub",
"gossipsub",
"identify",
"kad",
"mdns",
"noise",
"ping",
"plaintext",
"pnet",
"quic",
"relay",
"request-response",
"rendezvous",
"secp256k1",
"serde",
"tcp",
"uds",
"wasm-ext",
"websocket",
"yamux",
] }
async-std = { version = "1.12.0", features = ["attributes"] }
tokio = { version = "1.32.0", features = [
"fs",
"io-util",
"io-std",
"macros",
"net",
"parking_lot",
"process",
"rt",
"rt-multi-thread",
"signal",
"sync",
"time",
"tracing",
"fs",
"io-util",
"io-std",
"macros",
"net",
"parking_lot",
"process",
"rt",
"rt-multi-thread",
"signal",
"sync",
"time",
"tracing",
] }

### Profiles
Expand Down
5 changes: 5 additions & 0 deletions crates/constants/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "hotshot-constants"
version.workspace = true

[dependencies]
10 changes: 10 additions & 0 deletions crates/constants/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//! configurable constants for hotshot

/// the ID of the genesis block proposer
pub const GENESIS_PROPOSER_ID: [u8; 2] = [4, 2];

/// the number of views to gather information for ahead of time
pub const LOOK_AHEAD: u64 = 5;

/// the default kademlia record republication interval (in seconds)
pub const KAD_DEFAULT_REPUB_INTERVAL_SEC: u64 = 28800;
1 change: 1 addition & 0 deletions crates/hotshot/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ bincode = { workspace = true }
bitvec = { workspace = true }
clap = { version = "4.4", features = ["derive", "env"], optional = true }
commit = { workspace = true }
hotshot-constants = { path = "../constants" }
custom_debug = { workspace = true }
dashmap = "5.5.1"
derivative = { version = "2.2.0", optional = true }
Expand Down
6 changes: 4 additions & 2 deletions crates/hotshot/src/demos/sdemo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ use either::Either;
use hotshot_signature_key::bn254::BN254Pub;
use hotshot_types::{
certificate::{AssembledSignature, QuorumCertificate},
constants::genesis_proposer_id,
data::{fake_commitment, random_commitment, LeafType, SequencingLeaf, ViewNumber},
data::{
fake_commitment, genesis_proposer_id, random_commitment, LeafType, SequencingLeaf,
ViewNumber,
},
traits::{
block_contents::Transaction,
election::Membership,
Expand Down
9 changes: 2 additions & 7 deletions crates/hotshot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ use crate::{
use async_compatibility_layer::{
art::{async_spawn, async_spawn_local},
async_primitives::{broadcast::BroadcastSender, subscribable_rwlock::SubscribableRwLock},
channel::{unbounded, UnboundedReceiver, UnboundedSender},
channel::UnboundedSender,
};
use async_lock::{Mutex, RwLock, RwLockUpgradableReadGuard, RwLockWriteGuard};
use async_lock::{RwLock, RwLockUpgradableReadGuard, RwLockWriteGuard};
use async_trait::async_trait;
use commit::{Commitment, Committable};
use custom_debug::Debug;
Expand Down Expand Up @@ -146,9 +146,6 @@ pub struct SystemContextInner<TYPES: NodeType, I: NodeImplementation<TYPES>> {
/// latter of which is only applicable for sequencing consensus.
channel_maps: (ChannelMaps<TYPES, I>, Option<ChannelMaps<TYPES, I>>),

/// for receiving messages in the network lookup task
recv_network_lookup: Arc<Mutex<UnboundedReceiver<Option<TYPES::Time>>>>,

// global_registry: GlobalRegistry,
/// Access to the output event stream.
output_event_stream: ChannelStream<Event<TYPES, I::Leaf>>,
Expand Down Expand Up @@ -238,9 +235,7 @@ impl<TYPES: NodeType, I: NodeImplementation<TYPES>> SystemContext<TYPES, I> {
let consensus = Arc::new(RwLock::new(consensus));
let txns = consensus.read().await.get_transactions();

let (_send_network_lookup, recv_network_lookup) = unbounded();
let inner: Arc<SystemContextInner<TYPES, I>> = Arc::new(SystemContextInner {
recv_network_lookup: Arc::new(Mutex::new(recv_network_lookup)),
id: nonce,
channel_maps: I::new_channel_maps(start_view),
consensus,
Expand Down
Loading

0 comments on commit 9ed28f3

Please sign in to comment.