Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
5b6c2d8
feat: support MorphTx v2 with EIP-7702 authorization lists
panos-xyz Sep 16, 2026
8f9f37c
chore(deps): bump rustls to 0.23.45 for RUSTSEC-2026-0285
panos-xyz Sep 16, 2026
da3d048
fix: address review feedback on MorphTx v2
panos-xyz Sep 16, 2026
f72e4cd
feat(rpc): derive the MorphTx version from the request content
panos-xyz Sep 18, 2026
9a86dde
refactor: rename the Onyx hardfork to Celadon
panos-xyz Sep 18, 2026
ac73c63
Merge remote-tracking branch 'origin/main' into feat/morphtx-v2-eip7702
panos-xyz Sep 20, 2026
c391f5c
fix(revm): carry the prepaid rounding credit into alt-token refunds
panos-xyz Sep 18, 2026
9778509
test(statetest): pin the Celadon alt-token refund against morph-geth
panos-xyz Sep 18, 2026
2524997
refactor(revm): clear the rounding credit with the other per-tx caches
panos-xyz Sep 18, 2026
2b26c0f
test(statetest): cover every net-fee remainder in the Celadon refund …
panos-xyz Sep 18, 2026
6acdca0
chore(deps): bump imbl to 7.0.2 for RUSTSEC-2026-0292
panos-xyz Sep 23, 2026
201249e
test: stop naming test-helper parameters `nonce`
panos-xyz Sep 23, 2026
40fd5bd
fix(txpool): keep token-fee MorphTx pending and revalidate fees per b…
panos-xyz Sep 23, 2026
aa465c7
test(txpool): run the fee-token tests in EVM-call mode
panos-xyz Sep 23, 2026
83f4b74
test(txpool): pin the mined-nonce skip and descendant parking
panos-xyz Sep 23, 2026
accd362
test(node): cover a token-fee sender that holds no ETH end to end
panos-xyz Sep 23, 2026
46711f1
fix(txpool): re-check removals at the canonical head before applying …
panos-xyz Sep 23, 2026
27bbdb6
fix(txpool): revalidate transactions parked behind a nonce gap
panos-xyz Sep 25, 2026
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
41 changes: 18 additions & 23 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions bin/morph-statetest/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ eyre.workspace = true
morph-chainspec.workspace = true
morph-evm.workspace = true
morph-revm.workspace = true
morph-primitives.workspace = true
revm = { workspace = true, features = ["tracer"] }
revm-statetest-types.workspace = true
serde.workspace = true
Expand Down
92 changes: 91 additions & 1 deletion bin/morph-statetest/src/schema.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use morph_chainspec::hardfork::MorphHardfork;
use morph_primitives::transaction::morph_transaction::MORPH_TX_VERSION_2;
use morph_revm::{MorphTxEnv, MorphTxExt};
use revm::{
context::{BlockEnv, CfgEnv, TransactionType, TxEnv},
Expand Down Expand Up @@ -282,6 +283,12 @@ impl MorphTransactionParts {
let mut tx = MorphTxEnv::new(inner);
if let Some(version) = self.version {
tx = tx.with_version(version);
} else if tx.is_morph_tx() && self.authorization_list.is_some() {
// Only V2 may carry an `authorizationList` field, so its presence
// (even `[]`) selects V2 instead of leaving the version unset, which
// the handler would treat as V0. Presence rather than length is the
// same convention `tx_type` uses to select 0x04.
tx = tx.with_version(MORPH_TX_VERSION_2);
}
if let Some(fee_token_id) = self.fee_token_id {
tx = tx.with_fee_token_id(fee_token_id);
Expand Down Expand Up @@ -358,7 +365,10 @@ pub fn parse_fork(name: &str) -> Result<MorphHardfork, SchemaError> {
"morph203" | "morph-203" => Ok(MorphHardfork::Morph203),
"viridian" | "prague" => Ok(MorphHardfork::Viridian),
"emerald" => Ok(MorphHardfork::Emerald),
"jade" | "osaka" => Ok(MorphHardfork::Jade),
"jade" => Ok(MorphHardfork::Jade),
// OSAKA is the spec level of the latest Morph fork, so the generic
// Ethereum name maps to it (matches `MorphHardfork::from(SpecId::OSAKA)`).
"celadon" | "osaka" => Ok(MorphHardfork::Celadon),
"cancun" => Ok(MorphHardfork::Morph203),
_ => Err(SchemaError::UnknownFork(name.to_string())),
}
Expand Down Expand Up @@ -487,6 +497,86 @@ mod tests {
);
}

#[test]
fn morph_tx_with_authorization_list_is_modelled_as_v2() {
let suite: MorphTestSuite = serde_json::from_str(
r#"{
"case": {
"env": {
"currentChainID": "0x1",
"currentCoinbase": "0x0000000000000000000000000000000000000000",
"currentDifficulty": "0x0",
"currentGasLimit": "0x989680",
"currentNumber": "0x1",
"currentTimestamp": "0x1",
"currentBaseFee": "0x1"
},
"pre": {},
"transaction": {
"type": "0x7f",
"nonce": "0x0",
"gasLimit": ["0x186a0"],
"to": "0x00000000000000000000000000000000000000f1",
"value": ["0x0"],
"data": ["0x"],
"accessLists": [null],
"maxFeePerGas": "0x10",
"maxPriorityFeePerGas": "0x1",
"feeTokenID": "0x1",
"feeLimit": "0x3e8",
"authorizationList": [{
"chainId": "0x1",
"address": "0x4242424242424242424242424242424242424242",
"nonce": "0x0",
"yParity": "0x0",
"r": "0x1",
"s": "0x2"
}],
"secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8"
},
"post": {
"Celadon": [{
"indexes": { "data": 0, "gas": 0, "value": 0 },
"hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"logs": "0x0000000000000000000000000000000000000000000000000000000000000000",
"expectException": null
}]
}
}
}"#,
)
.expect("suite should parse");

let unit = suite.0.values().next().unwrap();
let post = &unit.post["Celadon"][0];
let tx = unit
.morph_tx_env(post, MorphHardfork::Celadon)
.expect("tx env should build");

assert!(tx.is_morph_tx());
assert_eq!(tx.version, Some(MORPH_TX_VERSION_2));
assert_eq!(tx.fee_token_id, Some(1));
assert_eq!(tx.authorization_list.len(), 1);

// The fallback L1 fee bytes must be the V2 envelope (0x7f || 0x02 || rlp)
// and carry the authorization list: the delegate address appears verbatim.
let encoded = tx.rlp_bytes.expect("fallback L1 fee bytes");
assert_eq!(encoded[0], 0x7f);
assert_eq!(encoded[1], MORPH_TX_VERSION_2);
let delegate = [0x42u8; 20];
assert!(
encoded.windows(20).any(|window| window == delegate),
"L1 fee sizing bytes must include the authorization list"
);
}

#[test]
fn parse_fork_maps_celadon_and_osaka() {
assert_eq!(parse_fork("Celadon").unwrap(), MorphHardfork::Celadon);
assert_eq!(parse_fork("osaka").unwrap(), MorphHardfork::Celadon);
assert_eq!(parse_fork("jade").unwrap(), MorphHardfork::Jade);
}

#[test]
fn blob_tx_without_txbytes_errors_instead_of_silently_zeroing_l1_fee() {
let suite: MorphTestSuite = serde_json::from_str(
Expand Down
50 changes: 50 additions & 0 deletions bin/morph-statetest/tests/celadon_alt_token_refund.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
//! Golden roots from morph-geth 5a0d0d771 (go-ethereum#371), which reads them back
//! from this same fixture.
//!
//! The fee token is registered with `priceRatio = 3` against `scale = 1`, so
//! converting ETH to token units is inexact. Each fork runs three calldata
//! lengths against three consecutive gas limits:
//!
//! - one, two and three non-zero calldata bytes cost 21_016, 21_032 and 21_048
//! gas, which covers every remainder of the *net* fee modulo the price ratio;
//! - the gas limits 100_001..=100_003 cover every remainder of the *prepaid* fee.
//!
//! Tokens collected, per gas limit:
//!
//! | net gas | Emerald, Jade | Celadon | floor without the credit |
//! |---------|---------------------|---------------------|--------------------------|
//! | 21_016 | 7_005, 7_005, 7_006 | 7_006, 7_006, 7_006 | 7_006, 7_006, 7_006 |
//! | 21_032 | 7_011, 7_010, 7_011 | 7_011, 7_011, 7_011 | 7_011, 7_011, 7_012 |
//! | 21_048 | 7_016, 7_016, 7_016 | 7_016, 7_016, 7_016 | 7_017, 7_016, 7_017 |
//!
//! Celadon collects `ceil(net / 3)` on every gas limit, so it ends on one state
//! root per calldata length. Emerald and Jade round the prepaid fee and the refund
//! up independently and come out a token unit short on three of the nine, so the
//! first two rows end on two roots each.
//!
//! The last column is why one calldata length is not enough. With a net fee of
//! 21_016 the prepaid rounding credit never carries into the refund, so a client
//! that rounds the refund down but drops the credit still lands on every root of
//! that row. The other two rows are the ones that pin the credit itself.
//!
//! The gas figures also pin the transaction's gas: morph does not apply the
//! EIP-7623 calldata floor, which would bill 21_040 for the first row and miss
//! every root here.
use morph_statetest::runner::run_suite_str;

#[test]
fn celadon_alt_token_refund_matches_geth() {
let outcomes = run_suite_str(include_str!("fixtures/celadon_alt_token_refund.json")).unwrap();
assert_eq!(
outcomes.len(),
27,
"3 forks × 3 calldata lengths × 3 gas limits"
);
for outcome in outcomes {
assert!(
outcome.pass,
"{} / {}: {}",
outcome.test, outcome.fork, outcome.error_msg
);
}
}
Loading
Loading