Skip to content

Commit

Permalink
feat: add reth test-vectors compact --write|--read (paradigmxyz#11954)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo authored Oct 24, 2024
1 parent ba78e43 commit 777417a
Show file tree
Hide file tree
Showing 51 changed files with 857 additions and 101 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/compact.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Ensures that `Compact` codec changes are backwards compatible.
#
# 1) checkout `main`
# 2) randomly generate and serialize to disk many different type vectors with `Compact` (eg. Header, Transaction, etc)
# 3) checkout `pr`
# 4) deserialize previously generated test vectors

on:
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

name: compact-codec
jobs:
compact-codec:
runs-on:
group: Reth
strategy:
matrix:
bin:
- cargo run --bin reth --features "dev"
- cargo run --bin op-reth --features "optimism dev" --manifest-path crates/optimism/bin/Cargo.toml
steps:
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
- name: Checkout base
uses: actions/checkout@v4
with:
ref: ${{ github.base_ref || 'main' }}
# On `main` branch, generates test vectors and serializes them to disk using `Compact`.
- name: Generate compact vectors
run: ${{ matrix.bin }} -- test-vectors compact --write
- name: Checkout PR
uses: actions/checkout@v4
with:
clean: false
# On incoming merge try to read and decode previously generated vectors with `Compact`
- name: Read vectors
run: ${{ matrix.bin }} -- test-vectors compact --read
18 changes: 18 additions & 0 deletions Cargo.lock

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

32 changes: 22 additions & 10 deletions crates/cli/commands/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ reth-cli.workspace = true
reth-ethereum-cli.workspace = true
reth-cli-runner.workspace = true
reth-cli-util.workspace = true
reth-codecs = { workspace = true, optional = true }
reth-config.workspace = true
reth-consensus.workspace = true
reth-db = { workspace = true, features = ["mdbx"] }
Expand All @@ -38,11 +39,14 @@ reth-node-metrics.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-prune.workspace = true
reth-prune-types = { workspace = true, optional = true }
reth-stages.workspace = true
reth-stages-types = { workspace = true, optional = true }
reth-static-file-types = { workspace = true, features = ["clap"] }
reth-static-file.workspace = true
reth-trie = { workspace = true, features = ["metrics"] }
reth-trie-db = { workspace = true, features = ["metrics"] }
reth-trie-common = { workspace = true, optional = true }

# ethereum
alloy-eips.workspace = true
Expand Down Expand Up @@ -89,14 +93,22 @@ reth-discv4.workspace = true
[features]
default = []
arbitrary = [
"dep:proptest",
"dep:arbitrary",
"dep:proptest-arbitrary-interop",
"reth-primitives/arbitrary",
"reth-db-api/arbitrary",
"reth-eth-wire/arbitrary",
"reth-db/arbitrary",
"reth-chainspec/arbitrary",
"alloy-eips/arbitrary",
"alloy-primitives/arbitrary",
"dep:proptest",
"dep:arbitrary",
"dep:proptest-arbitrary-interop",
"reth-primitives/arbitrary",
"reth-db-api/arbitrary",
"reth-eth-wire/arbitrary",
"reth-db/arbitrary",
"reth-chainspec/arbitrary",
"alloy-eips/arbitrary",
"alloy-primitives/arbitrary",
"reth-codecs/test-utils",
"reth-prune-types/test-utils",
"reth-stages-types/test-utils",
"reth-trie-common/test-utils",
"reth-codecs?/arbitrary",
"reth-prune-types?/arbitrary",
"reth-stages-types?/arbitrary",
"reth-trie-common?/arbitrary"
]
Loading

0 comments on commit 777417a

Please sign in to comment.