chore: charge the write fee on every wallet without exception#1402
Conversation
Time Submission Status
Submit or update total time with: Add time on top of previous submission with: See available commands to help comply with our Guidelines. |
📝 WalkthroughWalkthroughThis PR removes the phased, role-gated ( ChangesUniversal fee charging migration
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Caller
participant Action as insert_records / insert_taxonomy / truflation_insert_records
participant Ledger as eth_truf balance
participant Leader as leader_sender
Caller->>Action: invoke action
Action->>Action: set total_fee = 1 TRUF
Action->>Leader: require `@leader_sender` present
Action->>Ledger: check caller balance >= total_fee
alt insufficient balance
Action-->>Caller: error "Insufficient balance for write fee"
else sufficient balance
Action->>Ledger: transfer fee to leader
Action->>Action: set fee_total / fee_recipient
Action->>Action: perform insert/validation logic
Action->>Action: record_transaction_event(fee_total, fee_recipient)
Action-->>Caller: success
end
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@holdex pr submit-time 4h |
resolves: https://github.com/truflation/website/issues/4203
resolves: https://github.com/truflation/website/issues/3808
What changes
The per-transaction write fee is now charged on every wallet — the
system:fee_requiredphased-rollout whitelist is gone. During the phased rollout only wallets enrolled in that role were charged, so write wallets could be funded one at a time before switching everyone to universal charging. That rollout is complete, so the gate is removed:insert_records(003) andinsert_taxonomy(004) now charge the flat 1 TRUF unconditionally — matchingcreate_streams(001), which already charged universally.truflation_insert_records(009) now charges the same flat 1 TRUF (previously it was fee-free).009is registered as afeetarget inscripts/generate_prod_migrations.py, so its new009-truflation-query.prod.sqlmainnet override routes the fee througheth_truf.system:fee_requiredrole bootstrap migration (047) is removed from the embedded seed. The role is now inert (nothing reads it); the one-off mainnet drop lives inmaintenance/and is applied manually.The dev
*.sqlsources were edited and the*.prod.sqloverrides regenerated via the existing generator (hoodi_tt→eth_truf); only the003/004/009prod files change.Tests
insert_records_fee_test.go/taxonomy_fee_test.go: removed the role-enrollment setup; inverted the previous "un-enrolled writes free" cases to assert universal charging.transaction_events_ledger_test.go: fees now fire without enrollment.maa/data_agent_test.go: reworked so each agent insert is charged from the wallet's escrow.truflation_insert_fee_test.go(new): assertstruflation_insert_recordscharges a flat 1 TRUF per transaction and reverts on insufficient balance.utils/setup/primitive.go: the shared truflation-insert helper now funds the provider for the fee.Full suites pass: roles, truflation, the insert/taxonomy/ledger fee suites, and all MAA tests.
Rollout notes (consensus-critical)
003/004/009*.prod.sqloverrides viakwil-cli exec-sql(aftererc20-bridge/000-extension.prod.sql, soeth_trufexists) — the same path as the existing003/004overrides.maintenance/050-drop-fee-required-role.sql(behavioural no-op — the actions no longer read the role).Summary by CodeRabbit