Skip to content

Commit 16b4e07

Browse files
authored
EVM: Add machinery and fixes for hive and rpc-compat suite (#2506)
* Start working on hive and rpc-compat * Improving * Keep working on rpc-compat * More work on rpc-compat * More fixes and adressing feedback * Cleaning up * Cleaning up * Finalizing the first stage hive tests * Disable pruner for hive * More clean up * Fixes after merging dev * Fixes after merging dev * More fixes in tests * Fix formatting * Update prover cargo locks * Clean up after manual review * Rollback EIP-7702 * Cleaning up genesis_adapter * Add missing files * Refactoring genesis import * Fix lint * Revert conversions * Revert TODO * Genesis skip serialize if * Revert apply margin move * Address parse filter feedback * Bring back `"eth_syncing` that fall through the cracks * Fix error in FilterWithCursor * Clean up hive adapter * Clean up tests * lint fix * Removing debug methods that contain bugs * More cleanup in hive * More cleanups * Claude simplifications * Codex simplifcations * More fixes after refactoring
1 parent d22e4ba commit 16b4e07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+2510
-273
lines changed

.dockerignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
target
2+
.github
3+
.idea
4+
.vscode
5+
6+
# Guest artifacts are enormous and not needed when SKIP_GUEST_BUILD=1.
7+
examples/demo-rollup/provers/sp1/guest-mock
8+
examples/demo-rollup/provers/sp1/guest-celestia

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
# 2026-02-23
1111
- #2520 reverts #2489
12+
- #2506 EVM: Fixes RPC endpoints and adds base for hive and rpc compat tests
1213
- #2532 EVM: Minor fixes in RPC endpoints
1314

1415
# 2026-02-17

Cargo.lock

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/full-node/sov-ethereum/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ sov-rest-utils = { workspace = true }
2828

2929
borsh = { workspace = true }
3030
serde = { workspace = true }
31+
serde_json = { workspace = true }
3132

3233
alloy-consensus = { workspace = true }
3334
alloy-primitives = { workspace = true }

crates/full-node/sov-ethereum/src/handlers/get_logs.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::rpc_invalid_params;
12
use crate::rpc_limit_exceeded;
23
use crate::Ethereum;
34
use crate::EthereumAddress;
@@ -35,9 +36,15 @@ where
3536
ethereum: Arc<Ethereum<S, Seq>>,
3637
_: Extensions,
3738
) -> Result<Vec<LogWithExecutionTimestamp>, ErrorObjectOwned> {
39+
// Force malformed filter payloads to return JSON-RPC -32602 (invalid params)
40+
// instead of bubbling up as internal deserialization errors.
41+
let filter = parameters
42+
.one::<Filter>()
43+
.map_err(|err| rpc_invalid_params(err.to_string()))?;
44+
3845
let state = ethereum.api_state_accessor();
3946
let service = LogsService::<S, Seq>::new(
40-
parameters.one::<Filter>()?,
47+
filter,
4148
None,
4249
ethereum.extension.max_log_limit,
4350
state,
@@ -60,7 +67,11 @@ where
6067
_: Extensions,
6168
) -> Result<LogsWithMaybeCursor, ErrorObjectOwned> {
6269
let state = ethereum.api_state_accessor();
63-
let FilterWithCursor { cursor, filter } = parameters.one::<FilterWithCursor>()?;
70+
// Keep deserialization failures aligned with eth_getLogs: malformed payloads
71+
// should surface as JSON-RPC -32602 invalid params.
72+
let FilterWithCursor { cursor, filter } = parameters
73+
.one::<FilterWithCursor>()
74+
.map_err(|err| rpc_invalid_params(err.to_string()))?;
6475
let cursor = cursor.map(|s| Cursor::unpack(&s)).transpose()?;
6576
let service = LogsService::<S, Seq>::new(
6677
filter,

crates/full-node/sov-ethereum/src/handlers/get_logs/service.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ where
148148
) -> Result<LogsWithMaybeCursor> {
149149
let start = self.get_block_nr(from_block)?;
150150
let end = self.get_block_nr(to_block)?;
151+
if start > end {
152+
return Err(Error::InvalidBlock(
153+
"invalid block range params".to_string(),
154+
));
155+
}
156+
// Match expected eth_getLogs semantics: explicit numeric ranges that extend past
157+
// the current head should fail with invalid params instead of surfacing internal
158+
// "block not found/pruned" errors.
159+
let latest = self.get_block_nr(Some(BlockNumberOrTag::Latest))?;
160+
if end > latest {
161+
return Err(Error::InvalidBlock(
162+
"invalid block range params".to_string(),
163+
));
164+
}
151165
let maybe_cursor = self.scan_block_range(start..=end)?;
152166
Ok(LogsWithMaybeCursor::new(
153167
self.logs,

crates/full-node/sov-ethereum/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ where
7575
"eth_protocolVersion",
7676
"eth_coinbase",
7777
"eth_mining",
78+
"eth_syncing",
7879
"eth_hashrate",
79-
"eth_getTransactionByBlockHashAndIndex",
80-
"eth_getTransactionByBlockNumberAndIndex",
8180
"eth_getUncleCountByBlockHash",
8281
"eth_getUncleCountByBlockNumber",
8382
"eth_getUncleByBlockHashAndIndex",
@@ -95,8 +94,10 @@ where
9594
"eth_signTypedData_v3",
9695
"eth_signTypedData_v4",
9796
"eth_getProof",
98-
"eth_createAccessList",
99-
"eth_syncing",
97+
"debug_getRawBlock",
98+
"debug_getRawHeader",
99+
"debug_getRawReceipts",
100+
"debug_getRawTransaction",
100101
"net_peerCount",
101102
"trace_block",
102103
"trace_call",

crates/module-system/module-implementations/sov-evm/AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ For the same tx/block, values must agree across:
7777
- Do not introduce non-deterministic state access in module/core logic.
7878
- Avoid hidden behavior drift between native and proof-relevant paths.
7979

80+
### 6. Supported transaction types (Hard Constraint)
81+
82+
- `sov-evm` must accept only `EIP-1559` transaction envelope.
83+
- `Legacy`, `EIP-2930`, `EIP-7702` and `EIP-4844` transactions must be rejected at authentication and execution ingress.
84+
- Do not relax this policy without explicit product approval and matching tests for the new support matrix.
85+
8086
## Failure Pattern Matrix (PR Lessons)
8187

8288
| Pattern | Repeated in PR(s) | Typical root cause | What to verify before merge |

crates/module-system/module-implementations/sov-evm/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ alloy-consensus = { workspace = true, features = [
5555
"serde",
5656
"serde-bincode-compat",
5757
] }
58+
alloy-rlp = { workspace = true }
5859

5960
alloy-rpc-types = { workspace = true, optional = true }
6061
alloy-rpc-types-trace = { workspace = true, optional = true }
@@ -83,7 +84,6 @@ alloy-primitives = { workspace = true, features = ["getrandom"] }
8384
alloy-consensus = { workspace = true, features = ["secp256k1"] }
8485
alloy-signer = { workspace = true }
8586
alloy-signer-local = { workspace = true }
86-
alloy-rlp = { workspace = true }
8787
sov-evm = { path = ".", features = ["native"] }
8888
strum = { workspace = true }
8989
tokio = { workspace = true, features = ["macros", "rt", "rt-multi-thread"] }

crates/module-system/module-implementations/sov-evm/src/config.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ mod tests {
289289
address,
290290
code_hash: AccountData::empty_code(),
291291
code: Bytes::default(),
292+
nonce: 0,
293+
storage: Default::default(),
292294
}],
293295
chain_spec: EvmChainSpec {
294296
limit_contract_code_size: None,

0 commit comments

Comments
 (0)