-
Notifications
You must be signed in to change notification settings - Fork 1.9k
test: add test case for op tx env conversion #18581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1099,6 +1099,7 @@ mod transaction_response_tests { | |
use alloy_network::Ethereum; | ||
use alloy_primitives::{Address, Signature, B256, U256}; | ||
use alloy_rpc_types_eth::Transaction; | ||
use op_revm::transaction::OpTxTr; | ||
|
||
#[test] | ||
fn test_ethereum_transaction_conversion() { | ||
|
@@ -1155,4 +1156,23 @@ mod transaction_response_tests { | |
|
||
assert!(result.is_ok()); | ||
} | ||
|
||
#[cfg(feature = "op")] | ||
|
||
#[test] | ||
fn test_op_into_tx_env() { | ||
use op_alloy_rpc_types::OpTransactionRequest; | ||
use op_revm::OpSpecId; | ||
use revm_context::Transaction; | ||
|
||
let s = r#"{"from":"0x0000000000000000000000000000000000000000","to":"0x6d362b9c3ab68c0b7c79e8a714f1d7f3af63655f","input":"0x1626ba7ec8ee0d506e864589b799a645ddb88b08f5d39e8049f9f702b3b61fa15e55fc73000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000550000002d6db27c52e3c11c1cf24072004ac75cba49b25bf45f513902e469755e1f3bf2ca8324ad16930b0a965c012a24bb1101f876ebebac047bd3b6bf610205a27171eaaeffe4b5e5589936f4e542d637b627311b0000000000000000000000","data":"0x1626ba7ec8ee0d506e864589b799a645ddb88b08f5d39e8049f9f702b3b61fa15e55fc73000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000550000002d6db27c52e3c11c1cf24072004ac75cba49b25bf45f513902e469755e1f3bf2ca8324ad16930b0a965c012a24bb1101f876ebebac047bd3b6bf610205a27171eaaeffe4b5e5589936f4e542d637b627311b0000000000000000000000","chainId":"0x7a69"}"#; | ||
|
||
let req: OpTransactionRequest = serde_json::from_str(s).unwrap(); | ||
|
||
let cfg = CfgEnv::<OpSpecId>::default(); | ||
let block_env = BlockEnv::default(); | ||
let tx_env = req.try_into_tx_env(&cfg, &block_env).unwrap(); | ||
assert_eq!(tx_env.gas_limit(), block_env.gas_limit); | ||
assert_eq!(tx_env.gas_price(), 0); | ||
assert!(tx_env.enveloped_tx().unwrap().is_empty()); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.