Skip to content

Commit

Permalink
release: v2 (#47)
Browse files Browse the repository at this point in the history
* bump version

* add public_input_hash assert

* add changelog

* fix: pre bernoulli (#49)

* fix BLOCKHASH & SELFDESTRUCT in pre bernoulli

* update ci

* update ci

* some cleanup

* minimize trace
  • Loading branch information
lightsing authored Sep 18, 2024
1 parent f5df984 commit 27905d3
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 18 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ jobs:
strategy:
fail-fast: false
matrix:
network: [ "mainnet" ]
hardfork: [ "pre-bernoulli", "bernoulli", "curie", "darwin" ]
rust: [ "1.75", "nightly-2024-07-07" ]

steps:
Expand All @@ -90,8 +92,10 @@ jobs:
with:
repository: 'scroll-tech/block-testdata'
path: 'testdata'
sparse-checkout: '${{ matrix.network }}_blocks/${{ matrix.hardfork }}'
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v2
- run: cargo run --release --package stateless-block-verifier -- run-file testdata/mainnet_blocks/flatten-proofs/*
- name: Test ${{ matrix.network }} ${{ matrix.hardfork }}
run: cargo run --release --package stateless-block-verifier -- run-file testdata/${{ matrix.network }}_blocks/${{ matrix.hardfork }}/*
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [2.0.0] - 2024-09-04

### Added

- Add rkyv support, support zero-copy deserialization
- Add an `ordered-db` feature gate to ensure the order when iterating over the database
- Add a new sp1 cycle tracker macro `cycle_track!` which returns wrapped expression
- Add chunk mode to work in chunk mode ([#29](https://github.com/scroll-tech/stateless-block-verifier/pull/29))
- Add openmetrics support and a `metrics` feature gate ([#33](https://github.com/scroll-tech/stateless-block-verifier/pull/33))
- Add zktrie lazy commitment ([#39](https://github.com/scroll-tech/stateless-block-verifier/pull/39))

### Fixed

- revm v40 upgrade cause `EXTCODEHASH` loads code to check if it's EOF, fixed by [revm#17](https://github.com/scroll-tech/revm/pull/17/files)
- The tx hash is ignored and the tx hash is calculated from the tx body instead
- The `from` field of the transaction trace is ignored if it's not l1 msg, the `tx.from` will be recovered from the signature instead
- `BLOBHASH` & `BLOBBASEFEE` opcodes were accidentally enabled in CURIE ([#40](https://github.com/scroll-tech/stateless-block-verifier/pull/40))

### Changed

- Code database now use the keccak code hash as key, instead of the poseidon hash of the code ([#20](https://github.com/scroll-tech/stateless-block-verifier/pull/20))
- Remove StateDB, direct query the zktrie db ([#38](https://github.com/scroll-tech/stateless-block-verifier/pull/38))
- Dependency of `eth-types` is removed ([#43](https://github.com/scroll-tech/stateless-block-verifier/pull/43))
- Dependency of `mpt-zktrie` is removed ([#45](https://github.com/scroll-tech/stateless-block-verifier/pull/45))
- Dependency of `ethers-rs` is removed ([#46](https://github.com/scroll-tech/stateless-block-verifier/pull/46))

### Removed

- `post_check` is removed as long as the command line argument `--disable-check`
- Support of legacy trace format is removed, only support the trace with codes and flatten proofs now.

## [1.0.0] - 2024-07-26

### Added

- Initial release

[unreleased]: https://github.com/scroll-tech/stateless-block-verifier/compare/2.0.0...HEAD
[2.0.0]: https://github.com/scroll-tech/stateless-block-verifier/compare/v1.0.0...v2.0.0
[1.0.0]: https://github.com/scroll-tech/stateless-block-verifier/releases/tag/v1.0.0
18 changes: 9 additions & 9 deletions Cargo.lock

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

6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = ["crates/*"]
resolver = "2"

[workspace.package]
version = "0.3.0"
version = "2.0.0"
edition = "2021"
rust-version = "1.75"
authors = ["Scroll developers"]
Expand All @@ -20,16 +20,14 @@ thiserror = "1.0"
tiny-keccak = "2.0"

# dependencies from scroll-tech
poseidon-bn254 = { git = "https://github.com/scroll-tech/poseidon-bn254", branch = "master" }
poseidon-bn254 = { git = "https://github.com/scroll-tech/poseidon-bn254", branch = "master", features = ["bn254"] }
zktrie = { git = "https://github.com/scroll-tech/zktrie.git", branch = "main", features= ["rs_zktrie"] }

# binary dependencies
anyhow = "1.0"
async-channel = "2.2"
clap = "4"
env_logger = "0.9"
ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "feat/rkyv" }
ethers-providers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "feat/rkyv", default-features = false }
futures = "0.3"
serde = "1.0"
serde_json = "1.0"
Expand Down
7 changes: 6 additions & 1 deletion crates/bin/src/commands/run_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,12 @@ impl RunRpcCommand {
"scroll_getBlockTraceByNumberOrHash".into(),
(
format!("0x{:x}", block_number),
serde_json::json!({"StorageProofFormat": "flatten"}),
serde_json::json!({
"ExcludeExecutionResults": true,
"ExcludeTxStorageTraces": true,
"StorageProofFormat": "flatten",
"FlattenProofsOnly": true
}),
),
)
.await
Expand Down
7 changes: 6 additions & 1 deletion crates/core/src/chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ impl ChunkInfo {
mod tests {
use super::*;
use crate::{EvmExecutorBuilder, HardforkConfig};
use revm::primitives::b256;
use sbv_primitives::types::BlockTrace;
use std::cell::RefCell;

Expand Down Expand Up @@ -164,6 +165,10 @@ mod tests {

let mut tx_bytes_hash = B256::ZERO;
tx_bytes_hasher.into_inner().finalize(&mut tx_bytes_hash.0);
let _public_input_hash = chunk_info.public_input_hash(&tx_bytes_hash);
let public_input_hash = chunk_info.public_input_hash(&tx_bytes_hash);
assert_eq!(
public_input_hash,
b256!("764bffabc9fd4227d447a46d8bb04e5448ed64d89d6e5f4215fcf3593e00f109")
);
}
}
4 changes: 2 additions & 2 deletions crates/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ pub fn init_hash_scheme() {
static INIT: Once = Once::new();
INIT.call_once(|| {
zktrie::init_hash_scheme_simple(|a: &[u8; 32], b: &[u8; 32], domain: &[u8; 32]| {
use poseidon_bn254::{hash_with_domain, Fr};
use poseidon_bn254::{hash_with_domain, Fr, PrimeField};
let a = Fr::from_bytes(a).into_option()?;
let b = Fr::from_bytes(b).into_option()?;
let domain = Fr::from_bytes(domain).into_option()?;
Some(hash_with_domain(&[a, b], domain).to_bytes())
Some(hash_with_domain(&[a, b], domain).to_repr())
});
});
}
Expand Down

0 comments on commit 27905d3

Please sign in to comment.