Skip to content

Commit

Permalink
replace serde-brief with pot to downgrade msrv
Browse files Browse the repository at this point in the history
  • Loading branch information
hashcashier committed Oct 29, 2024
1 parent 2618209 commit 90ac6c6
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 27 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
crate: cargo-binstall
- run: cargo binstall -y --force cargo-risczero@$RISC0_VERSION
- run: cargo risczero install --version $RISC0_TOOLCHAIN_VERSION
- run: cargo risczero build-toolchain --version erik/risc0-1.81.0
- run: cargo test --workspace --all-targets -F debug-guest-build

clippy:
Expand All @@ -61,9 +60,9 @@ jobs:
steps:
- uses: actions/checkout@v4
- if: matrix.feature == 'cuda'
uses: risc0/risc0/.github/actions/cuda@v1.0.5
- uses: risc0/risc0/.github/actions/rustup@v1.0.5
- uses: risc0/risc0/.github/actions/sccache@v1.0.5
uses: risc0/risc0/.github/actions/cuda@v1.1.2
- uses: risc0/risc0/.github/actions/rustup@v1.1.2
- uses: risc0/risc0/.github/actions/sccache@v1.1.2
- uses: risc0/clippy-action@main
with:
reporter: 'github-pr-check'
Expand All @@ -76,5 +75,5 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: risc0/risc0/.github/actions/rustup@v1.0.5
- uses: risc0/risc0/.github/actions/rustup@v1.1.2
- run: cargo fmt --all --check
24 changes: 24 additions & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ env_logger = "0.11.5"
hashbrown = { version = "0.15.0", features = ["inline-more"] }
log = "0.4.22"
flate2 = "1.0.34"
pot = "3.0.1"
serde = { version = "1.0.210", features = ["derive"] }
serde_json = { version = "1.0.128", features = ["alloc"] }
serde-brief = "0.1.0"
thiserror = "1.0.64"
tiny-keccak = "2.0.2"
tokio = { version = "1.40.0", features = ["full"] }
Expand Down
2 changes: 1 addition & 1 deletion bin/zeth/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ bytemuck.workspace = true
clap.workspace = true
env_logger.workspace = true
log.workspace = true
pot.workspace = true

reth-chainspec.workspace = true
reth-primitives.workspace = true
reth-revm.workspace = true

serde.workspace = true
serde-brief = { workspace = true, features = ["std"] }
tokio.workspace = true
tracing.workspace = true

Expand Down
5 changes: 1 addition & 4 deletions bin/zeth/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@

use alloy::primitives::B256;
use reth_primitives::{Block, Header};
use serde_brief::to_vec_with_config;
use zeth_core::stateless::data::StatelessClientData;
use zeth_core::SERDE_BRIEF_CFG;

#[derive(Debug, Default, Clone)]
pub struct Witness {
Expand All @@ -27,8 +25,7 @@ pub struct Witness {

impl From<StatelessClientData<Block, Header>> for Witness {
fn from(value: StatelessClientData<Block, Header>) -> Self {
let encoded_input =
to_vec_with_config(&value, SERDE_BRIEF_CFG).expect("brief serialization failed");
let encoded_input = pot::to_vec(&value).expect("serialization failed");
Self {
encoded_input,
validated_tip: value.blocks.last().unwrap().hash_slow(),
Expand Down
5 changes: 2 additions & 3 deletions bin/zeth/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ use zeth_core::rescue::Recoverable;
use zeth_core::stateless::client::{RethStatelessClient, StatelessClient};
use zeth_core::stateless::data::StatelessClientData;
use zeth_core::stateless::driver::{RethDriver, SCEDriver};
use zeth_core::SERDE_BRIEF_CFG;
use zeth_preflight::client::{PreflightClient, RethPreflightClient};
use zeth_preflight::derive::{RPCDerivableBlock, RPCDerivableHeader};
use zeth_preflight::provider::cache_provider::cache_dir_path;
Expand Down Expand Up @@ -72,8 +71,8 @@ where
build_result.encoded_input.len()
);
let deserialized_preflight_data: StatelessClientData<B, H> =
serde_brief::from_slice_with_config(&build_result.encoded_input, SERDE_BRIEF_CFG)
.context("brief deserialization failed")?;
Self::StatelessClient::deserialize_data(build_result.encoded_input.as_slice())
.context("input deserialization failed")?;
<Self::StatelessClient>::validate(chain_spec.clone(), deserialized_preflight_data)
.expect("Block validation failed");
info!("Memory run successful ...");
Expand Down
2 changes: 1 addition & 1 deletion crates/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ reth-primitives.workspace = true
reth-revm.workspace = true
reth-storage-errors.workspace = true

pot.workspace = true
serde.workspace = true
serde-brief = { workspace = true, features = ["std"] }
thiserror.workspace = true
tiny-keccak.workspace = true
6 changes: 0 additions & 6 deletions crates/core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,3 @@ pub mod keccak;
pub mod mpt;
pub mod rescue;
pub mod stateless;

pub const SERDE_BRIEF_CFG: serde_brief::Config = serde_brief::Config {
use_indices: true,
error_on_excess_data: false,
max_size: None,
};
6 changes: 1 addition & 5 deletions crates/core/src/stateless/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ use crate::stateless::post_exec::{PostExecutionValidationStrategy, RethPostExecS
use crate::stateless::pre_exec::{
ConsensusPreExecValidationInput, PreExecutionValidationStrategy, RethPreExecStrategy,
};
use crate::SERDE_BRIEF_CFG;
use alloy_consensus::Header;
use reth_chainspec::ChainSpec;
use reth_evm_ethereum::execute::EthBatchExecutor;
Expand Down Expand Up @@ -87,10 +86,7 @@ where
>;

fn deserialize_data<I: Read>(reader: I) -> anyhow::Result<StatelessClientData<Block, Header>> {
Ok(serde_brief::from_reader_with_config(
reader,
SERDE_BRIEF_CFG,
)?)
Ok(pot::from_reader(reader)?)
}

fn validate(
Expand Down
2 changes: 1 addition & 1 deletion crates/preflight/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ reth-revm.workspace = true
reth-primitives.workspace = true
reth-storage-errors.workspace = true

pot.workspace = true
serde_json.workspace = true
serde-brief.workspace = true
tokio.workspace = true
tracing.workspace = true
22 changes: 22 additions & 0 deletions guests/reth/Cargo.lock

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

0 comments on commit 90ac6c6

Please sign in to comment.