feat: adopt MessageOrigin API and remove ApplicationMessage.app#3538
feat: adopt MessageOrigin API and remove ApplicationMessage.app#3538iduartgomez merged 4 commits intomainfrom
Conversation
Update freenet-core to use the new typed MessageOrigin enum from freenet-stdlib instead of raw attested bytes. Renames throughout: - attested_contract → origin_contract - AttestedContract → OriginContract - DELEGATE_INHERITED_ATTESTATIONS → DELEGATE_INHERITED_ORIGINS The origin is now serialized via bincode as Option<MessageOrigin> instead of passed as raw 32-byte slices across the WASM boundary. All 7 test delegate crates updated to match the new API. Closes #1500
|
Now I have enough information to write the review. Let me compile the findings. 🔍 Rule Review: Rename attested_contract → origin_contract and adopt MessageOrigin APIRules checked: CriticalNo critical violations found. WarningsNo warnings found. Info
Automated review against |
The test_attested_contract_passed_to_delegate test was comparing raw serialized bytes against ContractInstanceId bytes, but the delegate now returns a bincode-serialized MessageOrigin (4-byte discriminant + 32-byte ID). Updated to properly deserialize MessageOrigin::WebApp and compare the extracted ContractInstanceId. Also updated Docker test runner to mount freenet-stdlib path dependencies so integration tests can resolve local path deps inside the container.
freenet-stdlib 0.3.0 pulled the old freenet-macros 0.1.3 which still generated attested: Option<&[u8]> in the #[delegate] FFI wrapper. Updated to 0.3.1 which requires freenet-macros 0.1.4 with the MessageOrigin codegen fix.
- Replace unwrap_or_default() with ? for origin serialization error - Fix stale "attested" label in Display impl for DelegateRequest - Rename attested_var binding to origin_contracts_var in codegen
Independent Review (4-perspective)No Blocking IssuesAll four review perspectives (code-first, testing, skeptical, big-picture) agree the core change is correct and well-tested. WASM boundary serialization works, rename is consistent, no tests removed. Should fix (follow-up PR)
Nice to have
Verified safe
|
Problem
The delegate runtime passes caller identity as raw bytes (
Option<&[u8]>) and everyApplicationMessagecarries a redundantapp: ContractInstanceIdfield. Internal naming uses "attested" terminology which is confusing.Relates to #1500.
Solution
MessageOriginenum from freenet-stdlib instead of raw bytesattested_contract→origin_contract,AttestedContract→OriginContract,DELEGATE_INHERITED_ATTESTATIONS→DELEGATE_INHERITED_ORIGINSOption<MessageOrigin>via bincode across the WASM boundaryappfield usage from allApplicationMessage::new()callsTesting
cargo fmt && cargo clippy --all-targetsclean (zero warnings)Dependencies
Depends on freenet/freenet-stdlib#61
Fixes
Closes #1500