Commit 0f70752
feat: Support eth_fillTransaction (#12204)
* feat: Support eth_fillTransaction
* fix(rpc): address eth_fillTransaction review feedback
- Require an explicit `from`; reject the silent zero-address default.
- Reject a `chainId` that doesn't match the node (geth parity).
- Derive blob fields before gas estimation so blob txs estimate correctly.
- Default maxFeePerBlobGas to 2x the blob base fee and fail when it can't be
computed, instead of emitting "0x0" (below the EIP-4844 minimum of 1).
- Add regression tests for the from and chainId guards.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* refactor(rpc): fill eth_fillTransaction fields via polymorphism
Replace the per-type if/switch cascade in eth_fillTransaction with virtual
FillFeeDefaults / PrepareForGasEstimation methods on the TransactionForRpc
hierarchy, driven by a small TxFillContext of node-computed defaults. Each tx
type now populates the fee model it uses without the RPC layer branching on the
concrete type.
Also harden the blob path (moved into BlobTransactionForRpc): bound the blob
count before the KZG work and validate caller-supplied blobVersionedHashes
against the derived commitments instead of silently overwriting them.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore(rpc): drop redundant JsonPropertyName on FillTransactionResult
The camelCase naming policy already serializes Tx as "tx".
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* test(rpc): consolidate eth_fillTransaction tests and cover blob validation
Fold the success and error cases into TestCaseSource-driven tests, and add
coverage for the blob-count bound and the blob-hash mismatch rejection.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* chore: remove comment
* refactor(rpc): unify eth_fillTransaction fill hooks into one Result-based method
Merge PrepareForGasEstimation and FillFeeDefaults into a single
FillDefaults(in TxFillContext) returning Result, called before gas estimation
to mirror geth's setDefaults order; estimation now runs with the effective
fees, failing like geth when the sender cannot cover them. Split the
unsupported-type and missing-from guards into distinct errors, and trim
comments to the non-obvious invariants.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* feat(rpc): type eth_fillTransaction input as LegacyTransactionForRpc
Add LegacyTransactionJsonConverter, a second polymorphic converter rooted at
LegacyTransactionForRpc (the base of every user-signable tx type), so RPC
methods taking transactions as input can declare that type and reject
output-only types such as Optimism deposit transactions at deserialization.
The base dispatch strips the converter (cached options copy) when
deserializing the exact LegacyTransactionForRpc concrete type to avoid
recursion, and registration happens via ModuleInitializer so the converter is
present in every host before the first parameter bind. This removes the
runtime type guard from eth_fillTransaction.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(rpc): satisfy analyzers in LegacyTransactionJsonConverter
Use a collection expression for the options cache (IDE0028) and suppress
CA2255 with justification: registration must precede the first bind of a
LegacyTransactionForRpc-declared member in any host, which a static
constructor cannot guarantee.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* refactor(rpc): root signable-tx converter at an abstract type
Replace the concrete-rooted, globally-registered LegacyTransactionJsonConverter
with SignableTransactionForRpc, an abstract intermediate base between
TransactionForRpc and LegacyTransactionForRpc that carries the polymorphic
converter as a [JsonConverter] attribute. Because the root is abstract it is
never a concrete leaf, so the converter no longer self-collides and needs no
WithoutSelf; attributing it drops the global options mutation and the
ModuleInitializer. Output-only types (e.g. Optimism deposits) derive from
TransactionForRpc directly, so declaring an input parameter as
SignableTransactionForRpc excludes them via the type system.
Applied to the transaction-input eth_* methods (fillTransaction,
sendTransaction, signTransaction, call, estimateGas, createAccessList).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Lukasz Rozmej <lukasz.rozmej@gmail.com>1 parent 96ed40d commit 0f70752
15 files changed
Lines changed: 477 additions & 17 deletions
File tree
- src/Nethermind
- Nethermind.Facade/Eth/RpcTransaction
- Nethermind.JsonRpc.Test
- Modules
- Eth
- RpcTransaction
- Nethermind.JsonRpc
- Data
- Modules/Eth
- Nethermind.Optimism.Test/Rpc
- Nethermind.Optimism/Rpc
Lines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
93 | 136 | | |
94 | 137 | | |
95 | 138 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
Lines changed: 45 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 | | |
124 | 131 | | |
125 | 132 | | |
| |||
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
238 | | - | |
| 238 | + | |
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| |||
244 | 244 | | |
245 | 245 | | |
246 | 246 | | |
247 | | - | |
| 247 | + | |
248 | 248 | | |
249 | 249 | | |
250 | 250 | | |
| |||
433 | 433 | | |
434 | 434 | | |
435 | 435 | | |
436 | | - | |
| 436 | + | |
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
448 | | - | |
| 448 | + | |
449 | 449 | | |
450 | 450 | | |
451 | 451 | | |
| |||
0 commit comments