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

Add/improve tests for serialization and commitment compatibility #1486

Merged
merged 7 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,9 @@ node_modules/
# solidity files cache
cache

**/*.bin
**/*.bin
!data/*.bin

# generated by failing serialization tests
data/*-actual.json
data/*-actual.bin
2 changes: 1 addition & 1 deletion .typos.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[files]
extend-exclude = [
"*.json",
"doc/*.svg",
"geth-config/*.json",
"contracts/lib",
"contract-bindings",
]
18 changes: 17 additions & 1 deletion Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@ vergen = { version = "8.3", features = ["git", "gitcl"] }
zeroize = "1.7"
committable = "0.2"
portpicker = "0.1.1"
pretty_assertions = "1.4"
11 changes: 6 additions & 5 deletions data/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Reference Data

This directory contains reference instantiations of the data types used by the sequencer which have a stable
language-agnostic interface for serialization (via JSON) and cryptographic commitments. The objects in this directory
have well-known commitments. They serve as examples of the data formats used by the Espresso Sequencer, and can be used
as test cases for ports of the serialization and commitment algorithms to other languages.
language-agnostic interface for serialization (in both `.json` files and binary `.bin` files) and cryptographic
commitments. The objects in this directory have well-known commitments. They serve as examples of the data formats used
by the Espresso Sequencer, and can be used as test cases for ports of the serialization and commitment algorithms to
other languages.

The Rust module `sequencer::block::reference` contains test cases which are designed to fail if the serialization format
The Rust module `sequencer::reference_tests` contains test cases which are designed to fail if the serialization format
or commitment scheme for any of these data types changes. If you make a breaking change, you may need to update these
reference objects as well. Running those tests will also print out information about the commitments of these reference
objects, which can be useful for generating test cases for ports. To run them and get the output, use

```bash
cargo test --all-features -p sequencer -- --nocapture --test-threads 1 block::reference
cargo test --all-features -p sequencer -- --nocapture --test-threads 1 reference_tests
```
Binary file added data/chain_config.bin
Binary file not shown.
7 changes: 7 additions & 0 deletions data/chain_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"chain_id": "0x8a19",
"max_block_size": 10240,
"base_fee": "0x0",
"fee_contract": "0x0000000000000000000000000000000000000000",
"fee_recipient": "0x0000000000000000000000000000000000000000"
}
Binary file added data/fee_info.bin
Binary file not shown.
4 changes: 4 additions & 0 deletions data/fee_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"account": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
"amount": "0x0"
}
Binary file added data/header.bin
Binary file not shown.
56 changes: 34 additions & 22 deletions data/header.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
{
"height": 42,
"timestamp": 789,
"l1_head": 124,
"l1_finalized": {
"number": 123,
"timestamp": "0x456",
"hash": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
},
"payload_commitment": "HASH~1yS-KEtL3oDZDBJdsW51Pd7zywIiHesBZsTbpOzrxOfu",
"builder_commitment": "BUILDER_COMMITMENT~1yS-KEtL3oDZDBJdsW51Pd7zywIiHesBZsTbpOzrxOdZ",
"ns_table": {
"bytes": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
"block_merkle_tree_root": "MERKLE_COMM~yB4_Aqa35_PoskgTpcCR1oVLh6BUdLHIs7erHKWi-usUAAAAAAAAAAEAAAAAAAAAJg",
"fee_merkle_tree_root": "MERKLE_COMM~VJ9z239aP9GZDrHp3VxwPd_0l28Hc5KEAB1pFeCIxhYgAAAAAAAAAAIAAAAAAAAAdA",
"fee_info": { "account": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", "amount": "0x0" },
"chain_config": { "chain_config": { "Left": {
"chain_id": "0x8a19",
"max_block_size": 10240,
"block_merkle_tree_root": "MERKLE_COMM~AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAQA",
"builder_commitment": "BUILDER_COMMITMENT~PfISPEAHYbCXqJ08RqlK74d9aSrtrZkKHdnoX7crymG5",
"builder_signature": {
"r": "0xca39647d5e159ebf62e0efd163ddb2b7946f437948e6c31accdb5360a9f2da17",
"s": "0x610e51dced89ede20e3dcc5e9e26fff580738e785371df53389f2f84dadbdb87",
"v": 28
},
"chain_config": {
"chain_config": {
"Left": {
"base_fee": "0x0",
"fee_contract": "0xa15bb66138824a1c7167f5e85b957d04dd34e468",
"fee_recipient": "0x0000000000000000000000000000000000000000"
} } }
"chain_id": "0x8a19",
"fee_contract": "0x0000000000000000000000000000000000000000",
"fee_recipient": "0x0000000000000000000000000000000000000000",
"max_block_size": 10240
}
}
},
"fee_info": {
"account": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
"amount": "0x0"
},
"fee_merkle_tree_root": "MERKLE_COMM~AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAKA",
"height": 42,
"l1_finalized": {
"hash": "0x0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
"number": 123,
"timestamp": "0x456"
},
"l1_head": 124,
"ns_table": {
"bytes": "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
},
"payload_commitment": "HASH~AazstQer_ho1SqgGT0r10_Gs0BnjfbPBHJdSO3HHbp29",
"timestamp": 789
}
Binary file added data/l1_block.bin
Binary file not shown.
Binary file added data/messages.bin
Binary file not shown.
Loading
Loading