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 38 commits into
base: ab/leaf2-migration
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5274951
epoch integration test
imabdulbasit Jan 21, 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
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
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
64eb0d8
Make epoch_height on TestNetwork configurable
tbro Feb 10, 2025
c9eeb2a
fix
tbro Feb 10, 2025
87b1547
remove comment
tbro 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
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
2 changes: 1 addition & 1 deletion .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 Down
9 changes: 6 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,14 @@ jobs:
needs: [build-test-bins, build-test-artifacts-postgres]
strategy:
matrix:
version: [02,99]
version: [03]
include:
- version: 02
compose: "-f process-compose.yaml -D"

- version: 03
env:
ESPRESSO_SEQUENCER_GENESIS_FILE=data/genesis/demo-pos-base.toml
compose: "-f process-compose.yaml -D"
- version: 99
compose: "-f process-compose.yaml -f process-compose-mp.yml -D"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -231,7 +234,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
16 changes: 9 additions & 7 deletions Cargo.lock

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

8 changes: 0 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,6 @@ paste = "1.0"
rand = "0.8.5"
time = "0.3"
trait-set = "0.3.0"

[profile.dev]
# No optimizations
opt-level = 0
# Skip compiling the debug information.
debug = false
# Skip linking symbols.
strip = true
[profile.test]
opt-level = 1
[profile.test.package.tests]
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,
};

Self {
Expand Down
1 change: 1 addition & 0 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ surf-disco = { workspace = true }
tokio = { workspace = true }
tracing = { workspace = true }
vbs = { workspace = true }
hotshot-types = { workspace = true }
21 changes: 19 additions & 2 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use anyhow::Context;
use espresso_types::{FeeAccount, FeeAmount, FeeMerkleTree, Header};
use espresso_types::{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 @@ -51,7 +52,7 @@ impl SequencerClient {
height: u64,
) -> anyhow::Result<BoxStream<'static, Result<Header, ClientError>>> {
self.0
.socket(&format!("availability/stream/headers/{height}"))
.socket(&format!("v0/availability/stream/headers/{height}"))
.subscribe::<Header>()
.await
.context("subscribing to Espresso headers")
Expand Down Expand Up @@ -119,6 +120,22 @@ impl SequencerClient {
let balance = proof.elem().copied().unwrap_or(0.into());
Ok(balance)
}

pub async fn current_epoch(&self) -> anyhow::Result<u64> {
self.0
.get::<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 epoch value")
}
}

#[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"

[stake_table]
capacity = 10

[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"

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

[l1_finalized]
number = 0

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ timestamp = "1970-01-01T00:00:00Z"
number = 0

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

Expand Down
2 changes: 1 addition & 1 deletion hotshot-query-service/examples/simple-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ async fn init_consensus(
stop_proposing_time: 0,
start_voting_time: 0,
stop_voting_time: 0,
epoch_height: 0,
epoch_height: 150,
};

let nodes = join_all(priv_keys.into_iter().zip(data_sources).enumerate().map(
Expand Down
2 changes: 1 addition & 1 deletion hotshot-query-service/src/testing/consensus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ impl<D: DataSourceLifeCycle + UpdateStatusData> MockNetwork<D> {
stop_proposing_time: 0,
start_voting_time: 0,
stop_voting_time: 0,
epoch_height: 0,
epoch_height: 150,
};
update_config(&mut config);

Expand Down
13 changes: 13 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# export RUST_BACKTRACE := "1"

default:
just --list

Expand Down Expand Up @@ -29,6 +31,12 @@ build profile="test":
demo-native-mp *args: build
scripts/demo-native -f process-compose.yaml -f process-compose-mp.yml {{args}}

demo-native-pos *args: build
ESPRESSO_SEQUENCER_GENESIS_FILE=data/genesis/demo-pos.toml scripts/demo-native -f process-compose.yaml {{args}}

demo-native-pos-base *args: build
ESPRESSO_SEQUENCER_GENESIS_FILE=data/genesis/demo-pos-base.toml scripts/demo-native -f process-compose.yaml {{args}}

demo-native-benchmark:
cargo build --release --features benchmarking
scripts/demo-native
Expand Down Expand Up @@ -71,10 +79,15 @@ test-all:
test-integration:
@echo 'NOTE that demo-native must be running for this test to succeed.'
INTEGRATION_TEST_SEQUENCER_VERSION=2 cargo nextest run --all-features --nocapture --profile integration smoke

test-integration-mp:
@echo 'NOTE that demo-native-mp must be running for this test to succeed.'
INTEGRATION_TEST_SEQUENCER_VERSION=99 cargo nextest run --all-features --nocapture --profile integration

test-integration-pos:
@echo 'NOTE that demo-native-pos must be running for this test to succeed.'
INTEGRATION_TEST_SEQUENCER_VERSION=3 cargo nextest run --all-features --nocapture --profile integration smoke

clippy:
@echo 'features: "embedded-db"'
cargo clippy --workspace --features embedded-db --all-targets -- -D warnings
Expand Down
6 changes: 3 additions & 3 deletions process-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ environment:
- ESPRESSO_SEQUENCER_ORCHESTRATOR_URL=http://localhost:$ESPRESSO_ORCHESTRATOR_PORT
- ESPRESSO_SEQUENCER_URL=http://localhost:$ESPRESSO_SEQUENCER_API_PORT
- ESPRESSO_SEQUENCER_L1_PROVIDER=http://localhost:$ESPRESSO_SEQUENCER_L1_PORT
- ESPRESSO_SEQUENCER_GENESIS_FILE=data/genesis/demo.toml
- ESPRESSO_BUILDER_GENESIS_FILE=data/genesis/demo.toml
# - ESPRESSO_SEQUENCER_GENESIS_FILE=$DEMO_GENESIS_FILE
# - ESPRESSO_BUILDER_GENESIS_FILE=$DEMO_GENESIS_FILE
- ESPRESSO_SEQUENCER_INITIAL_PERMISSIONED_STAKE_TABLE_PATH=data/initial_stake_table.toml
- ESPRESSO_STATE_RELAY_SERVER_URL=http://localhost:$ESPRESSO_STATE_RELAY_SERVER_PORT
- QUERY_SERVICE_URI=http://localhost:$ESPRESSO_SEQUENCER1_API_PORT/v0/
Expand Down Expand Up @@ -534,7 +534,7 @@ processes:
host: localhost
port: $ESPRESSO_BUILDER_SERVER_PORT
path: /healthcheck
failure_threshold: 100
failure_threshold: 5
period_seconds: 1
availability:
restart: "exit_on_failure"
Expand Down
1 change: 1 addition & 0 deletions sequencer-sqlite/Cargo.lock

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

4 changes: 4 additions & 0 deletions sequencer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["pos"]
testing = [
"hotshot-testing",
"marketplace-builder-core",
Expand All @@ -15,6 +16,9 @@ testing = [
]
benchmarking = []
embedded-db = ["hotshot-query-service/embedded-db"]
fee = []
pos = []
marketplace = []

[[bin]]
name = "espresso-dev-node"
Expand Down
4 changes: 4 additions & 0 deletions sequencer/api/node.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ DOC = "Get the stake table for the current epoch"
PATH = ["stake-table/:epoch_number"]
":epoch_number" = "Integer"
DOC = "Get the stake table for the given epoch"

[route.current_epoch]
PATH = ["current_epoch"]
DOC = "Get the current epoch"
Loading
Loading