feat(vm): add node-level vm.constantCallTimeoutMs for constant calls#6719
Open
yanghang8612 wants to merge 2 commits intodevelopfrom
Open
feat(vm): add node-level vm.constantCallTimeoutMs for constant calls#6719yanghang8612 wants to merge 2 commits intodevelopfrom
yanghang8612 wants to merge 2 commits intodevelopfrom
Conversation
c414f1e to
d8252da
Compare
Operators may set any positive integer to extend the per-call deadline for the constant-call APIs (triggerconstantcontract, triggersmartcontract dispatched to view/pure functions, estimateenergy, eth_call, eth_estimateGas, and others). The configured value is used verbatim. Replaces unsafe use of --debug, which also extends block-processing.
Collaborator
Author
|
Revised the implementation per the review thread on #6681 and force-pushed Major changes vs. the original four commits:
Net diff shrinks from 597+/9- across 11 files to ~107+/4- across 6 files. |
5510359 to
8b7901f
Compare
aiden3885
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a node-level config
vm.constantCallTimeoutMs(any positive integer; omit the property entirely to keep current behaviour) that extends the TVM execution-time window for the read-only RPC paths only —triggerconstantcontract,triggersmartcontractdispatched to view/pure functions,estimateenergy,eth_call,eth_estimateGas, and any other RPC routed throughWallet.callConstantContract. The block-processing deadline is unchanged.When set, the configured value is used verbatim as the per-call deadline (no clamp against the network's
maxCpuTimeOfOneTx, nocpuLimitInUsRatioscaling). When unset, constant calls fall back to the existing path that uses the network'smaxCpuTimeOfOneTx.Closes #6681.
Why are these changes required?
triggerconstantcontract/eth_calland the other constant-call RPCs are widely used for state queries and dry-runs but cap out at the same TVM deadline as block-processing (mainnet 80 ms). Operators currently have only--debugto extend this window, which also removes the block-processing timeout — unsafe for any node serving traffic, since it can desync from the network (#6266). This PR gives operators a scoped lever for the constant-call window without that side effect.Design
isConstantCallinVMActuator.create()/call(), so it is unreachable from block validation — guaranteed by structure, not by convention.max(configured, networkMs)clamp, nocpuLimitInUsRatioscaling. Operators get exactly the budget they configured.Config#hasPath.vm.constantCallTimeoutMsis intentionally absent fromreference.conf, and theVmConfigfield is excluded fromConfigBeanFactoryauto-binding (@Setter(AccessLevel.NONE)) so the strict schema check doesn't require the path.vmSection.hasPath(...)then becomes a precise signal of "operator wrote this inconfig.conf". Same pattern asBlockConfigrejecting the legacycommittee.proposalExpireTimelocation.> 0; explicit0and negative values are rejected at config-load withIllegalArgumentException. Nodes that don't configure the property keep the existing default behaviour — no validation, no behaviour change.Programplumbing (getVmShouldEndInUs()propagated to internalProgramInvokeinstances), so the override applies to deep call trees — the headline use case.This PR has been tested by:
VmConfigTest(4 new cases): default0Lwhen absent; any positive value accepted (1,50,500,5000); explicit= 0rejected; negative values rejected.VMActuatorandWalletcallers' tests remain green.Migration from
--debugOperators currently running with
--debugpurely to extend the constant-call window should switch tovm.constantCallTimeoutMs=<ms>once this lands.--debugadditionally extends the block-processing timeout, which is unsafe for any node serving traffic (see #6266). Release notes will spell this out at both touchpoints.