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

Stake Table Integration test #2526

Draft
wants to merge 159 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
159 commits
Select commit Hold shift + click to select a range
7ac8ec9
consensus storage migration
imabdulbasit Jan 14, 2025
d58bb1d
fix migrations and commit transaction after batch insert
imabdulbasit Jan 14, 2025
d1dd38e
sqlite migration fixes and fix deserialization errors
imabdulbasit Jan 15, 2025
dbecff3
test
imabdulbasit Jan 15, 2025
27ab511
fs migration
imabdulbasit Jan 20, 2025
471f7ca
fix queries and tests
imabdulbasit Jan 20, 2025
00d48b5
merge main
imabdulbasit Jan 20, 2025
ff3d533
sequencer sqlite lock file
imabdulbasit Jan 20, 2025
c573ea6
fix postgres epoch migration
imabdulbasit Jan 20, 2025
5802184
fix undecided_state2 migration
imabdulbasit Jan 20, 2025
5274951
epoch integration test
imabdulbasit Jan 21, 2025
3885e21
bincode deserialize for migrated hashset
imabdulbasit Jan 23, 2025
2a09a9c
merge main
imabdulbasit Jan 30, 2025
5e27fc2
DEMO_GENESIS_FILE env
imabdulbasit Jan 30, 2025
6766269
Merge remote-tracking branch 'origin/main' into ab/epoch-integration-…
tbro Feb 3, 2025
a1803f7
fix error en `.env` file
tbro Feb 3, 2025
d688b6c
add pos test to justfile and CI workflow
tbro Feb 3, 2025
36a2c7b
Merge branch 'main' into ab/epoch-integration-test
imabdulbasit Feb 4, 2025
697d022
run demo native with base version set to pos
imabdulbasit Feb 4, 2025
7786cfb
Marketplace signatures should engage @ v99
tbro Feb 4, 2025
5f1a2b8
set epoch-height to 150
imabdulbasit Feb 4, 2025
cac2b3b
process-compose: remove fund-builder condition from `permissionless-b…
tbro Feb 4, 2025
4112773
Fix path to default genesis path
tbro Feb 4, 2025
ab84584
Some fixes
tbro Feb 4, 2025
8ed730f
temporarily disable versions we don't need for the current objective
tbro Feb 4, 2025
6f65adf
only run v 3 in CI for now
tbro Feb 5, 2025
213baf0
avoid redirect in header stream
tbro Feb 5, 2025
37307e4
Use named version (instead if integer)
tbro Feb 5, 2025
3ae3f66
Add missing header type + conversions
tbro Feb 5, 2025
7c6222b
bump todo_by by 1 month (#2534)
tbro Feb 5, 2025
a65cbb8
Put expected fee back as it was
tbro Feb 5, 2025
9613ce1
Add stake tables up to epoch 2 (inclusive)
tbro Feb 5, 2025
cbb414c
add stake table for ..=10
tbro Feb 5, 2025
2d75307
Merge remote-tracking branch 'origin/main' into ab/leaf2-migration
imabdulbasit Feb 6, 2025
0152568
query service leaf2 migration
imabdulbasit Feb 6, 2025
28063b6
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 6, 2025
9b80a9a
fix quorum proposal migration and storage
imabdulbasit Feb 6, 2025
4745aa6
fix fetching
imabdulbasit Feb 6, 2025
a84549d
fix leaf from proposal
imabdulbasit Feb 6, 2025
a6df3db
fix import
imabdulbasit Feb 6, 2025
aa31ce9
TODO questions
tbro Feb 6, 2025
a4e0b58
add backtrace to justfile
tbro Feb 6, 2025
7203717
TODO
tbro Feb 6, 2025
2f28e00
comment
tbro Feb 6, 2025
946cd78
fix test_fetching_providers
imabdulbasit Feb 6, 2025
270bf0b
use TestVersions from hotshot-example-types
imabdulbasit Feb 6, 2025
bc74fd8
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 6, 2025
f0e9b41
fix migration completed check
imabdulbasit Feb 7, 2025
3779f32
Merge remote-tracking branch 'origin/ab/leaf2-migration' into ab/epoc…
tbro Feb 7, 2025
98a6969
version features
tbro Feb 7, 2025
711c7b9
I think build jet has more space (lets find out)
tbro Feb 7, 2025
dc25ada
Revert "I think build jet has more space (lets find out)"
tbro Feb 7, 2025
e951d1d
test epoch test
tbro Feb 7, 2025
f0f9f49
call v2 methods
imabdulbasit Feb 10, 2025
d8485e2
Merge remote-tracking branch 'origin/main' into ab/leaf2-migration
imabdulbasit Feb 10, 2025
26fbdad
fix VID errors
imabdulbasit Feb 10, 2025
c01b8bf
lint
imabdulbasit Feb 10, 2025
ab4013d
cargo sort
imabdulbasit Feb 10, 2025
3b42047
fix recursion
imabdulbasit Feb 10, 2025
64eb0d8
Make epoch_height on TestNetwork configurable
tbro Feb 10, 2025
c9eeb2a
fix
tbro Feb 10, 2025
87b1547
remove comment
tbro Feb 10, 2025
d8d460c
v0 and v1 availability modules
imabdulbasit Feb 10, 2025
e56475f
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 10, 2025
8fe27d1
cargo sort
imabdulbasit Feb 10, 2025
04dbac0
fix tests
imabdulbasit Feb 10, 2025
43005f1
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 10, 2025
86fd4a9
lock file
imabdulbasit Feb 10, 2025
1d47a08
add test profile
tbro Feb 11, 2025
9936c1e
Add pos view based upgrade test
tbro Feb 12, 2025
0d91dc8
Fix chain_config upgrade in Header::new
tbro Feb 13, 2025
0965d90
remove a TODO (hurray!)
tbro Feb 13, 2025
a980b6c
add a mock_v3 to `InstanceState`
tbro Feb 13, 2025
593e1dd
Merge commit '387d5aa45d9295a81a6ff33768f6eb121ae3e37c' into ab/epoch…
tbro Feb 13, 2025
dfb0a88
log error on ChainConfig upgrade in Header::new
tbro Feb 14, 2025
88b8280
fix
tbro Feb 14, 2025
f61e799
Update sqlx (#2617)
tbro Feb 14, 2025
a94027a
Cleanup chain_config upgrade in `Header::new_legacy`
tbro Feb 14, 2025
8eaef68
add initial stakers through stake table update txn AND no multi sig o…
imabdulbasit Feb 17, 2025
35ad5b8
fix build and clippy
imabdulbasit Feb 17, 2025
51adee6
Merge remote-tracking branch 'origin/main' into ab/leaf2-migration
imabdulbasit Feb 17, 2025
70036f9
Merge remote-tracking branch 'origin/ab/leaf2-migration' into ab/epoc…
imabdulbasit Feb 17, 2025
9fee089
revert justfile
imabdulbasit Feb 17, 2025
a6af030
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 17, 2025
a17f5b4
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 17, 2025
ac7d811
fix devnode
imabdulbasit Feb 17, 2025
b45011d
do not validate and apply header for block in epoch transition
imabdulbasit Feb 17, 2025
103b5e2
add comments to validate_and_apply_header()
imabdulbasit Feb 17, 2025
cd9c06d
fix log
imabdulbasit Feb 17, 2025
068cf55
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 17, 2025
ce7303d
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 17, 2025
35aaa47
todo: l1 events order
imabdulbasit Feb 17, 2025
a2a764c
save initial stake table from hotshot config
imabdulbasit Feb 18, 2025
bc7dee5
lint
imabdulbasit Feb 18, 2025
c47a77e
fix env
imabdulbasit Feb 18, 2025
ab1cef6
features for sqlite
imabdulbasit Feb 18, 2025
fc990f3
revert add_epoch_root()
imabdulbasit Feb 18, 2025
270af28
add epoch versions to builder main()
imabdulbasit Feb 18, 2025
1b97c3b
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 18, 2025
f91bfdd
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 18, 2025
5324304
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 18, 2025
ad6b113
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 18, 2025
3f3ea7c
Lr/epoch integration test (#2639)
lukaszrzasik Feb 18, 2025
389d5ae
change view settings for pos upgrade
imabdulbasit Feb 19, 2025
54d79a3
more fixes
imabdulbasit Feb 19, 2025
4a03c95
Merge remote-tracking branch 'origin/main' into ab/leaf2-migration
imabdulbasit Feb 19, 2025
99d58a0
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 19, 2025
ced65a1
remove bid_recipient from config
imabdulbasit Feb 19, 2025
88d4a2e
preload epoch staketables
imabdulbasit Feb 19, 2025
e305013
get contract address from chain config and do catchup
imabdulbasit Feb 20, 2025
2845634
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 20, 2025
926142b
merge ab/leaf2-migration
imabdulbasit Feb 20, 2025
727e751
lockfile
imabdulbasit Feb 20, 2025
e22436e
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 20, 2025
ff9ed3a
clippy
imabdulbasit Feb 20, 2025
b8de2b7
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 20, 2025
ab54402
sqlite lockfile
imabdulbasit Feb 20, 2025
19a1193
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 20, 2025
67eace0
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 21, 2025
c0b1c16
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 21, 2025
e6558a4
set epoch height in genesis file
imabdulbasit Feb 24, 2025
c1b1e22
lockfile
imabdulbasit Feb 24, 2025
e69b5f2
load initial stake table from config
imabdulbasit Feb 24, 2025
8bf1279
fix update binary
imabdulbasit Feb 24, 2025
54c89d7
fix stake table update test
imabdulbasit Feb 24, 2025
9bd10ef
clippy
imabdulbasit Feb 24, 2025
51ec243
remove l1_provider, mnemonic default values
imabdulbasit Feb 24, 2025
a061437
use config endpoint for stake table updates
imabdulbasit Feb 25, 2025
1e8cd5c
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 25, 2025
0d1fc1e
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 25, 2025
fbbe05f
lint
imabdulbasit Feb 25, 2025
949a345
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 25, 2025
c401e04
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 25, 2025
3e64591
use fee,pos,marketplace to build binaries for integration-test
imabdulbasit Feb 25, 2025
6ee04ba
fix docker-compose.yaml
imabdulbasit Feb 25, 2025
a78a33d
add marketplace feature to sqlite binary
imabdulbasit Feb 25, 2025
2fc136f
insert randomized committee
imabdulbasit Feb 26, 2025
646b4ad
move public hotshot config to types crate
imabdulbasit Feb 26, 2025
e18cb5a
fix randomized committee preloading
imabdulbasit Feb 26, 2025
48bd158
Merge branch 'main' into ab/leaf2-migration
imabdulbasit Feb 26, 2025
9bc5e57
assert upgrade 10 views after upgrade proposal
imabdulbasit Feb 26, 2025
5b1a1a2
Merge branch 'ab/leaf2-migration' into ab/epoch-integration-test
imabdulbasit Feb 26, 2025
6f07908
fix: off by one epoch for getting drb results
imabdulbasit Feb 26, 2025
fd30547
Merge branch 'main' into ab/epoch-integration-test
imabdulbasit Mar 6, 2025
d18c6bc
fixes after merging main
imabdulbasit Mar 6, 2025
850d2de
remove duplicate migration
imabdulbasit Mar 6, 2025
85756d8
fix genesis_vid and parse_ns_table()
imabdulbasit Mar 7, 2025
9de78ea
increase epoch height to 30
imabdulbasit Mar 7, 2025
95bb765
Merge remote-tracking branch 'origin/main' into ab/epoch-integration-…
imabdulbasit Mar 7, 2025
6a745ce
do not store stake table for e+1, e+2 when updating epoch committees
imabdulbasit Mar 7, 2025
c1a8f26
fmt
imabdulbasit Mar 10, 2025
538ab1b
Merge remote-tracking branch 'origin/main' into ab/epoch-integration-…
imabdulbasit Mar 10, 2025
2776d2a
revert update.rs
imabdulbasit Mar 10, 2025
a72e621
remove todo
imabdulbasit Mar 10, 2025
ef8f1ad
enable fee,pos,marketplace features for build-test-artifcats-postgres
imabdulbasit Mar 10, 2025
6a71857
fix test-integration workflow
imabdulbasit Mar 10, 2025
4c816b9
add features to permissionless builder
imabdulbasit Mar 10, 2025
c077ba9
build docker binaries will all version features
imabdulbasit Mar 10, 2025
e807c99
remove hardcoded version
imabdulbasit Mar 10, 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
6 changes: 3 additions & 3 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ ESPRESSO_SEQUENCER4_API_PORT=24004
ESPRESSO_SEQUENCER_URL=http://sequencer0:${ESPRESSO_SEQUENCER_API_PORT}
ESPRESSO_SEQUENCER_MAX_CONNECTIONS=25
ESPRESSO_SEQUENCER_STORAGE_PATH=/store/sequencer
ESPRESSO_SEQUENCER_GENESIS_FILE=/genesis/demo.toml
ESPRESSO_SEQUENCER_GENESIS_FILE=data/genesis/demo.toml
ESPRESSO_SEQUENCER_L1_PORT=8545
ESPRESSO_SEQUENCER_L1_POLLING_INTERVAL=100ms
ESPRESSO_SEQUENCER_L1_WS_PORT=8546
Expand All @@ -57,10 +57,10 @@ ESPRESSO_BUILDER_ETH_ACCOUNT_INDEX=8
ESPRESSO_DEPLOYER_ACCOUNT_INDEX=9

# Contracts
ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS=0x0c8e79f3534b00d9a3d4a856b665bf4ebc22f2ba
ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS=0xe1da8919f262ee86f9be05059c9280142cf23f48
ESPRESSO_SEQUENCER_LIGHTCLIENT_ADDRESS=$ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS
ESPRESSO_SEQUENCER_PERMISSIONED_PROVER=0x14dc79964da2c08b23698b3d3cc7ca32193d9955
ESPRESSO_SEQUENCER_PERMISSIONED_STAKE_TABLE_ADDRESS=0x8ce361602b935680e8dec218b820ff5056beb7af
ESPRESSO_SEQUENCER_PERMISSIONED_STAKE_TABLE_ADDRESS=0xb19b36b1456e65e3a6d514d3f715f204bd59f431

# Example sequencer demo private keys
ESPRESSO_DEMO_SEQUENCER_STAKING_PRIVATE_KEY_0=BLS_SIGNING_KEY~lNDh4Pn-pTAyzyprOAFdXHwhrKhEwqwtMtkD3CZF4x3o
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:
- name: Build
# Build in release without `testing` feature, this should work without `hotshot_example` config.
run: |
cargo build --locked --release --workspace
cargo build --features "fee, pos, marketplace" --locked --release --workspace

- name: Build sequencer-sqlite
run: cargo build --locked --release --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target
run: cargo build --features "fee, pos, marketplace" --locked --release --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target

- name: Build Espresso Dev Node
# Espresso Dev Node currently requires testing feature, so it is built separately.
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
comment_on_pr: false

- name: Build and archive tests
run: cargo nextest archive --locked --workspace --archive-file nextest-archive-postgres.tar.zst
run: cargo nextest archive --features "fee, pos, marketplace" --locked --workspace --archive-file nextest-archive-postgres.tar.zst

- name: Upload archive to workflow
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
comment_on_pr: false

- name: Build and archive tests
run: cargo nextest archive --locked --features "embedded-db testing" --workspace --archive-file nextest-archive-sqlite.tar.zst
run: cargo nextest archive --locked --features "fee, pos, marketplace, embedded-db, testing" --workspace --archive-file nextest-archive-sqlite.tar.zst

- name: Upload archive to workflow
uses: actions/upload-artifact@v4
Expand All @@ -110,8 +110,8 @@ jobs:

- name: Build Bins
run: |
cargo build --locked --profile test --bins
cargo build --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target
cargo build --features "fee, pos, marketplace" --locked --profile test --bins
cargo build --features "fee, pos, marketplace" --manifest-path ./sequencer-sqlite/Cargo.toml --target-dir ./target
timeout-minutes: 60

- name: Upload archive to workflow
Expand Down Expand Up @@ -209,10 +209,13 @@ jobs:
needs: [build-test-bins, build-test-artifacts-postgres]
strategy:
matrix:
version: [02,99]
version: [02,03,99]
include:
- version: 02
compose: "-f process-compose.yaml"

- version: 03
compose: "-f process-compose.yaml"

- version: 99
compose: "-f process-compose.yaml -f process-compose-mp.yml"
Expand Down Expand Up @@ -251,7 +254,7 @@ jobs:
NEXTEST_PROFILE: integration
INTEGRATION_TEST_SEQUENCER_VERSION: ${{ matrix.version }}
run: |
cargo nextest run --archive-file nextest-archive-postgres.tar.zst --verbose --no-fail-fast --nocapture \
cargo nextest run --archive-file nextest-archive-postgres.tar.zst --verbose --no-fail-fast \
--workspace-remap $PWD $(if [ "${{ matrix.version }}" == "2" ]; then echo " smoke"; fi)
timeout-minutes: 10

Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,7 @@ contracts/broadcast/*/11155111/
docs/

# Autogen files
.vscode/
.vscode/

# initial stake table
data/initial_stake_table.toml
7 changes: 7 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions builder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ version = { workspace = true }
authors = { workspace = true }
edition = { workspace = true }

[features]
default = ["pos"]
fee = []
pos = []
marketplace = []

[dependencies]
anyhow = { workspace = true }
async-broadcast = { workspace = true }
Expand Down
45 changes: 36 additions & 9 deletions builder/src/bin/permissionless-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ use std::{num::NonZeroUsize, path::PathBuf, time::Duration};

use builder::non_permissioned::{build_instance_state, BuilderConfig};
use clap::Parser;
use espresso_types::{
eth_signature_key::EthKeyPair, parse_duration, FeeVersion, MarketplaceVersion,
SequencerVersions, V0_0,
};
use espresso_types::{eth_signature_key::EthKeyPair, parse_duration, SequencerVersions};
use futures::future::pending;
use hotshot::traits::ValidatedState;
use hotshot_types::{
Expand Down Expand Up @@ -120,12 +117,42 @@ async fn main() -> anyhow::Result<()> {
let upgrade = genesis.upgrade_version;

match (base, upgrade) {
(FeeVersion::VERSION, MarketplaceVersion::VERSION) => {
run::<SequencerVersions<FeeVersion, MarketplaceVersion>>(genesis, opt).await
#[cfg(all(feature = "fee", feature = "pos"))]
(espresso_types::FeeVersion::VERSION, espresso_types::EpochVersion::VERSION) => {
run::<SequencerVersions<espresso_types::FeeVersion, espresso_types::EpochVersion>>(
genesis, opt
)
.await
}
#[cfg(feature = "pos")]
(espresso_types::EpochVersion::VERSION, _) => {
run::<SequencerVersions<espresso_types::FeeVersion, espresso_types::MarketplaceVersion>>(
genesis, opt
// Specifying V0_0 disables upgrades
)
.await
}
#[cfg(all(feature = "fee", feature = "marketplace"))]
(espresso_types::FeeVersion::VERSION, espresso_types::MarketplaceVersion::VERSION) => {
run::<SequencerVersions<espresso_types::FeeVersion, espresso_types::MarketplaceVersion>>(
genesis, opt
)
.await
},
#[cfg(feature = "fee")]
(espresso_types::FeeVersion::VERSION, _) => {
run::<SequencerVersions<espresso_types::FeeVersion, espresso_types::V0_0>>(
genesis, opt
)
.await
},
(FeeVersion::VERSION, _) => run::<SequencerVersions<FeeVersion, V0_0>>(genesis, opt).await,
(MarketplaceVersion::VERSION, _) => {
run::<SequencerVersions<MarketplaceVersion, V0_0>>(genesis, opt).await
#[cfg(feature = "marketplace")]
(espresso_types::MarketplaceVersion::VERSION, _) => {
run::<SequencerVersions<espresso_types::MarketplaceVersion, espresso_types::V0_0>>(
genesis, opt
)
.await

},
_ => panic!(
"Invalid base ({base}) and upgrade ({upgrade}) versions specified in the toml file."
Expand Down
2 changes: 1 addition & 1 deletion builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub mod testing {
start_voting_time: 0,
stop_proposing_time: 0,
stop_voting_time: 0,
epoch_height: 0,
epoch_height: 150,
epoch_start_block: 0,
};

Expand Down
2 changes: 2 additions & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ anyhow = { workspace = true }
espresso-types = { path = "../types" }
ethers = { workspace = true }
futures = { workspace = true }
hotshot-types = { workspace = true }
jf-merkle-tree = { workspace = true }
serde_json = { workspace = true }
surf-disco = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
Expand Down
37 changes: 36 additions & 1 deletion client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
use std::time::Duration;

use anyhow::Context;
use espresso_types::{FeeAccount, FeeAmount, FeeMerkleTree, Header};
use espresso_types::{
config::PublicNetworkConfig, FeeAccount, FeeAmount, FeeMerkleTree, Header, PubKey,
};
use ethers::types::Address;
use futures::{stream::BoxStream, StreamExt};
use hotshot_types::stake_table::StakeTableEntry;
use jf_merkle_tree::{
prelude::{MerkleProof, Sha3Node},
MerkleTreeScheme,
Expand Down Expand Up @@ -120,6 +123,38 @@ impl SequencerClient {
let balance = proof.elem().copied().unwrap_or(0.into());
Ok(balance)
}

pub async fn current_epoch(&self) -> anyhow::Result<Option<u64>> {
self.0
.get::<Option<u64>>("node/current_epoch")
.send()
.await
.context("getting epoch value")
}

pub async fn stake_table(&self, epoch: u64) -> anyhow::Result<Vec<StakeTableEntry<PubKey>>> {
self.0
.get::<_>(&format!("node/stake-table/{epoch}"))
.send()
.await
.context("getting stake table")
}

pub async fn da_members(&self, epoch: u64) -> anyhow::Result<Vec<StakeTableEntry<PubKey>>> {
self.0
.get::<_>(&format!("node/stake-table/da/{epoch}"))
.send()
.await
.context("getting da stake table")
}

pub async fn config(&self) -> anyhow::Result<PublicNetworkConfig> {
self.0
.get::<PublicNetworkConfig>("config/hotshot")
.send()
.await
.context("getting hotshot config")
}
}

#[cfg(test)]
Expand Down
21 changes: 21 additions & 0 deletions data/genesis/demo-pos-base.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
base_version = "0.3"
upgrade_version = "0.3"
epoch_height = 30

[stake_table]
capacity = 10

[chain_config]
chain_id = 999999999
max_block_size = '1mb'
base_fee = '1 wei'
fee_recipient = "0x0000000000000000000000000000000000000000"
fee_contract = "0xa15bb66138824a1c7167f5e85b957d04dd34e468"
stake_table_contract = "0xb19b36b1456e65e3a6d514d3f715f204bd59f431"

[header]
timestamp = "1970-01-01T00:00:00Z"

[l1_finalized]
number = 0

10 changes: 5 additions & 5 deletions data/genesis/demo-epoch.toml → data/genesis/demo-pos.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
base_version = "0.2"
upgrade_version = "0.3"
epoch_height = 30

[stake_table]
capacity = 10

[chain_config]
chain_id = 999999999
base_fee = '0 wei'
base_fee = '1 wei'
max_block_size = '1mb'
fee_recipient = '0x0000000000000000000000000000000000000000'
fee_contract = '0xa15bb66138824a1c7167f5e85b957d04dd34e468'
Expand All @@ -18,16 +19,15 @@ timestamp = "1970-01-01T00:00:00Z"
number = 0

[[upgrade]]
version = "0.99"
version = "0.3"
start_proposing_view = 10
stop_proposing_view = 60
stop_proposing_view = 50

[upgrade.epoch]
[upgrade.epoch.chain_config]
chain_id = 999999999
max_block_size = '1mb'
base_fee = '1 wei'
fee_recipient = "0x0000000000000000000000000000000000000000"
bid_recipient = "0x0000000000000000000000000000000000000000"
fee_contract = "0xa15bb66138824a1c7167f5e85b957d04dd34e468"
stake_table_contract = "0x8ce361602b935680e8dec218b820ff5056beb7af"
stake_table_contract = "0xb19b36b1456e65e3a6d514d3f715f204bd59f431"
30 changes: 0 additions & 30 deletions data/initial_stake_table.toml

This file was deleted.

Binary file modified data/v3/messages.bin
Binary file not shown.
3 changes: 2 additions & 1 deletion data/v3/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"chain_id": "35353",
"fee_contract": null,
"fee_recipient": "0x0000000000000000000000000000000000000000",
"max_block_size": "30720"
"max_block_size": "30720",
"stake_table_contract": null
}
}
},
Expand Down
Loading
Loading