Repository navigation
perf(vm): improve parallel precompile timeout handling - #7026
yanghang8612 merged 2 commits into
Conversation
sunny-tron
left a comment
There was a problem hiding this comment.
A couple of notes after reading through the timeout paths:
-
awaitParallel(viagetCPUTimeLeftInNanoSecond()),readFutureandallowTimedOutResulteach readgetVmShouldEndInUs()separately. The equivalence withProgram#checkCPUTimeLimitrelies on all three using the same deadline as the calling program, so reading it once (for example at the start ofcollectParallel) and passing the value down would make that explicit and keep the three checks consistent. -
The new tests exercise the helpers with hand-set deadlines. Since the change is meant to leave transaction results unchanged, a test at the
Program/VMActuatorlevel showing that a timed-outBatchValidateSign/VerifyTransferProofcall still ends asOUT_OF_TIMEwith the same energy usage under energy adjustment would cover the part that matters most for compatibility.
|
Thanks @sunny-tron. Both points are addressed in 9be9f29:
The tests control task completion through a scoped Validation: all 45 targeted tests passed with test retries disabled, and Checkstyle passed. An additional temporary 300ms scheduling-pause probe passed all 8 normal-completion cases; the probe was removed before committing. |
Collect parallel precompile results against the remaining VM deadline and cancel unfinished tasks on timeout, interruption, and failed submission. Preserve the existing timeout policies for BatchValidateSign and VerifyTransferProof, including debug, solidity, and pre-energy-adjustment execution. Add regression coverage for delayed result publication, interruption, worker failure, and cancellation.
03f1349 to
879b50d
Compare
Capture the invocation deadline once for the latch wait and result reads, and cover terminal precompile calls through the VM, actuator, and runtime across CPU enforcement modes.
879b50d to
a6c9698
Compare
b241f33
into
tronprotocol:release_v4.8.3
What does this PR do?
This PR is a first-step optimization toward #6697, focused on parallel execution in
BatchValidateSignandVerifyTransferProof.Share deadline-aware waiting and result collection, and cancel unfinished tasks on timeout, interruption, worker failure, or partial submission failure. Result reads are bounded when the VM's transaction-end CPU check applies.
Why are these changes required?
VerifyTransferProofpreviously used unboundedFuture.get()calls after its timed latch wait. Even when the latch reaches zero, a worker may not have published its result yet. Unsuccessful exits could also leave submitted tasks running or queued.This PR has been tested by:
Validated on JDK 17 / macOS ARM64 after rebasing:
./gradlew clean build -x testpassed.git diff --checkpassed.RelayServiceTestcases.The local full-suite run encountered two DNS environment failures in p2p tests: the system resolves reserved
.invalidnames to198.18.*addresses. Those tests are unchanged by this PR; the CI matrix provides verification on its normal resolver.Follow up
The broader work in #6697 remains open, including common precompile entry/exit checks, consistent timeout propagation, and internal checkpoints. Full-VM differential tests comparing receipts, energy accounting, state, and logs, along with replay compatibility and activation assessment, are also follow-up work.
Extra details
The branch is rebased onto
release_v4.8.3through409a33f21e, including the upstream HELLO test fixture fix from #7060.Preserves historical timeout behavior for debug, solidity, and pre-energy-adjustment execution. Precompile addresses, ABI, and energy pricing are unchanged. Cancellation of running work remains best effort.