Skip to content

Use StakeTableV2 and new events in the GCL #3289

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

Merged
merged 38 commits into from
May 28, 2025
Merged
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
db1ed76
WIP: use StakeTableV2
sveitser May 19, 2025
c789fc2
Use bytes for schnorr sig in stake table contract
sveitser May 20, 2025
0166bb0
add bls key verify function
alxiong May 22, 2025
fb2ca09
Merge remote-tracking branch 'origin/main' into ma/staking-cli-signat…
sveitser May 22, 2025
a056f32
stake table: verify validator event signatures
sveitser May 22, 2025
d8d7c1f
test: deploy stake table upgrade
sveitser May 22, 2025
6c46aea
stake table: verify event signatures in GCL
sveitser May 22, 2025
20a17ad
clippy
sveitser May 22, 2025
8a0e31e
use stake-table v2 for local demo
sveitser May 23, 2025
7617c22
update comment
sveitser May 23, 2025
afcb93c
fix: append v2 to new functions in v2 contract
sveitser May 23, 2025
05e7511
fix: assert version is 2 after upgrade
sveitser May 23, 2025
6e5b45e
use deployer code in staking-cli test system
sveitser May 23, 2025
fa60b98
staking-cli: allow using stake table V1 in tests
sveitser May 23, 2025
b027d6f
test: run staking-cli against contract v1 and v2
sveitser May 23, 2025
a659eee
test: use rstest to parametrize tests
sveitser May 23, 2025
fd2889e
Merge remote-tracking branch 'origin/main' into ma/staking-cli-signat…
sveitser May 26, 2025
8fc8a52
fix: contract upgrade test
sveitser May 26, 2025
3f86bdf
cleanup and documentation
sveitser May 26, 2025
ad7c6b9
espresso-types: stake table v2 unit tests
sveitser May 26, 2025
e839954
cleanup, comment regarding ABI and race condition
sveitser May 26, 2025
24bbdd4
commit missing file
sveitser May 26, 2025
88d7de7
persistence tests with both stake table versions
sveitser May 27, 2025
75e761a
remove testing modules
sveitser May 27, 2025
5e4ad53
stake table fetching: authenticate events early
sveitser May 27, 2025
294d222
test: filter unauthenticated stake table events
sveitser May 27, 2025
0584e25
update comments
sveitser May 27, 2025
a756313
fix TODO comment
sveitser May 27, 2025
d84e850
fix clippy
sveitser May 27, 2025
985ce8d
add unittests for bls sig verification
sveitser May 27, 2025
62f1923
remove unused error variants
sveitser May 27, 2025
521a764
move copy impl to copy.rs
sveitser May 28, 2025
e43169e
fix: maybe better function, plus doc comment
sveitser May 28, 2025
5011b37
Merge remote-tracking branch 'origin/main' into ma/staking-cli-signat…
sveitser May 28, 2025
06144cc
fix: staking-cli, actually use V2
sveitser May 28, 2025
ebe7026
staking-cli: be more explicit about ABI compat
sveitser May 28, 2025
8bf2101
fix: move dev dependency to dev-dependencies
sveitser May 28, 2025
2a4749f
fix: sqlite lock file
sveitser May 28, 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 @@ -65,7 +65,7 @@ ESP_TOKEN_NAME="Espresso"
ESP_TOKEN_SYMBOL="ESP"

# Contracts
ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS=0x196dbcbb54b8ec4958c959d8949ebfe87ac2aaaf
ESPRESSO_SEQUENCER_LIGHT_CLIENT_PROXY_ADDRESS=0x05b4cb126885fb10464fdd12666feb25e2563b76
ESPRESSO_SEQUENCER_STAKE_TABLE_PROXY_ADDRESS=0xed1db453c3156ff3155a97ad217b3087d5dc5f6e
ESPRESSO_SEQUENCER_FEE_CONTRACT_PROXY_ADDRESS=0xa15bb66138824a1c7167f5e85b957d04dd34e468
ESPRESSO_SEQUENCER_ESP_TOKEN_PROXY_ADDRESS=0xe1aa25618fa0c7a1cfdab5d6b456af611873b629
Expand Down
71 changes: 69 additions & 2 deletions Cargo.lock

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

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

# NOTE: when making changes here also update sequencer-sqlite/Cargo.toml.
[profile.dev]
Expand Down
2 changes: 2 additions & 0 deletions contracts/rust/adapter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,13 @@ ark-std = { workspace = true }
hotshot-types = { workspace = true }
jf-pcs = { workspace = true }
jf-plonk = { workspace = true }
jf-signature = { workspace = true, features = ["bls", "schnorr"] }
jf-utils = { workspace = true }
num-bigint = { version = "0.4", default-features = false }
num-traits = { version = "0.2", default-features = false }
rand = { workspace = true }
serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
tokio = { workspace = true }
Expand Down
426 changes: 188 additions & 238 deletions contracts/rust/adapter/src/bindings/staketablev2.rs

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions contracts/rust/adapter/src/copy.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// The bindings types are small and pure data, there is no reason they
// shouldn't be Copy. However some of them do have a bytes field which cannot be Copy.
impl Copy for crate::sol_types::G1PointSol {}
impl Copy for crate::sol_types::G2PointSol {}
impl Copy for crate::sol_types::EdOnBN254PointSol {}
impl Copy for crate::sol_types::StakeTableV2::ValidatorRegistered {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not totally sure but would this also need to be called ValidatorRegisteredV2?

Copy link
Collaborator Author

@sveitser sveitser May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No this is the the V1 event defined in the V2 abi. The rust code is now written to always use the V2 ABI/bindings (except for when deploying the original StakeTable contract) because the V2 ABI it's a superset of the V1 ABI. I think I left some comments about this in the stake table contract.

// schnorr sig in ValidatorRegisteredV2 uses Bytes, cannot implement copy
impl Copy for crate::sol_types::StakeTableV2::ValidatorExit {}
impl Copy for crate::sol_types::StakeTableV2::ConsensusKeysUpdated {}
// schnorr sig in ConsensusKeysUpdatedV2 Bytes, cannot implement copy
impl Copy for crate::sol_types::StakeTableV2::Delegated {}
impl Copy for crate::sol_types::StakeTableV2::Undelegated {}
impl Copy for crate::sol_types::staketablev2::BN254::G1Point {}
1 change: 1 addition & 0 deletions contracts/rust/adapter/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use ark_ff::{BigInteger, PrimeField};

#[allow(dead_code)]
pub(crate) mod bindings;
mod copy;
pub mod evm;
pub mod jellyfish;
pub mod light_client;
Expand Down
Loading
Loading