Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
9 changes: 7 additions & 2 deletions crates/evm/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,12 @@ impl FromTxWithEncoded<SeismicTxEnvelope> for SeismicTransaction<TxEnv> {
fn from_encoded_tx(tx: &SeismicTxEnvelope, sender: Address, _encoded: Bytes) -> Self {
let tx_env = SeismicTransaction::<TxEnv>::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,
}
}
}

Expand All @@ -591,7 +596,7 @@ impl FromRecoveredTx<SeismicTxEnvelope> for SeismicTransaction<TxEnv> {
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 }
}
}

Expand Down
58 changes: 58 additions & 0 deletions crates/seismic-evm/src/block/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 1 addition & 0 deletions crates/seismic-evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ where
},
tx_hash: Default::default(),
decryption_failed: false,
signed_read: false,
};

let mut gas_limit = tx.base.gas_limit;
Expand Down
Loading