Feat-11 : Add limit param to stop opcode trace capture after N steps#10173
Feat-11 : Add limit param to stop opcode trace capture after N steps#10173sagarkhandagre998 wants to merge 6 commits intobesu-eth:mainfrom
limit param to stop opcode trace capture after N steps#10173Conversation
Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
…emainingPostExecution Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
…ostExecution backfill Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
|
@macfarla Kindly take a look at once. |
|
This PR doesn't seem to handle negative limit values if someone passes limit = -1, then stepCount >= limit would be true from step 0 , so no frames would be captured. Better to reject negative values . Also, limit = 0 is treated as "unlimited" based on the options.limit() > 0 check, but there's no test confirming that behavior. Should add one. |
@parthdagia05 Good Catch! will fix. |
Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
cc4484d to
493cddd
Compare
Verifies that limit(0) captures all EVM steps without capping, per the spec contract that 0 means unlimited. Without this test a regression flipping the guard from to would pass all other limit tests undetected. Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
83f9f4d to
e8a899b
Compare
Signed-off-by: Sagar Khandagre <sagar.khandagre998@gmail.com>
PR description
Add
limitparam to stop opcode trace capture after N stepsPart of aligning Besu's debug RPC endpoints with the execution-apis spec.
What changed:
OpCodeTracerConfigBuilder— newlimit(int)config option (0= unlimited, default)TransactionTraceParams— new optionallimitJSON param wired intotraceOptions()DebugOperationTracer— dedicatedstepCountfield drives the limit check; backfill ofgasRemainingPostExecutionon the last captured frame is preserved even after the limit is hitDebugOperationTracerTest— two new unit tests covering frame count cap and backfill correctnessBehaviour:
limitis absent or0— no change to existing behaviourlimit=N— exactly NStructLogentries are recorded; EVM execution continues to completion per specTwo bugs fixed over the naive implementation:
traceFrames.size()as step counter — replaced with a dedicatedstepCountfield that is explicit and reset correctly per transactiongasRemainingPostExecutionbackfilled — moved the early-return guard intracePostExecutionto after the backfill block so it always runsFixed Issue(s)
Fixes #10115
Thanks for sending a pull request! Have you done the following?
doc-change-requiredlabel to this PR if updates are required.Locally, you can run these tests to catch failures early:
./gradlew spotlessApply./gradlew build./gradlew acceptanceTest./gradlew integrationTest./gradlew ethereum:referenceTests:referenceTests