diff --git a/Cargo.lock b/Cargo.lock index fa6b85a..8b0d4bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1617,7 +1617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" dependencies = [ "libc", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -2845,7 +2845,7 @@ dependencies = [ [[package]] name = "op-revm" version = "10.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "auto_impl", "revm", @@ -3311,7 +3311,7 @@ checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" [[package]] name = "revm" version = "29.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "revm-bytecode", "revm-context", @@ -3329,7 +3329,7 @@ dependencies = [ [[package]] name = "revm-bytecode" version = "6.2.2" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "bitvec", "phf", @@ -3340,7 +3340,7 @@ dependencies = [ [[package]] name = "revm-context" version = "9.0.2" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "bitvec", "cfg-if", @@ -3356,7 +3356,7 @@ dependencies = [ [[package]] name = "revm-context-interface" version = "10.1.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -3371,7 +3371,7 @@ dependencies = [ [[package]] name = "revm-database" version = "7.0.5" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "alloy-eips", "revm-bytecode", @@ -3384,7 +3384,7 @@ dependencies = [ [[package]] name = "revm-database-interface" version = "7.0.5" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "auto_impl", "either", @@ -3396,7 +3396,7 @@ dependencies = [ [[package]] name = "revm-handler" version = "10.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "auto_impl", "derive-where", @@ -3414,7 +3414,7 @@ dependencies = [ [[package]] name = "revm-inspector" version = "10.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "auto_impl", "either", @@ -3431,7 +3431,7 @@ dependencies = [ [[package]] name = "revm-interpreter" version = "25.0.2" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "revm-bytecode", "revm-context-interface", @@ -3443,7 +3443,7 @@ dependencies = [ [[package]] name = "revm-precompile" version = "27.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "ark-bls12-381", "ark-bn254", @@ -3466,7 +3466,7 @@ dependencies = [ [[package]] name = "revm-primitives" version = "20.2.1" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "alloy-primitives", "num_enum", @@ -3477,7 +3477,7 @@ dependencies = [ [[package]] name = "revm-state" version = "7.0.5" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "bitflags 2.13.1", "revm-bytecode", @@ -3616,7 +3616,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -3882,7 +3882,7 @@ dependencies = [ [[package]] name = "seismic-revm" version = "1.0.0" -source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=45b4f4f036d324013636c9f3203012e58971c187#45b4f4f036d324013636c9f3203012e58971c187" +source = "git+https://github.com/SeismicSystems/seismic-revm.git?rev=a8d131537b21abc9bcf2984b2e319893a47d4b2d#a8d131537b21abc9bcf2984b2e319893a47d4b2d" dependencies = [ "auto_impl", "hkdf", @@ -4242,7 +4242,7 @@ dependencies = [ "getrandom 0.4.3", "once_cell", "rustix", - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] @@ -4751,7 +4751,7 @@ version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" dependencies = [ - "windows-sys 0.61.2", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 395dad7..f7bd17a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,6 +87,6 @@ alloy-sol-type-parser = { git = "https://github.com/SeismicSystems/seismic-alloy seismic-alloy-consensus = { git = "https://github.com/SeismicSystems/seismic-alloy.git", rev = "70d1fb739c411b86199578b1f190fbc03c27ccda" } # revm -revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "45b4f4f036d324013636c9f3203012e58971c187" } -op-revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "45b4f4f036d324013636c9f3203012e58971c187" } -seismic-revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "45b4f4f036d324013636c9f3203012e58971c187" } +revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "a8d131537b21abc9bcf2984b2e319893a47d4b2d" } +op-revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "a8d131537b21abc9bcf2984b2e319893a47d4b2d" } +seismic-revm = { git = "https://github.com/SeismicSystems/seismic-revm.git", rev = "a8d131537b21abc9bcf2984b2e319893a47d4b2d" } diff --git a/crates/evm/src/tx.rs b/crates/evm/src/tx.rs index e72e453..c0ad06d 100644 --- a/crates/evm/src/tx.rs +++ b/crates/evm/src/tx.rs @@ -572,7 +572,12 @@ impl FromTxWithEncoded for SeismicTransaction { fn from_encoded_tx(tx: &SeismicTxEnvelope, sender: Address, _encoded: Bytes) -> Self { let tx_env = SeismicTransaction::::from_recovered_tx(tx, sender); - Self { base: tx_env.base, tx_hash: tx_env.tx_hash, decryption_failed: false } + Self { + base: tx_env.base, + tx_hash: tx_env.tx_hash, + decryption_failed: false, + signed_read: false, + } } } @@ -591,7 +596,7 @@ impl FromRecoveredTx for SeismicTransaction { SeismicTxEnvelope::Eip7702(tx) => TxEnv::from_recovered_tx(tx.tx(), sender), SeismicTxEnvelope::Seismic(tx) => TxEnv::from_recovered_tx(tx.tx(), sender), }; - SeismicTransaction { base, tx_hash, decryption_failed: false } + SeismicTransaction { base, tx_hash, decryption_failed: false, signed_read: false } } } diff --git a/crates/seismic-evm/src/block/mod.rs b/crates/seismic-evm/src/block/mod.rs index 391c3dc..51a0c56 100644 --- a/crates/seismic-evm/src/block/mod.rs +++ b/crates/seismic-evm/src/block/mod.rs @@ -829,4 +829,62 @@ mod tests { "transaction one block past expiry should be rejected, but it was accepted" ); } + + /// A `SeismicEvmFactory`-built EVM must expose the tx-type precompile at `0x6A`: a + /// top-level call returns the transaction's EIP-2718 type byte as a 32-byte word — the + /// value `TxUtils.txType()` reads via `staticcall`. This is the standalone-crate proof + /// that re-pinning to the precompile revm actually wires `0x6A` into the factory. + #[test] + fn test_txtype_precompile_via_factory() { + fn probe(tx_type: u8, signed_read: bool, selector: &[u8]) -> U256 { + let mut state = StateBuilder::new_with_database(InMemoryDB::default()).build(); + let mock_keys = Box::leak(Box::new(PurposeKeys::well_known())); + let evm_factory = SeismicEvmFactory::new_with_purpose_keys(mock_keys); + let mut evm = evm_factory.create_evm( + &mut state, + EvmEnv::new(CfgEnv::new_with_spec(SeismicSpecId::MERCURY), BlockEnv::default()), + ); + + let tx = SeismicTransaction { + base: TxEnv { + caller: Address::ZERO, + kind: TxKind::Call(Address::with_last_byte(0x6A)), + nonce: 0, + gas_limit: 1_000_000, + gas_price: 0, + gas_priority_fee: None, + value: U256::ZERO, + data: Bytes::copy_from_slice(selector), + chain_id: None, + access_list: Default::default(), + blob_hashes: Vec::new(), + max_fee_per_blob_gas: 0, + tx_type, + authorization_list: Default::default(), + }, + tx_hash: Default::default(), + decryption_failed: false, + signed_read, + }; + + let out = match evm.transact(tx).expect("transact to 0x6A").result { + ExecutionResult::Success { output, .. } => output.into_data(), + other => panic!("call to 0x6A precompile failed: {other:?}"), + }; + assert_eq!(out.len(), 32, "tx-context precompile must return a 32-byte word"); + U256::from_be_slice(&out) + } + + // Empty selector → the raw EIP-2718 tx type. + assert_eq!(probe(0x4A, false, &[]), U256::from(0x4Au64)); + assert_eq!(probe(0, false, &[]), U256::ZERO); + + // Selector 0x01 → `signed_read && tx_type == 74`. + assert_eq!(probe(0x4A, true, &[0x01]), U256::from(1u64)); + assert_eq!(probe(0x4A, false, &[0x01]), U256::ZERO); + // Raw signed_read=true on a non-Seismic type is normalized to 0 (isSignedRead => + // isSeismicTx). + assert_eq!(probe(0, true, &[0x01]), U256::ZERO); + assert_eq!(probe(2, true, &[0x01]), U256::ZERO); + } } diff --git a/crates/seismic-evm/src/lib.rs b/crates/seismic-evm/src/lib.rs index 31dd520..5f3cbe2 100644 --- a/crates/seismic-evm/src/lib.rs +++ b/crates/seismic-evm/src/lib.rs @@ -214,6 +214,7 @@ where }, tx_hash: Default::default(), decryption_failed: false, + signed_read: false, }; let mut gas_limit = tx.base.gas_limit;