Repository navigation
api: refuse a contract call whose method the executor cannot find - #132
Merged
Merged
Conversation
The executor picks the method of a call with commons-beanutils' getMatchingAccessibleMethod: same name, same number of arguments, each argument's class (from its Variant) assignable to the declared type. A call that matches no method fails on every node, and the caller pays the fee all the same: a v1 token's transfer(String, BigDecimal) called with the amount as a v_string, a v0 token's transfer(String, String) with a v_big_decimal, a misspelt method. TransactionFlow now checks the method and its arguments against the contract's methods (getContractMethods, asked once per contract) before the call reaches the network, and refuses it with the expected signature and the Variant to use. Only certain mismatches are refused: arguments and declared types outside String, BigDecimal, boolean, int, long, double (and their wrappers) and byte[] are taken as possible matches, as are Object's methods; with no answer from the executor nothing is checked. API only: what reaches the network does not change. CI: tokens.py checks that both wrong-type transfers are refused and that the sender's inner id did not move; testnet.yml gets the tokens and tokens_via inputs (strict token API checks); the executor harness compares only the answers (not the scenarios' expectations, nor the token standard, which only the API reads), so that a fixed executor passes against 1518.
This was referenced Oct 30, 2026
3 of 4 tasks
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.
Summary
The executor picks the method of a call with commons-beanutils'
getMatchingAccessibleMethod(same name, same argument count, each argument's class from its Variant assignable to the declared type). A call that matches no method fails on every node and the caller pays the fee anyway. Typical cases: a v1 token'stransfer(String, BigDecimal)called with the amount asv_string, a v0 token'stransfer(String, String)called with av_big_decimal, a misspelt method.TransactionFlownow checks method and arguments against the contract's methods (getContractMethods, asked once per contract, cached) and refuses such a call before it reaches the network, naming the expected signature and the Variant to use, e.g.transfer(java.lang.String, java.math.BigDecimal): argument 2 is java.math.BigDecimal (v_big_decimal), the call passes v_string. The idea is the same aseth_estimateGasrefusing a call that would revert.Conservative: only certain mismatches are refused. Arguments and declared types outside
String,BigDecimal,boolean,int,long,double(+ wrappers) andbyte[]count as possible matches, overloads are considered, Object's methods pass, and without an answer from the executor nothing is checked. API only: nothing that reaches the network changes.CI:
ci/testnet/tokens.py: both wrong-type transfers must be refused by the API with the sender's inner id unchanged (nothing sent);testnet.yml: inputstokensandtokens_via(token checks with strict API checks);ci/contracts/executor_harness.py: compares the executors' answers only, not the scenarios' expectations nor the API-only token standard, so that the executor's CI can run it against 1518 (EnzinoBB/contract-executor).Test plan
nodetests --gtest_filter=CallCheck*: matching calls, wrong amount types (v1 and v0), unknown method, wrong count, Object's methods, uncertain types, overloadsCONTRACTS=1 TOKENS=1 TOKENS_VIA=5 TOKENS_STRICT_API=1with the restart of n5: 0 failures, 0 findings; both wrong-type transfers refused, inner id unchanged; every consensus and token API check passes🤖 Generated with Claude Code