refactor(rpc/v10): rework AddTransaction, decouple EstimateMessageFee, tighten validation#3582
Conversation
… pointers in ResourceBoundsMap
… required fields and remove JSON unmarshal method
…ssary nil checks and simplifying resource bounds handling
… handling with generics
…mize AddTransaction flow In our old code, we were unnecessarily compiling the casm class in the ' h.receivedTransactionFeed != nil' condition
…create a new payload type for it
2827ddb to
f00cd36
Compare
…dcastedTransactionToCore and CompileBroadcastedDeclareTxn
f00cd36 to
9920346
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3582 +/- ##
==========================================
- Coverage 75.01% 74.92% -0.09%
==========================================
Files 433 433
Lines 38606 38815 +209
==========================================
+ Hits 28960 29082 +122
- Misses 7643 7728 +85
- Partials 2003 2005 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…he EstimateMessageFee method
…n DeployAccount transaction handling
9217d61 to
214dfec
Compare
0a54650 to
c75c681
Compare
|
Claude finished @thiagodeev's task in 5m 15s —— View job Claude Code ReviewI reviewed the v10
SummaryThe refactor is well-structured and the performance wins are real. I found one blocker (a typed-nil interface bug that panics the builder), plus a few minor notes. 🔴 Blocker
🟡 Minor / nits
✅ Looks good
|
…mpileBroadcastedTxToCore to avoid nil interface bugs
…l on estimateMessageFee
|
Claude finished @thiagodeev's task in 4m 54s —— View job Claude Code ReviewRe-reviewed after the latest pushes (typed-nil fix,
SummaryThe earlier blocker is fixed ✅ and I found no new blockers. Remaining items are minor/nits. ✅ Blocker resolved — typed-nil
|
|
Claude finished @thiagodeev's task in 1m 38s —— View job Claude Code ReviewRe-reviewed after the latest push (
SummaryNo new blockers. The new commit is a clean, behavior-preserving refactor and the previously-fixed typed-nil ✅ New change is correct —
|
|
@claude you're wrong. The gateway branch only calls |
|
Claude finished @thiagodeev's task in 37s —— View job Re: gateway branch compile pathYou're right, and my earlier wording was wrong. I went back and read the code:
So there is no double / re-compilation in the gateway path. My "re-runs … recompiling" phrasing implied redundant duplicate work, which is incorrect — it's a single compile, and nothing before it compiles. I withdraw that nit. Apologies for the confusion. The only substantive (and much weaker) point that remains is that this single compile sits on the submit call's latency for |
|
Claude finished @thiagodeev's task in 3m 2s —— View job Claude Code ReviewRe-reviewed the latest pushes on top of the
SummaryNo blockers. The three follow-up commits since the last review are clean and each addresses a reviewer comment correctly:
The previously-flagged typed-nil 🟡 Nit (non-blocking)
Nothing else changed materially. The refactor still reads cleanly and the perf wins are well-supported — LGTM. |
TODO: apply the changes for other rpc pkgs as well
Validation
validator.WithRequiredStructEnabled. Lets us drop pointer indirection onResourceBoundsMap/ResourceBounds(value types now) and rely onvalidatetags directly on the fields.EstimateMessageFeedecoupled fromEstimateFeeBroadcastedTransactionso it could reuse theEstimateFeeplumbing. That workaround is gone —EstimateMessageFeenow has its own direct path with noBroadcastedTransactionround-trip.AddTransactionrefactorAdaptBroadcastedTransactioninto smaller, single-purpose functions.ContractClasstype for thecontract_classfield instead ofjson.RawMessage. Two wins:BroadcastedTransaction → core.Transaction, removing the intermediate hop throughstarknet.Transaction.Bug fix (v9; v10 unaffected)
DECLAREtransactions,pushToFeederGatewaywas mutating the originaltx.ContractClass. By the time the tx reachedreceivedTransactionFeed, the mutated state caused the send to fail and the tx was never published.Benchmark result:
Config: count=5, benchtime=3s, Intel i5-11400H @ 2.70GHz, Go 1.26.
ContractClassToGatewayPayload(pooledgzip.Writer,gzip.BestSpeed, streamed json -> gzip -> base64 pipeline).ContractClasswork involved.Declare_RealCompiler_Gatewaygain is modest because FFI Sierra->CASM compile dominates wall-clock time.