Skip to content

ci: token smart contract tests (executor harness and private testnet) - #127

Merged
EnzinoBB merged 3 commits into
masterfrom
test/token-contracts
Oct 30, 2026
Merged

EnzinoBB merged 3 commits into
masterfrom
test/token-contracts

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Summary

Tests for token smart contracts, without changes to the node.

ci/contracts/executor_harness.py + token_scenarios.py drive one or more contract-executor jars directly through their Thrift interface, with a stub of the node's APIEXEC service (fixed seed, balances, block time), the way the node drives them: deploys (executeByteCode with an empty state), calls (kept only when they succeed), getters (executeByteCodeMultiple), getContractMethods. Each step records status, return value, a hash of every returned state and the emitted transactions; with two jars any step that differs from the first jar (the release executor 1518) fails the run. Scenarios:

  • token standards reported by getContractMethods (v0/v1/v2);
  • a v1 token (TokenV1.java, ExtensionTokenStandard, BigDecimal) and a v0 token (TokenV0.java) through transfer, approve/transferFrom, failing calls, freeze, burn, register, balanceOf for 54 holders, payable as the node sends it, a sale with emitted CS;
  • a call that changes the state and then throws, a getter that writes, the reserved "CS" name for each standard, platform calls (seed, block time, balance, initiator), CS amounts emitted through a double, a contract-to-contract call (fails on 1518), contract code that never returns outside a method (name check, serialization).

ci/testnet/tokens.py (run.sh with CONTRACTS=1 TOKENS=1): from the wallet of the last node, once fund.py's load is over, deploys both tokens on the private network and runs the same operations through n1 (or TOKENS_VIA=N, e.g. the node of the restart test once it restarted). Checks the balances read on every node, the same state on every node, the CS of the sale, and the token API ([api] tokens_cache=true is written to the config; API mismatches are reported, TOKENS_STRICT_API=1 fails on them).

Test plan

  • Harness on the release executor (findings recorded) and on a rebuilt executor: identical answers on every step
  • NODES=5 CONTRACTS=1 TOKENS=1: 0 failures on master (the token API reports "doesn't provide such info", reported as a finding)
  • RESTART_NODES=5 RESTART_AT=100 TOKENS_VIA=5: reproduces the quick-start bug fixed by api: contract results after a quick start at the last stored block #126 on master
  • CI (the new scripts run only on request)

🤖 Generated with Claude Code

ci/contracts/executor_harness.py drives contract executors directly through their Thrift
interface, with a stub of the node's APIEXEC service, the way the node does: deploys, calls,
getters, getContractMethods. token_scenarios.py runs token contracts of every API generation
(v0/v1/v2 standards, payable, emitted transactions, failing calls, contract-to-contract calls,
contract code that never returns) and records each executor's answers. With two jars, any
answer that differs from the first jar's (the release executor) fails the run.

ci/testnet/tokens.py (run.sh TOKENS=1, with CONTRACTS=1) deploys a v1 and a v0 token on the
private network, runs transfers, approvals, payable and a sale through n1 (or TOKENS_VIA, e.g.
the node of the restart test), and checks the balances on every node, the states, and the
token API ([api] tokens_cache=true).
@EnzinoBB
EnzinoBB merged commit 0c8dbbc into master Oct 30, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant