Skip to content

api: contract getters on pruned nodes take the deploy the smart contracts keep - #74

Merged
EnzinoBB merged 3 commits into
masterfrom
fix/pruned-getters
Oct 22, 2026
Merged

EnzinoBB merged 3 commits into
masterfrom
fix/pruned-getters

Conversation

@EnzinoBB

Copy link
Copy Markdown
Collaborator

Problem

A pruned node answered every getter (TransactionFlow with forgetNewState) for a contract whose deploy block it had already pruned with status 0 "Success: " and no result. Found in robustness contracts-pruned-join and contracts-pruned-term-kill (n6, after pruning blocks before 1,700). This affects every Docker or pruned-package node, for every contract older than about one checkpoint.

Cause (Fable): smartTransactionFlow loads the deploy transaction from the block storage. On a pruned node it gets nothing, so executeByteCode with empty code runs nothing and the call is reported as a success. Yet the smart contracts already keep every deploy, in memory and in each checkpoint and snapshot (known_contracts, smartcontracts.dat), and SmartContractGet and SmartContractDataGet already use that copy.

Changes

  • Getter path: smartTransactionFlow now takes the deploy from SmartContracts::get_contract_deploy, with the block storage as fallback.
  • Explicit error: a getter with no byte code to run fails with "contract byte code is not available on this node".
  • Executor::executeByteCode: missing byte code, or no executor connection, is now an error instead of a success without a result, as executeByteCodeMultiple already reports.
  • SmartContractsListGet(deployer): a deploy no longer in the storage comes from the same in-memory copy.

Only API answers change. Consensus execution already uses the kept deploy: n6 executed contract calls as a trusted node after pruning, with matching states.

Contract-to-contract calls (APIEXECHandler::SmartContractGet, used while executing contracts) have the same storage lookup. They are left to a separate PR because that path is part of contract execution in consensus.

Validation

  • Build and unit tests.
  • Robustness contracts-pruned-join and contracts-pruned-term-kill on a branch where contracts.py reads from the pruned nodes too: n6 must answer the expected values.
  • Testnet with contracts=1.

🤖 Generated with Claude Code

…acts keep

A pruned node answered every getter (TransactionFlow with forgetNewState) for a contract whose
deploy block it had pruned with status 0 and no result: smartTransactionFlow loaded the deploy
transaction from the block storage, got none, ran nothing and reported success (robustness
contracts-pruned-join and contracts-pruned-term-kill). The smart contracts already keep each
deploy in memory and in every checkpoint and snapshot (known_contracts, smartcontracts.dat), and
SmartContractGet / SmartContractDataGet use it.

- smartTransactionFlow: the deploy from SmartContracts::get_contract_deploy, the storage as fallback
- a getter with no byte code to run fails ("contract byte code is not available on this node")
- Executor::executeByteCode: no byte code, or no executor connection, is an error, not a success
  without a result (as executeByteCodeMultiple already reports)
- SmartContractsListGet(deployer): a deploy no longer in the storage comes from the same copy

Only API answers change; consensus execution already uses the kept deploy. Contract-to-contract
calls (APIEXEC SmartContractGet) are left for a separate change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB added a commit that referenced this pull request Oct 22, 2026
#74)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
EnzinoBB and others added 2 commits October 23, 2026 00:16
…f an empty success

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@EnzinoBB
EnzinoBB merged commit 2ce5570 into master Oct 22, 2026
2 checks passed
EnzinoBB added a commit that referenced this pull request Oct 22, 2026
…ter #73

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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