TransactionForRpc improvements#11484
Conversation
|
Claude finished @svlachakis's task in 5m 26s —— View job PR Review
SummaryThe refactoring direction is sound. Folding FindingsMedium (1)
Low (3)
Correctness notes
|
|
@claude review again |
|
Claude finished @svlachakis's task in 6m 37s —— View job PR Review
SummaryAll findings from the previous review have been resolved. The PR is now clean. Previous findings — status
New observations (this pass)DI wiring for
No outstanding findings. The refactoring direction is correct, the tests cover the critical cases, and the |
|
Claude finished @svlachakis's task in 3m 18s —— View job PR Review
SummaryThird review pass — no new findings. All code paths are correct and the prior findings remain resolved. Review of all 18 changed files
long effectiveCap = gasCap is null or 0 ? long.MaxValue : gasCap.Value;
tx.GasLimit = Gas is null ? effectiveCap : long.Min(Gas.Value, effectiveCap);Verified against all 9 test cases in
long effectiveCap = gasCap is null or 0 ? long.MaxValue : gasCap.Value;
long? gasOrDefault = Gas ?? (effectiveCap == long.MaxValue ? null : effectiveCap);
tx.GasLimit = long.Min(gasOrDefault ?? throw new ArgumentNullException(nameof(Gas)), effectiveCap);Traced through all 7
if (jsonRpcConfig.GasCap is not null and not 0)
{
foreach (...) call.Gas ??= jsonRpcConfig.GasCap;
}Guard correctly handles null/zero-cap case. ✓
Test files
Previous findings — final status
No outstanding findings. The |
Fixes Closes Resolves #10547
Changes
Removes
TransactionForRpc.EnsureDefaultsentirely and folds defaulting + gas-cap enforcement intoToTransaction(gasCap). The "two methods, easy to forget one" pattern that produced the original bugs is structurally gone.What changed
TransactionForRpc.EnsureDefaults(abstract) and its overrides inLegacyTransactionForRpcand Optimism'sDepositTransactionForRpcare deleted.ToTransaction(validateUserInput, gasCap, spec)is now the single conversion entry point. It always setsSenderAddress(defaults toAddress.Zero) andGasLimit(defaults togasCap, orlong.MaxValueif unset; capped atgasCapwhen provided).Gas ?? 90_000magic inLegacyTransactionForRpc.ToTransactionis removed.IDebugBridge.GetBundleTracestakeslong? gasCap; the bridge converts internally.DebugRpcModule.PrepareTransactionsis removed.Bugs closed
proof_callhad no gas-cap enforcement — a caller sendinggas: 0got the full block gas limit, ignoringGasCap. Now properly capped via injectedIJsonRpcConfig.SimulateTxExecutor.Prepareskipped defaulting —gas: nullfell back to a hardcoded 90,000 instead ofgasCap. Now consistent with all other paths.IDebugBridge.GetBundleTracesrelied on the caller to pre-prepare transactions — now self-contained.Behavior change worth flagging
gas: 0is now treated as a literal request (intrinsic-gas error), not as a "missing" signal that defaults togasCap. This matches Geth and is required by themulticall-insufficient-gas-38013Hive spec test.gas: nullis the only "missing" signal.debug_traceCallManyandeth_simulateV1need different default-gas policies forgas: null(gasCap vs. block gas limit). This is now expressed by a localizedcall.Gas ??= jsonRpcConfig.GasCapinDebugRpcModule.TraceCallManyWithOverrides, with a comment explaining whyeth_simulateV1deliberately omits it.Types of changes
What types of changes does your code introduce?
Testing
Hive tests Job: https://github.com/NethermindEth/nethermind/actions/runs/25330905724
Requires testing
If yes, did you write tests?