Skip to content

feat: reapply MessageOrigin API and remove ApplicationMessage.app#3542

Merged
sanity merged 1 commit intomainfrom
reapply-message-origin
Mar 13, 2026
Merged

feat: reapply MessageOrigin API and remove ApplicationMessage.app#3542
sanity merged 1 commit intomainfrom
reapply-message-origin

Conversation

@sanity
Copy link
Copy Markdown
Collaborator

@sanity sanity commented Mar 12, 2026

Context

Re-applies #3538 (Nacho's delegate API cleanup), which was temporarily reverted in 3d481af to unblock a regression fix release for v0.1.183 connection instability.

Prerequisites before merging

Original PR

All changes are identical to #3538:

  • DelegateInterface::process: attested: Option<&'static [u8]>origin: Option<MessageOrigin>
  • ApplicationMessage: removed app: ContractInstanceId field
  • ApplicationMessage::new(app, payload)ApplicationMessage::new(payload)
  • Uses freenet-stdlib 0.3.2 / freenet-macros 0.2.0

This is a breaking change for existing delegate WASM — old delegates cannot be loaded after this lands.

[AI-assisted - Claude]

@github-actions
Copy link
Copy Markdown
Contributor

After reading all rule files and the complete diff, here is the review:


✅ Rule Review: No issues found

Rules checked: git-workflow.md, code-style.md, testing.md, contracts.md
Files reviewed: 21

No rule violations detected — merge is not blocked by this check.


Summary of changes reviewed:

This PR is a rename/refactor across the codebase:

  • attested_contract / AttestedContract / AttestedContractMaporigin_contract / OriginContract / OriginContractMap
  • ApplicationMessage.app field removed; ApplicationMessage::new() no longer takes an app_id argument
  • Wire protocol updated to use MessageOrigin enum (bincode-serialized) instead of raw &[u8]
  • DELEGATE_INHERITED_ATTESTATIONSDELEGATE_INHERITED_ORIGINS
  • freenet-stdlib bumped 0.2.2 → 0.3.1, freenet-macros 0.1.3 → 0.1.4

Checks performed:

  • CRITICAL — no violations: No new Instant::now() / tokio::time::sleep() in crates/core/ (one pre-existing Instant::now() in spawn_token_cleanup_task is context, not added by this PR). No rand::random() / rand::thread_rng(). No tokio::net::UdpSocket. No deleted or commented-out tests; _app_id / _app prefixes in test code are correct Rust convention for intentionally unused variables with the new API.
  • WARNING — no violations: No new .unwrap() in production code. No fire-and-forget spawns added. No retry loops. No GC exemptions without TTL.
  • INFO — no violations: The non-exhaustive match origin { Some(MessageOrigin::WebApp(…)) => …, None => … } in runtime.rs is compile-time exhaustive (Rust enforces this), so it doesn't silently miss future variants. Doc comments on renamed public types are updated throughout.

Automated review against .claude/rules/. Critical and Warning findings block merge — check boxes or post /ack to acknowledge.

@sanity sanity added this pull request to the merge queue Mar 13, 2026
Merged via the queue into main with commit 5f75b46 Mar 13, 2026
11 checks passed
@sanity sanity deleted the reapply-message-origin branch March 13, 2026 01:52
iduartgomez added a commit that referenced this pull request Mar 13, 2026
The antiflood-tokens and identity-management module delegates were still
using the old `attested: Option<&'static [u8]>` parameter and
`ApplicationMessage::new(app, payload)` constructor from freenet-stdlib
0.1.24. This completes the migration started in PR #3542.

- antiflood-tokens: upgrade to freenet-stdlib 0.3.1, remove `app`
  parameter from `allocate_token()`, replace removed GetSecretResponse/
  GetSecretRequest match arms with wildcard
- identity-management: upgrade to freenet-stdlib 0.3.1, rewrite
  process() to use V2 host functions (ctx.get_secret/set_secret)
  instead of the old request/response secret pattern, fix rand_core
  version conflict by pinning rand to 0.8
- delegate_api.rs: update stale pseudocode examples from `attested`
  to `origin`

Closes #1498
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