chore: exempt network_writer on attestation#1255
Conversation
WalkthroughThis change removes an explicit runtime permission requirement for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Time Submission Status
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
internal/migrations/024-attestation-actions.sql (1)
5-13: Update permissions documentation to reflect new fee-exemption model.The docstring is now inaccurate. The code no longer enforces an exclusive permission check; instead, it allows any wallet to request attestations, with
system:network_writermembers exempt from the 40 TRUF fee. Non-members must pay the fee. Update the Permissions section to reflect this.Suggested update:
/** * request_attestation: Request signed attestation of query results * * Permissions: - * - Only wallets with the 'system:network_writer' role can request attestations. + * - Any wallet can request attestations. + * - Wallets with 'system:network_writer' role are exempt from the 40 TRUF fee. + * - Non-exempt wallets must pay a 40 TRUF flat fee for attestation processing. * * Validates action is allowed, executes query deterministically, calculates * attestation hash, stores unsigned attestation, and queues for signing. */
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
internal/migrations/024-attestation-actions.sql(2 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-10T13:00:14.189Z
Learnt from: outerlook
Repo: trufnetwork/node PR: 1207
File: internal/migrations/024-attestation-actions.sql:58-76
Timestamp: 2025-10-10T13:00:14.189Z
Learning: In the attestation system for internal/migrations/024-attestation-actions.sql, the attestation_hash is computed from (version|algo|data_provider|stream_id|action_id|args) and intentionally excludes created_height. This design ensures the hash is deterministic based only on user input, not network state like block height.
Applied to files:
internal/migrations/024-attestation-actions.sql
📚 Learning: 2025-10-10T13:00:13.731Z
Learnt from: outerlook
Repo: trufnetwork/node PR: 1207
File: internal/migrations/023-attestation-schema.sql:20-21
Timestamp: 2025-10-10T13:00:13.731Z
Learning: In the attestations table (internal/migrations/023-attestation-schema.sql), the primary key is (requester, created_height, attestation_hash) because attestation_hash is computed deterministically from user input only (version|algo|data_provider|stream_id|action_id|args) and does not include created_height. This allows the same user to request the same attestation at different block heights.
Applied to files:
internal/migrations/024-attestation-actions.sql
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: acceptance-test
🔇 Additional comments (1)
internal/migrations/024-attestation-actions.sql (1)
48-53: No issues found—code is correct.The
are_members_of()function is properly defined in migration 013 with the expected contract: it returnsTABLE (wallet TEXT, is_member BOOL), accepts the 'system' owner, and the 'system:network_writer' role is bootstrapped in migration 015 before migration 024 executes. Non-existent wallets correctly returnis_member=FALSErather than being excluded. The function's helper validations pass with the hardcoded role name and owner provided at line 48.
resolves: https://github.com/trufnetwork/truf-network/issues/1336
Summary by CodeRabbit