Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit b960c3f
Merge: 983db4b 70ab8b6
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:28:32 2024 +0800

    Merge remote-tracking branch 'cecilia/main' into sync-taiko-v3.5

commit 983db4b
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:21:10 2024 +0800

    non exclusive op & taiko flags

commit 115d5fe
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:11:48 2024 +0800

    cleanup

commit 7b0065b
Merge: c306f98 9d655c4
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:06:29 2024 +0800

    Merge remote-tracking branch 'cecilia/main' into sync-taiko-v3.5

commit c306f98
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Fri Jan 19 03:02:19 2024 +0800

    handler register

commit 72a085e
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 16:02:07 2024 +0800

    fix specs and conditional op/taiko flags, todo: taiko handlers

commit 3ec69ee
Merge: a983b13 9a03c7e
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 16:01:11 2024 +0800

    Merge remote-tracking branch 'cecilia/serde-no-std' into sync-taiko-v3.5

commit 9a03c7e
Merge: cf4da2f 0629883
Author: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com>
Date:   Thu Jan 18 14:44:30 2024 +0800

    Merge branch 'main' into serde-no-std

commit cf4da2f
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 14:35:37 2024 +0800

    "preserve_order"

commit 6f95113
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 14:33:28 2024 +0800

    delete comment #"std"

commit 15c51fa
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 13:30:33 2024 +0800

    optional serde std

commit a983b13
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 13:30:33 2024 +0800

    optional serde std

commit 546cb51
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Thu Jan 18 12:47:50 2024 +0800

    update

commit f0d6806
Author: Leo Alt <leo@ethereum.org>
Date:   Fri Nov 24 16:32:08 2023 +0100

    use serde as no-std

commit 0546172
Merge: c7aee3a 327dc05
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Wed Jan 17 03:46:52 2024 +0800

    Merge remote-tracking branch 'john/feat/taiko' into cecilia-taiko

commit c7aee3a
Author: ceciliaz030 <zhangyixin319@gmail.com>
Date:   Wed Jan 17 03:11:35 2024 +0800

    init

commit 327dc05
Author: john xu <john@taiko.xyz>
Date:   Mon Dec 18 06:58:08 2023 +0000

    Refactor handler functions in EVM implementation

commit 2e96144
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:59:10 2023 +0000

    Add condition to disable gas refund for anchor transactions

commit 13c2272
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:21:01 2023 +0000

    Remove once_cell dependency

commit 6c6b061
Author: john xu <john@taiko.xyz>
Date:   Sat Dec 9 07:13:20 2023 +0000

    Add taiko module and handler

commit cbbfe9c
Author: Leo Alt <leo@ethereum.org>
Date:   Fri Nov 24 16:32:08 2023 +0100

    use serde as no-std

commit 0e7d779
Author: john xu <john@taiko.xyz>
Date:   Thu Oct 19 12:28:10 2023 +0000

    feat: anchor check in zeth

commit daf73ee
Author: john xu <john@taiko.xyz>
Date:   Tue Oct 17 13:18:20 2023 +0000

    feat: support taiko protocol

taiko reimburse_caller & reward_beneficiary

KATLA is before CANCUN, aka does not have 4844

--features taiko

more registers

update

pub mod handler_register

Update Cargo.toml

manual pick: bluealloy/pull/1073 & succinct/john/v5.0.0-patched

update c-kzg 1.0.0

latest bump compiled
  • Loading branch information
CeciliaZ030 committed Mar 27, 2024
1 parent 52c8f92 commit 92c7a18
Show file tree
Hide file tree
Showing 17 changed files with 393 additions and 76 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
fail-fast: false
matrix:
rust: ["stable", "beta", "nightly"]
flags: ["--no-default-features", "", "--all-features"]
flags: ["--no-default-features", "", "--features taiko"]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rust-docs
- run: cargo doc --workspace --all-features --no-deps --document-private-items
- run: cargo doc --workspace --features taiko --no-deps --document-private-items
env:
RUSTDOCFLAGS: "--cfg docsrs -D warnings"

Expand Down
48 changes: 37 additions & 11 deletions Cargo.lock

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

9 changes: 6 additions & 3 deletions bins/revme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ microbench = "0.5"
plain_hasher = "0.2"
revm = { path = "../../crates/revm", version = "7.2.0", default-features = false, features = [
"ethersdb",
"std",
"serde-json",
"c-kzg",
] }
alloy-rlp = { version = "0.3", default-features = false, features = [
"arrayvec",
"derive",
] }
serde = { version = "1.0", features = ["derive", "rc"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
serde = { version = "1.0", default-features = false, features = ["derive", "rc"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"]}
structopt = "0.3"
thiserror = "1.0"
triehash = "0.8"
walkdir = "2.5"
k256 = { version = "0.13.3", features = ["ecdsa"] }

[features]
default = ["std"]
std = ["serde/std", "serde_json/std", "alloy-rlp/std", "revm/std"]
1 change: 1 addition & 0 deletions crates/interpreter/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ optimism-default-handler = [
negate-optimism-default-handler = [
"revm-primitives/negate-optimism-default-handler",
]
taiko = ["revm-primitives/taiko"]

dev = [
"memory_limit",
Expand Down
6 changes: 6 additions & 0 deletions crates/interpreter/src/instructions/opcode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -954,6 +954,12 @@ pub const fn spec_opcode_gas(spec_id: SpecId) -> &'static [OpInfo; 256] {
const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::ECOTONE);
TABLE
}
#[cfg(feature = "taiko")]
SpecId::KATLA => {
const TABLE: &[OpInfo;256] = &make_gas_table(SpecId::KATLA);
TABLE
}

}
};
}
Expand Down
4 changes: 4 additions & 0 deletions crates/precompile/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ secp256k1 = { version = "0.28.2", default-features = false, features = [
"rand",
"global-context",
], optional = true }
sp1-precompiles = { git = "https://github.com/succinctlabs/sp1.git" }


[dev-dependencies]
criterion = { version = "0.5" }

[features]
default = ["std", "c-kzg", "secp256k1", "portable"]

std = [
"revm-primitives/std",
"k256/std",
Expand All @@ -50,6 +53,7 @@ std = [
asm-keccak = ["revm-primitives/asm-keccak"]

optimism = ["revm-primitives/optimism"]
taiko = ["revm-primitives/taiko"]
# Optimism default handler enabled Optimism handler register by default in EvmBuilder.
optimism-default-handler = [
"optimism",
Expand Down
2 changes: 2 additions & 0 deletions crates/precompile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ impl PrecompileSpecId {
BEDROCK | REGOLITH | CANYON => Self::BERLIN,
#[cfg(feature = "optimism")]
ECOTONE => Self::CANCUN,
#[cfg(feature = "taiko")]
KATLA => Self::BERLIN, // TODO(Cecilia): what is this?
}
}
}
Expand Down
28 changes: 25 additions & 3 deletions crates/precompile/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,27 @@ pub const ECRECOVER: PrecompileWithAddress = PrecompileWithAddress(
Precompile::Standard(ec_recover_run),
);

pub use self::secp256k1::ecrecover;
#[cfg(all(target_os = "zkvm", target_vendor = "succinct"))]
#[allow(clippy::module_inception)]
mod secp256k1 {
use crate::B256;
use revm_primitives::keccak256;

pub fn ecrecover(sig: &[u8; 65], msg: &B256) -> Result<B256, anyhow::Error> {
let recovered_key = sp1_precompiles::secp256k1::ecrecover(sig, msg)?;

let mut hash = keccak256(&recovered_key[1..]);

// truncate to 20 bytes
hash[..12].fill(0);
Ok(hash)
}
}

#[cfg(not(feature = "secp256k1"))]
#[cfg(all(
not(all(target_os = "zkvm", target_vendor = "succinct")),
not(feature = "secp256k1")
))]
#[allow(clippy::module_inception)]
mod secp256k1 {
use k256::ecdsa::{Error, RecoveryId, Signature, VerifyingKey};
Expand Down Expand Up @@ -40,7 +58,10 @@ mod secp256k1 {
}
}

#[cfg(feature = "secp256k1")]
#[cfg(all(
not(all(target_os = "zkvm", target_vendor = "succinct")),
feature = "secp256k1"
))]
#[allow(clippy::module_inception)]
mod secp256k1 {
use revm_primitives::{alloy_primitives::B512, keccak256, B256};
Expand All @@ -51,6 +72,7 @@ mod secp256k1 {

// Silence the unused crate dependency warning.
use k256 as _;
use sp1_precompiles as _;

pub fn ecrecover(sig: &B512, recid: u8, msg: &B256) -> Result<B256, secp256k1::Error> {
let recid = RecoveryId::from_i32(recid as i32).expect("recovery ID is valid");
Expand Down
1 change: 1 addition & 0 deletions crates/primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ asm-keccak = ["alloy-primitives/asm-keccak"]
portable = ["c-kzg?/portable"]

optimism = []
taiko = []
# Optimism default handler enabled Optimism handler register by default in EvmBuilder.
optimism-default-handler = ["optimism"]
negate-optimism-default-handler = []
Expand Down
Loading

0 comments on commit 92c7a18

Please sign in to comment.