feat(vm): add node-level vm.constantCallTimeoutMs for constant calls#6719
Merged
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 stays small and now includes focused deadline-policy coverage plus overflow validation. |
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 that fits VM deadline conversion; 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.> 0and fit VM deadline conversion (<= Long.MAX_VALUE / 1000ms); explicit0, negative, and overflowing 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: default0Lwhen absent; positive values accepted (1,50,500,5000); explicit= 0, negative values, and overflowing values rejected.VMActuatorTest: configured constant-call timeout is used verbatim; unset constant calls fall back to the network-derived deadline; non-constant/block-processing paths ignore the override.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). The config reference includes this migration note; release notes should carry the same pointer.