Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetch Memberships from l1 #2390

Merged
merged 72 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
17b4c26
attempt to update stake tables
imabdulbasit Dec 11, 2024
d6304c1
cleanup and make epoch as key
imabdulbasit Dec 11, 2024
816f819
initialize the btree maps
tbro Dec 11, 2024
7f2eec7
remove prev_block_epoch
imabdulbasit Dec 12, 2024
6320f3f
wrap committee state in Arc<RwLock<>>
imabdulbasit Dec 12, 2024
6acf598
cargo sort
imabdulbasit Dec 12, 2024
2d04292
add stake back in l1_client
tbro Dec 12, 2024
5788626
Move `StaticCommittee` state into its own type.
tbro Dec 12, 2024
d74eb67
remove NewEpoch event
imabdulbasit Dec 13, 2024
56f3f73
permissioned_stake_table_contract as env var
imabdulbasit Dec 13, 2024
f3fa640
get contract addr from chain config
imabdulbasit Dec 13, 2024
012368d
make state as Arc<RwLock<HashMap<Epoch, StaticCommittee>>>
imabdulbasit Dec 13, 2024
1e88da2
fix imports for MembershipCommittee
imabdulbasit Dec 13, 2024
1fcbd92
cleanup
imabdulbasit Dec 13, 2024
50bfe89
move write lock
imabdulbasit Dec 13, 2024
d585efa
rename quorum to stake_table and da to da_stake_tables
imabdulbasit Dec 13, 2024
2694371
rename MembershipCommittees to EpochCommittees
imabdulbasit Dec 13, 2024
a14d2b4
remove some TODOs
tbro Dec 13, 2024
351bc27
da stakle table -> da members
imabdulbasit Dec 13, 2024
70b758d
fix test_fetch_stake_table: await for tx finalization
imabdulbasit Dec 13, 2024
ce740c8
pass in epoch to update fn
imabdulbasit Dec 13, 2024
1c314ba
hashmap to btreemap for indexed stake table
imabdulbasit Dec 13, 2024
f5f7f02
fix test_genesis_from_toml_with_optional_fields
imabdulbasit Dec 13, 2024
e178037
fix comment
tbro Dec 13, 2024
d9175b7
Small cleanup on trait methods
tbro Dec 13, 2024
79c1617
Return `Committee from updater
tbro Dec 13, 2024
475087a
fix
tbro Dec 13, 2024
c6b1b8c
rename `DAStakeTable` to `DaMembers`
tbro Dec 13, 2024
f4da7fd
workaround: insert stake table for epoch 1
sveitser Dec 16, 2024
6482b18
kill test that may hang
sveitser Dec 16, 2024
5c32108
Use sync locks for stake table state (#2404)
sveitser Dec 16, 2024
28dffec
rename DAMembers
tbro Dec 16, 2024
5685090
log when epochs aren't progressing
tbro Dec 16, 2024
0d68518
return empty `StakeTables` when l1 cache is unavailable
tbro Dec 16, 2024
cc3197d
we only need to distinguish betwen `RwLock`s
tbro Dec 16, 2024
a180214
Add `epoch_height` to `NodeState`
tbro Dec 16, 2024
161121e
fix light client proxy address for demos
imabdulbasit Dec 17, 2024
e8abebd
increase MAX_TXNS_NOT_INCREMENTING to 5
imabdulbasit Dec 17, 2024
4fa1984
patch hotshot
tbro Dec 17, 2024
70dbaf0
cargo lock
tbro Dec 17, 2024
a04ace9
add epoch upgrade type
imabdulbasit Dec 18, 2024
9f1d9ed
Revert "patch hotshot"
tbro Dec 18, 2024
53131fb
WIP: hotshot 0.5.83
sveitser Dec 19, 2024
721698a
Update hotshot-query-service
sveitser Dec 19, 2024
87e146b
fix double space
sveitser Dec 19, 2024
1e2fd09
Builder changes
QuentinI Dec 19, 2024
60f1427
cargo: remove patch
sveitser Dec 19, 2024
88aca4f
add `--keep-going` to lint
tbro Dec 19, 2024
6bf3060
Pull in updates from hotshot
tbro Dec 19, 2024
1c47fda
fix compile errors for the `Memberships` trait update
tbro Dec 19, 2024
9d0bf9c
Add rust binary to update permissioned stake table (#2410)
sveitser Dec 20, 2024
0fa1f3f
store next epoch qc
imabdulbasit Dec 20, 2024
5da92ff
Merge branch 'ma/hotshot-0.5.83' into ab/store-next-epoch-qc
imabdulbasit Dec 20, 2024
b9338c2
update query service
imabdulbasit Dec 20, 2024
688aedc
Update hotshot-* dependencies
sveitser Dec 20, 2024
9385491
Fix rust compilation
sveitser Dec 20, 2024
bd74fe5
store next epoch qc in persistence (#2422)
imabdulbasit Dec 20, 2024
6a6be1a
Merge branch 'ab/st' into ma/hotshot-0.5.83
imabdulbasit Dec 20, 2024
4eaf8f6
cargo fmt
sveitser Dec 20, 2024
59b61df
Cargo update and fix
tbro Jan 6, 2025
bfb3d08
drb compile errors
tbro Jan 6, 2025
87e80a6
Preliminary `add_epoch_root` implementation
tbro Jan 6, 2025
e3fba83
cleanup add_epoch_root
tbro Jan 6, 2025
efbedaf
add stake table contract address to EpochCommittee
tbro Jan 7, 2025
e6c1ccf
update sqlite dependencies
tbro Jan 7, 2025
0264600
update hotshot
tbro Jan 7, 2025
ed6c822
remove storage2 methods
tbro Jan 7, 2025
71046bc
update sequencer-sqlite deps
tbro Jan 7, 2025
f9c8799
upstream query-service fix
tbro Jan 8, 2025
dc5069b
update hotshot
tbro Jan 8, 2025
5cfa92d
fix message compat tests
imabdulbasit Jan 8, 2025
2f56726
WIP: hotshot 0.5.83 (#2417)
imabdulbasit Jan 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl<N: ConnectedNetwork<PubKey>, V: Versions, P: SequencerPersistence>
self.consensus().await.read().await.cur_epoch().await
};

<StaticCommittee as Membership<SeqTypes>>::stake_table(
<SeqTypes as NodeType>::Membership::stake_table(
&self.consensus().await.read().await.memberships,
epoch,
)
Expand Down
2 changes: 1 addition & 1 deletion sequencer/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<N: ConnectedNetwork<PubKey>, P: SequencerPersistence, V: Versions> Sequence
pub async fn init(
network_config: NetworkConfig<PubKey>,
validator_config: ValidatorConfig<<SeqTypes as NodeType>::SignatureKey>,
membership: StaticCommittee,
membership: Arc<RwLock<StaticCommittee>>,
instance_state: NodeState,
persistence: P,
network: Arc<N>,
Expand Down
7 changes: 4 additions & 3 deletions sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod restart_tests;
mod message_compat_tests;

use anyhow::Context;
use async_lock::RwLock;
use catchup::StatePeers;
use context::SequencerContext;
use espresso_types::StaticCommittee;
Expand Down Expand Up @@ -479,12 +480,12 @@ pub async fn init_node<P: SequencerPersistence, V: Versions>(
};

// Create the HotShot membership
let membership = StaticCommittee::new_stake(
let membership = Arc::new(RwLock::new(StaticCommittee::new_stake(
network_config.config.known_nodes_with_stake.clone(),
network_config.config.known_nodes_with_stake.clone(),
&instance_state,
Default::default(),
);
network_config.config.epoch_height,
)));

// Initialize the Libp2p network
let network = {
Expand Down
1 change: 1 addition & 0 deletions types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ tokio = { workspace = true }
tracing = { workspace = true }
url = { workspace = true }
vbs = { workspace = true }
async-lock = { workspace = true }

[dev-dependencies]
portpicker = { workspace = true }
Expand Down
7 changes: 6 additions & 1 deletion types/src/v0/impls/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1182,7 +1182,11 @@ mod test_headers {
use std::sync::Arc;

use ethers::{types::Address, utils::Anvil};
use hotshot_types::{traits::signature_key::BuilderSignatureKey, vid::vid_scheme};
use hotshot_types::{
data::EpochNumber,
traits::{node_implementation::ConsensusTime, signature_key::BuilderSignatureKey},
vid::vid_scheme,
};

use sequencer_utils::test_utils::setup_test;
use v0_1::{BlockMerkleTree, FeeMerkleTree, L1Client};
Expand Down Expand Up @@ -1243,6 +1247,7 @@ mod test_headers {
block_merkle_tree: block_merkle_tree.clone(),
fee_merkle_tree,
chain_config: genesis.instance_state.chain_config.into(),
prev_block_epoch: EpochNumber::new(0),
};

let (fee_account, fee_key) = FeeAccount::generated_from_seed_indexed([0; 32], 0);
Expand Down
17 changes: 10 additions & 7 deletions types/src/v0/impls/l1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ use url::Url;

use super::{L1BlockInfo, L1ClientMetrics, L1State, L1UpdateTask, RpcClient};
use crate::{
v0::impls::stake_table::StakeTables, FeeInfo, L1Client, L1ClientOptions, L1Event,
L1ReconnectTask, L1Snapshot,
v0_3::StakeTables, FeeInfo, L1Client, L1ClientOptions, L1Event, L1ReconnectTask, L1Snapshot,
};

impl PartialOrd for L1BlockInfo {
Expand Down Expand Up @@ -785,7 +784,11 @@ impl L1Client {
}

/// Get `StakeTable` at block height.
pub async fn get_stake_table(&self, block: u64, address: Address) -> StakeTables {
pub async fn get_stake_table(
&self,
block: u64,
address: Address,
) -> anyhow::Result<StakeTables> {
// TODO epoch size may need to be passed in as well
// TODO here or in memberships check if we have fetched table this epoch
let stake_table_contract = PermissionedStakeTable::new(address, self.provider.clone());
Expand All @@ -795,10 +798,9 @@ impl L1Client {
.from_block(0)
.to_block(block)
.query()
.await
.unwrap();
.await?;

StakeTables::from_l1_events(events.clone())
Ok(StakeTables::from_l1_events(events.clone()))
}
}

Expand Down Expand Up @@ -1306,7 +1308,8 @@ mod test {
let block = client.get_block(BlockNumber::Latest).await?.unwrap();
let nodes = l1_client
.get_stake_table(block.number.unwrap().as_u64(), address)
.await;
.await
.unwrap();

let result = nodes.consensus_stake_table.0[0].clone();
assert_eq!(result.stake_amount.as_u64(), 1);
Expand Down
Loading
Loading