Skip to content

fix: node should always cache contract WASM on GET, regardless of return_contract_code #3757

@sanity

Description

@sanity

Problem

When a client sends a GET with return_contract_code: false, the node does not cache the contract WASM locally. This means:

  • SUBSCRIBE fails with "contract WASM/parameters not cached locally"
  • The node cannot validate incoming updates for the contract
  • The node cannot host the contract for other peers

Expected Behavior

return_contract_code should only control whether the WASM bytes are included in the response to the client (bandwidth optimization). The node should always fetch and cache the WASM internally so it can:

  • Accept and process SUBSCRIBE requests
  • Validate contract state updates
  • Host the contract state for the network

Current Workaround

Delta sets return_contract_code: true on all GET requests, but this wastes bandwidth sending the WASM to the client (which already has it embedded).

Context

Found while debugging Delta subscription failures. The node log showed:

Cannot cache or subscribe to contract - no contract code in GET response
Rejecting SUBSCRIBE: contract WASM not cached locally

[AI-assisted - Claude]

Metadata

Metadata

Assignees

Labels

A-contractsArea: Contract runtime, SDK, and executionE-mediumExperience needed to fix/implement: Medium / intermediateP-highHigh priorityT-bugType: Something is broken

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions