Skip to content

feat: add PutContractRequest/PutContractResponse for delegate contract PUT#48

Open
sanity wants to merge 1 commit intomainfrom
feat-delegate-contract-put
Open

feat: add PutContractRequest/PutContractResponse for delegate contract PUT#48
sanity wants to merge 1 commit intomainfrom
feat-delegate-contract-put

Conversation

@sanity
Copy link
Contributor

@sanity sanity commented Feb 1, 2026

Summary

Adds message types to allow delegates to store new contracts via PUT operation.

Part of freenet/freenet-core#2829 (Delegate capability: Contract PUT).

Changes

New types in delegate_interface.rs

  • PutContractRequest: Request to store a new contract

    • contract: ContractContainer - the contract code and parameters
    • state: WrappedState - the initial state
    • related_contracts: RelatedContracts<'static> - dependencies
    • context: DelegateContext - for context propagation
    • processed: bool - processing flag
  • PutContractResponse: Response after PUT attempt

    • contract_id: ContractInstanceId - the contract that was stored
    • result: Result<(), String> - success or error message
    • context: DelegateContext - for context propagation

Enum updates

  • OutboundDelegateMsg::PutContractRequest added
  • InboundDelegateMsg::PutContractResponse added
  • Helper methods updated (processed, get_context, get_mut_context, into_owned)
  • From implementations added

Client serialization

  • Added stub for PutContractRequest in client_events.rs (logs error if reached, as it should be handled by executor)

Testing

  • All existing tests pass
  • Types serialize/deserialize correctly

[AI-assisted - Claude]

…tract PUT

Adds message types to allow delegates to store new contracts:

- PutContractRequest: Contains contract code, initial state, and related contracts
- PutContractResponse: Contains result (success or error message)

Part of #2829 (delegate capability: contract PUT).

Co-Authored-By: Claude Opus 4.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