Skip to content

chore: add stream creation fees#1244

Merged
MicBun merged 4 commits into
mainfrom
feesOnCreateStream
Nov 1, 2025
Merged

chore: add stream creation fees#1244
MicBun merged 4 commits into
mainfrom
feesOnCreateStream

Conversation

@MicBun
Copy link
Copy Markdown
Contributor

@MicBun MicBun commented Oct 31, 2025

Implements transaction fee collection for stream creation operations. Charges 2 TRUF per stream created, with automated systems exempted via role-based access control. Fees are distributed to block proposers to incentivize network participation.

  • Introduces revenue model for stream creation operations
  • Preserves zero-fee operations for authorized data providers
  • Incentivizes validators through fee distribution
  • Foundation for implementing remaining transaction fee types

resolves: https://github.com/trufnetwork/truf-network/issues/1312

Summary by CodeRabbit

  • New Features
    • Stream creation now charges 2 TRUF per stream; batch creations charge per-stream totals.
    • Callers holding the network_writer role are exempt from fees.
    • Stream creation will fail when the caller lacks sufficient balance; leaders receive collected fees when applicable.

Implements transaction fee collection for stream creation operations.
Charges 2 TRUF per stream created, with automated systems exempted via role-based
access control. Fees are distributed to block proposers to incentivize network
participation.

- Introduces revenue model for stream creation operations
- Preserves zero-fee operations for authorized data providers
- Incentivizes validators through fee distribution
- Foundation for implementing remaining transaction fee types

resolves: trufnetwork/truf-network#1312
@MicBun MicBun requested a review from outerlook October 31, 2025 12:57
@MicBun MicBun self-assigned this Oct 31, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Oct 31, 2025

Walkthrough

Adds 2 TRUF-per-stream fee collection to the create_streams action with exemption for callers holding system:network_writer; introduces test helpers to register providers without the role; adds comprehensive tests for fee behavior; and migrates test seed usage from script paths to inlined seed statements via a new migrations helper.

Changes

Cohort / File(s) Summary
Fee collection implementation
internal/migrations/001-common-actions.sql
Added fee phase to create_streams: determine exemption via system:network_writer, compute total fee (2 TRUF × streams), verify caller balance via bridge, transfer fee to leader, and only then proceed with stream creation; error on insufficient balance.
Migration utilities
internal/migrations/migration.go
Added GetSeedScriptStatements() to collect non-production embedded SQL files, replace production bridge namespace with test namespace, and return seed statements for tests.
Test helpers / role management
tests/streams/utils/setup/common.go
Added CreateDataProviderWithoutRole(ctx, platform, address) to register a provider without leaving network_writer role; added removeMemberFromRoleBypass helper to revoke role membership via auth override (direct SQL).
New fee tests
tests/streams/stream_creation_fee_test.go
New kwiltest-tagged test suite TestStreamCreationFees covering exempt vs non-exempt wallets, insufficient balance, role revoke/regrant behavior, batch creation fees, leader fee receipt, and helper utilities for balance injection and batch actions.
Test harness seed API updates
Multiple tests (see below)
Replaced SchemaTest.SeedScripts: migrations.GetSeedScriptPaths() with SchemaTest.SeedStatements: migrations.GetSeedScriptStatements() across many tests to use statement-based seeds instead of path-based seeds.
Permission tests adjusted
tests/streams/roles/permission_gates_test.go
Updated expectations and test names to reflect fee-exemption gating (insufficient balance errors for non-exempt callers; success without fees for role holders).
Tests updated (bulk)
tests/..., internal/benchmark/..., extensions/...
Example updated files: tests/streams/*, tests/extensions/*, internal/benchmark/*, extensions/tn_cache/*, extensions/tn_attestation/harness_integration_test.go — all switched from SeedScripts/GetSeedScriptPaths to SeedStatements/GetSeedScriptStatements.

Sequence Diagram

sequenceDiagram
    participant Caller as Caller (wallet)
    participant Action as create_streams
    participant Auth as Role Check
    participant Bridge as Ethereum Bridge
    participant Leader as Leader (recipient)
    participant Store as Stream Creation

    Caller->>Action: Request create_streams (n streams, @leader_sender)
    Action->>Auth: are_members_of('system','network_writer', Caller)
    alt is network_writer (exempt)
        Auth-->>Action: exempt
        Action->>Store: create n streams
        Store-->>Caller: success
    else not exempt
        Auth-->>Action: not exempt
        Action->>Bridge: balance(Caller)
        Bridge-->>Action: current_balance
        alt balance >= 2 * n TRUF
            Action->>Bridge: transfer(total_fee -> Leader)
            Bridge-->>Action: transfer success
            Action->>Store: create n streams
            Store-->>Caller: success
        else insufficient
            Action-->>Caller: error "Insufficient balance for stream creation"
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing extra attention:
    • internal/migrations/001-common-actions.sql: verify correct exemption check ordering, atomicity of fee transfer vs creation, encoding of @leader_sender, and error messages.
    • tests/streams/stream_creation_fee_test.go: large new test suite — confirm coverage, setup/teardown, and that bypass role revocation is safe/idempotent.
    • tests/streams/utils/setup/common.go: review direct SQL bypass logic for safety and cleanup on failures.
    • Migration helper GetSeedScriptStatements() and its use: ensure replacement of bridge namespace is correct and non-production files are correctly filtered.

Possibly related PRs

Suggested reviewers

  • williamrusdyputra

Poem

🐇 I hopped through SQL, with ledger in paw,

Two TRUF per stream — a tidy small law.
Network writers skip, they bound and they flee,
Leaders get coins, and tests prove it's key.
Hooray for clean hops and a balanced fee!

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 65.91% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues Check ✅ Passed The implementation addresses all key acceptance criteria from issue #1312. The SQL migration adds fee collection logic with a 2 TRUF per-stream charge, implements role-based exemption via the system:network_writer role, performs balance validation using ethereum_bridge.balance(), and transfers fees to @leader_sender before stream creation proceeds. The new test suite in stream_creation_fee_test.go validates fee application for exempt wallets, non-exempt wallets, insufficient balance scenarios, role-based fee changes, and batch stream creation. Helper functions in setup/common.go support testing both exempt and non-exempt user paths.
Out of Scope Changes Check ✅ Passed The changeset includes extensive test infrastructure updates that refactor seed data provisioning from script paths (SeedScripts) to embedded statements (SeedStatements) across numerous test files, alongside the new GetSeedScriptStatements() function. While these changes are broader than the minimal fee implementation, they appear necessary and directly justified: the new function performs runtime namespace replacement (ethereum_bridge → sepolia_bridge for tests), which is essential because the fee implementation calls ethereum_bridge functions that require proper namespace resolution in the test environment. This infrastructure change enables accurate testing of the fee collection logic.
Title Check ✅ Passed The title "chore: add stream creation fees" directly addresses the primary functional change in this pull request—implementing fee collection for stream creation operations. The changeset includes the core fee logic (2 TRUF per stream, role-based exemptions, and fee distribution to leaders), supporting test utilities (CreateDataProviderWithoutRole, role revocation helpers), and extensive test infrastructure updates (migration from SeedScripts to SeedStatements pattern). The title accurately captures the main feature addition and would be clear to a teammate reviewing the commit history, even though it doesn't enumerate all supporting details like role exemptions or test refactoring. The title is concise and specific enough to convey the primary purpose without being vague or misleading.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feesOnCreateStream

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@holdex
Copy link
Copy Markdown

holdex Bot commented Oct 31, 2025

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 16h Update time Nov 1, 2025, 5:56 PM
@outerlook ❌ Missing - ⚠️ Submit time -

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca70fa5 and a2ac82b.

📒 Files selected for processing (4)
  • internal/migrations/026-transaction-fees.sql (1 hunks)
  • internal/migrations/0_test_only/transaction-fees-testonly.sql (1 hunks)
  • tests/streams/stream_creation_fee_test.go (1 hunks)
  • tests/streams/utils/setup/common.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-23T07:00:26.796Z
Learnt from: williamrusdyputra
Repo: trufnetwork/node PR: 1228
File: internal/migrations/erc20-bridge/000-extension.sql:16-19
Timestamp: 2025-10-23T07:00:26.796Z
Learning: In internal/migrations/erc20-bridge/000-extension.sql, the active sepolia_bridge configuration is intentionally for test environments only and does not include the distribution_period parameter. The commented sepolia_bridge and ethereum_bridge blocks with distribution_period are production configurations.

Applied to files:

  • internal/migrations/0_test_only/transaction-fees-testonly.sql
🧬 Code graph analysis (2)
tests/streams/stream_creation_fee_test.go (7)
tests/streams/utils/runner.go (1)
  • RunSchemaTest (37-116)
internal/migrations/migration.go (1)
  • GetSeedScriptPaths (15-48)
tests/streams/utils/utils.go (1)
  • GetTestOptionsWithCache (75-88)
tests/streams/utils/setup/roles.go (1)
  • AddMemberToRoleBypass (73-98)
tests/streams/utils/setup/common.go (2)
  • CreateDataProvider (192-233)
  • CreateDataProviderWithoutRole (242-294)
tests/streams/utils/erc20/inject.go (1)
  • InjectERC20Transfer (24-85)
tests/streams/utils/erc20/helper.go (1)
  • GetUserBalance (49-74)
tests/streams/utils/setup/common.go (1)
tests/streams/utils/setup/roles.go (1)
  • AddMemberToRoleBypass (73-98)
⏰ 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). (2)
  • GitHub Check: lint
  • GitHub Check: acceptance-test

Comment thread tests/streams/utils/setup/common.go
Comment thread internal/migrations/026-transaction-fees.sql Outdated
Comment thread internal/migrations/0_test_only/transaction-fees-testonly.sql Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
internal/migrations/001-common-actions.sql (1)

84-86: Normalize leader address with 0x prefix before transfer.

Everything else in our ERC-20 helpers and tests passes addresses in 0x-prefixed form. Adding the prefix here keeps formats consistent and avoids relying on the bridge extension to infer it.

-        $leader_addr TEXT := encode(@leader_sender, 'hex')::TEXT;
+        $leader_addr TEXT := '0x' || encode(@leader_sender, 'hex')::TEXT;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a0112f8 and 6d82304.

📒 Files selected for processing (4)
  • internal/migrations/001-common-actions.sql (1 hunks)
  • internal/migrations/migration.go (1 hunks)
  • tests/streams/roles/permission_gates_test.go (6 hunks)
  • tests/streams/stream_creation_fee_test.go (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-09-22T13:56:02.283Z
Learnt from: outerlook
Repo: trufnetwork/node PR: 1168
File: internal/migrations/migration.go:22-37
Timestamp: 2025-09-22T13:56:02.283Z
Learning: The `GetSeedScriptPaths()` function in internal/migrations/migration.go is intended for test usage and should include test_only/*.sql files by design, not guard against them.

Applied to files:

  • internal/migrations/migration.go
🧬 Code graph analysis (2)
tests/streams/roles/permission_gates_test.go (1)
tests/streams/utils/setup/common.go (1)
  • UntypedCreateStream (59-95)
tests/streams/stream_creation_fee_test.go (7)
tests/streams/utils/runner.go (1)
  • RunSchemaTest (37-116)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/utils/utils.go (1)
  • GetTestOptionsWithCache (75-88)
tests/streams/utils/setup/roles.go (1)
  • AddMemberToRoleBypass (73-98)
tests/streams/utils/setup/common.go (2)
  • CreateDataProvider (193-234)
  • CreateDataProviderWithoutRole (243-295)
tests/streams/utils/erc20/inject.go (1)
  • InjectERC20Transfer (24-85)
tests/streams/utils/erc20/helper.go (1)
  • GetUserBalance (49-74)
⏰ 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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6d82304 and b86bfd2.

📒 Files selected for processing (48)
  • extensions/tn_attestation/harness_integration_test.go (1 hunks)
  • extensions/tn_cache/internal/engine_ops_integration_test.go (2 hunks)
  • extensions/tn_cache/internal/engine_ops_permissions_test.go (1 hunks)
  • internal/benchmark/digest/digest_benchmark_test.go (1 hunks)
  • internal/benchmark/load_test.go (1 hunks)
  • tests/database_size/database_size_v2_test.go (1 hunks)
  • tests/extensions/database-size/database_size_extension_test.go (1 hunks)
  • tests/extensions/erc20/common_test.go (2 hunks)
  • tests/extensions/tn_cache/cache_height_tracking_test.go (1 hunks)
  • tests/extensions/tn_cache/cache_integration_test.go (3 hunks)
  • tests/extensions/tn_cache/cache_observability_test.go (1 hunks)
  • tests/extensions/tn_cache/resolution_transaction_test.go (1 hunks)
  • tests/streams/aggregation/aggr01_basic_aggregation_test.go (1 hunks)
  • tests/streams/aggregation/aggr02_weighted_contributions_test.go (1 hunks)
  • tests/streams/aggregation/aggr03_taxonomy_validity_periods_test.go (1 hunks)
  • tests/streams/aggregation/aggr04_missing_data_handling_test.go (1 hunks)
  • tests/streams/aggregation/aggr05_no_duplicate_child_streams_test.go (1 hunks)
  • tests/streams/aggregation/aggr06_single_active_taxonomy_test.go (1 hunks)
  • tests/streams/aggregation/aggr07_inexistent_streams_test.go (1 hunks)
  • tests/streams/aggregation/aggr08_weight_change_test.go (1 hunks)
  • tests/streams/aggregation/aggr09_duplicate_values_test.go (1 hunks)
  • tests/streams/attestation/attestation_request_test.go (1 hunks)
  • tests/streams/attestation/attestation_retrieval_test.go (2 hunks)
  • tests/streams/auth/auth_test.go (9 hunks)
  • tests/streams/backward_compatibility_test.go (1 hunks)
  • tests/streams/cache_base_time_variants_test.go (1 hunks)
  • tests/streams/common_test.go (4 hunks)
  • tests/streams/complex_composed_test.go (1 hunks)
  • tests/streams/composed_test.go (1 hunks)
  • tests/streams/comprehensive_shared_path_independence_test.go (1 hunks)
  • tests/streams/database_size_test.go (1 hunks)
  • tests/streams/digest/digest_actions_test.go (2 hunks)
  • tests/streams/gamefi_index_test.go (1 hunks)
  • tests/streams/index_change_test.go (1 hunks)
  • tests/streams/multi_level_composed_test.go (1 hunks)
  • tests/streams/other/other_test.go (4 hunks)
  • tests/streams/other/stream_exists_batch_test.go (1 hunks)
  • tests/streams/pending_prune_days_test.go (2 hunks)
  • tests/streams/primitive_batch_insert_alignment_test.go (1 hunks)
  • tests/streams/primitive_test.go (1 hunks)
  • tests/streams/query/metadata_test.go (1 hunks)
  • tests/streams/query/query_test.go (1 hunks)
  • tests/streams/roles/permission_gates_test.go (7 hunks)
  • tests/streams/roles/role_management_test.go (1 hunks)
  • tests/streams/stream_creation_fee_test.go (1 hunks)
  • tests/streams/taxonomy_query_actions_test.go (1 hunks)
  • tests/streams/truflation_composed_frozen_test.go (1 hunks)
  • tests/streams/truflation_primitive_frozen_test.go (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/streams/query/query_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/streams/roles/permission_gates_test.go
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-07-14T18:18:20.905Z
Learnt from: outerlook
Repo: trufnetwork/node PR: 1055
File: extensions/tn_cache/internal/db_ops.go:40-43
Timestamp: 2025-07-14T18:18:20.905Z
Learning: The SetTx method in extensions/tn_cache/internal/db_ops.go is only used in tests that run sequentially, so concurrency concerns about race conditions don't apply to this method.

Applied to files:

  • tests/extensions/tn_cache/cache_height_tracking_test.go
  • extensions/tn_cache/internal/engine_ops_integration_test.go
  • tests/extensions/tn_cache/cache_integration_test.go
  • tests/extensions/tn_cache/resolution_transaction_test.go
📚 Learning: 2025-09-22T13:56:02.283Z
Learnt from: outerlook
Repo: trufnetwork/node PR: 1168
File: internal/migrations/migration.go:22-37
Timestamp: 2025-09-22T13:56:02.283Z
Learning: The `GetSeedScriptPaths()` function in internal/migrations/migration.go is intended for test usage and should include test_only/*.sql files by design, not guard against them.

Applied to files:

  • tests/extensions/tn_cache/cache_height_tracking_test.go
  • tests/streams/query/metadata_test.go
  • tests/streams/aggregation/aggr02_weighted_contributions_test.go
  • tests/streams/aggregation/aggr09_duplicate_values_test.go
  • tests/streams/roles/role_management_test.go
  • tests/streams/primitive_test.go
  • tests/streams/aggregation/aggr01_basic_aggregation_test.go
  • tests/streams/attestation/attestation_retrieval_test.go
  • tests/streams/common_test.go
  • tests/streams/digest/digest_actions_test.go
  • tests/streams/multi_level_composed_test.go
  • tests/streams/primitive_batch_insert_alignment_test.go
  • extensions/tn_cache/internal/engine_ops_integration_test.go
  • tests/streams/cache_base_time_variants_test.go
  • tests/streams/aggregation/aggr08_weight_change_test.go
  • internal/benchmark/digest/digest_benchmark_test.go
  • tests/streams/truflation_primitive_frozen_test.go
  • tests/extensions/erc20/common_test.go
  • tests/database_size/database_size_v2_test.go
  • tests/streams/attestation/attestation_request_test.go
  • tests/streams/backward_compatibility_test.go
  • tests/streams/aggregation/aggr06_single_active_taxonomy_test.go
  • tests/streams/aggregation/aggr04_missing_data_handling_test.go
  • tests/streams/database_size_test.go
  • tests/streams/taxonomy_query_actions_test.go
  • tests/extensions/tn_cache/cache_integration_test.go
  • tests/streams/gamefi_index_test.go
  • tests/streams/aggregation/aggr03_taxonomy_validity_periods_test.go
  • tests/streams/auth/auth_test.go
  • tests/streams/composed_test.go
  • extensions/tn_cache/internal/engine_ops_permissions_test.go
  • tests/streams/complex_composed_test.go
  • tests/streams/comprehensive_shared_path_independence_test.go
  • tests/extensions/tn_cache/cache_observability_test.go
  • tests/streams/pending_prune_days_test.go
  • tests/streams/other/stream_exists_batch_test.go
  • extensions/tn_attestation/harness_integration_test.go
  • tests/streams/index_change_test.go
  • tests/streams/aggregation/aggr07_inexistent_streams_test.go
  • internal/benchmark/load_test.go
  • tests/extensions/database-size/database_size_extension_test.go
  • tests/extensions/tn_cache/resolution_transaction_test.go
  • tests/streams/aggregation/aggr05_no_duplicate_child_streams_test.go
  • tests/streams/truflation_composed_frozen_test.go
  • tests/streams/other/other_test.go
🧬 Code graph analysis (46)
tests/extensions/tn_cache/cache_height_tracking_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/query/metadata_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr02_weighted_contributions_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr09_duplicate_values_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/roles/role_management_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/primitive_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr01_basic_aggregation_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/attestation/attestation_retrieval_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/common_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/digest/digest_actions_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/multi_level_composed_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/primitive_batch_insert_alignment_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
extensions/tn_cache/internal/engine_ops_integration_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/cache_base_time_variants_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr08_weight_change_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
internal/benchmark/digest/digest_benchmark_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/truflation_primitive_frozen_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/stream_creation_fee_test.go (7)
tests/streams/utils/runner.go (1)
  • RunSchemaTest (37-116)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/utils/utils.go (1)
  • GetTestOptionsWithCache (75-88)
tests/streams/utils/setup/roles.go (1)
  • AddMemberToRoleBypass (73-98)
tests/streams/utils/setup/common.go (2)
  • CreateDataProvider (193-234)
  • CreateDataProviderWithoutRole (243-295)
tests/streams/utils/erc20/inject.go (1)
  • InjectERC20Transfer (24-85)
tests/streams/utils/erc20/helper.go (1)
  • GetUserBalance (49-74)
tests/extensions/erc20/common_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/database_size/database_size_v2_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/attestation/attestation_request_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/backward_compatibility_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr06_single_active_taxonomy_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr04_missing_data_handling_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/database_size_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/taxonomy_query_actions_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/extensions/tn_cache/cache_integration_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/gamefi_index_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr03_taxonomy_validity_periods_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/auth/auth_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/composed_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
extensions/tn_cache/internal/engine_ops_permissions_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/complex_composed_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/comprehensive_shared_path_independence_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/extensions/tn_cache/cache_observability_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/pending_prune_days_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/other/stream_exists_batch_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
extensions/tn_attestation/harness_integration_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/index_change_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr07_inexistent_streams_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
internal/benchmark/load_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/extensions/database-size/database_size_extension_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/extensions/tn_cache/resolution_transaction_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/aggregation/aggr05_no_duplicate_child_streams_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/truflation_composed_frozen_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
tests/streams/other/other_test.go (1)
internal/migrations/migration.go (1)
  • GetSeedScriptStatements (60-109)
🪛 GitHub Actions: CI
tests/streams/auth/auth_test.go

[error] 45-45: undefined: testutils.RunSchemaTest

🔇 Additional comments (45)
tests/streams/primitive_batch_insert_alignment_test.go (1)

35-35: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

tests/streams/aggregation/aggr02_weighted_contributions_test.go (1)

37-37: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

tests/streams/other/stream_exists_batch_test.go (1)

27-27: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

tests/extensions/tn_cache/cache_height_tracking_test.go (1)

35-35: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

tests/streams/taxonomy_query_actions_test.go (1)

36-36: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

tests/streams/auth/auth_test.go (2)

47-47: Seed data migration looks good.

The switch from SeedScripts to SeedStatements across all test functions aligns with the repository-wide migration to inline seed statements. The test logic remains unchanged.

Also applies to: 58-58, 179-179, 300-300, 465-465, 534-534, 631-631, 859-859, 926-926


45-45: Compilation error claim is unfounded; remove this comment.

The testutils package is properly imported as "github.com/trufnetwork/node/tests/streams/utils", and the RunSchemaTest function exists and is exported in tests/streams/utils/runner.go:37. The function is called correctly throughout the file. The review comment references a stale or false pipeline error; the code compiles without the claimed undefined: testutils.RunSchemaTest error.

Likely an incorrect or invalid review comment.

extensions/tn_cache/internal/engine_ops_integration_test.go (1)

35-35: Seed data migration looks good.

The switch from SeedScripts to SeedStatements in both test functions aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

Also applies to: 334-334

tests/streams/attestation/attestation_request_test.go (1)

28-28: Seed data migration looks good.

The switch from SeedScripts to SeedStatements aligns with the repository-wide migration to inline seed statements, and the test logic remains unchanged.

extensions/tn_cache/internal/engine_ops_permissions_test.go (1)

29-29: LGTM: Seed data source migration.

The switch from SeedScripts to SeedStatements aligns with the broader test infrastructure refactor. The new GetSeedScriptStatements() function centralizes seed data loading and applies test-specific transformations internally, which is cleaner than the previous path-based approach.

tests/streams/aggregation/aggr03_taxonomy_validity_periods_test.go (1)

40-40: LGTM: Seed data source migration.

Consistent with the repository-wide migration from path-based to statement-based seed data provisioning.

tests/streams/comprehensive_shared_path_independence_test.go (1)

37-37: LGTM: Seed data source migration.

The migration to SeedStatements is consistent with the broader test infrastructure refactor across the codebase.

tests/extensions/tn_cache/cache_observability_test.go (1)

34-34: LGTM: Seed data source migration.

Aligns with the repository-wide switch to statement-based seed data provisioning.

tests/streams/roles/role_management_test.go (1)

86-86: LGTM: Seed data source migration.

Consistent with the test infrastructure refactor that centralizes seed data loading and test-specific transformations.

tests/streams/common_test.go (1)

46-46: LGTM: Seed data source migration.

All four test configurations in this file consistently migrate from SeedScripts to SeedStatements, aligning with the broader test infrastructure refactor.

tests/streams/primitive_test.go (1)

26-26: LGTM: Seed data source migration.

The switch to SeedStatements is consistent with the repository-wide test infrastructure refactor.

tests/streams/aggregation/aggr09_duplicate_values_test.go (1)

46-46: LGTM: Seed data source migration.

Consistent with the broader migration to statement-based seed data provisioning via GetSeedScriptStatements().

tests/database_size/database_size_v2_test.go (1)

38-38: LGTM! Consistent seed data migration.

The migration from SeedScripts to SeedStatements aligns with the project-wide refactoring to inline seed statements rather than using script paths. This change has no functional impact on the test.

tests/streams/other/other_test.go (1)

33-33: LGTM! Consistent seed data migration across multiple tests.

All four test functions correctly migrate from SeedScripts to SeedStatements using the new GetSeedScriptStatements() helper. The changes are consistent and have no functional impact on test behavior.

Also applies to: 93-93, 204-204, 255-255

tests/streams/truflation_primitive_frozen_test.go (1)

29-29: LGTM! Seed data migration applied correctly.

The change from SeedScripts to SeedStatements is consistent with the project-wide refactoring to use inline seed statements.

tests/streams/aggregation/aggr04_missing_data_handling_test.go (1)

39-39: LGTM! Seed data migration applied correctly.

The migration to SeedStatements with GetSeedScriptStatements() is consistent with the repository-wide refactoring and has no functional impact on the aggregation test.

tests/streams/truflation_composed_frozen_test.go (1)

34-34: LGTM! Seed data migration applied correctly.

The change to SeedStatements using GetSeedScriptStatements() aligns with the project-wide refactoring effort. No functional changes to the frozen composed stream tests.

tests/streams/cache_base_time_variants_test.go (1)

35-35: LGTM! Seed data migration applied correctly.

The migration to SeedStatements is consistent with the broader refactoring to use inline seed statements rather than script paths.

tests/streams/aggregation/aggr01_basic_aggregation_test.go (1)

37-37: LGTM! Seed data migration applied correctly.

The change from SeedScripts to SeedStatements is part of the repository-wide migration to inline seed statements and has no impact on the basic aggregation test logic.

internal/benchmark/load_test.go (1)

244-246: LGTM! Seed data migration applied correctly.

The migration from SeedScripts to SeedStatements in the benchmark test setup is consistent with the project-wide refactoring. The change has no functional impact on benchmark execution.

tests/streams/composed_test.go (1)

29-29: LGTM! Seed data migration completed correctly.

The migration from path-based to statement-based seed provisioning is correct and consistent with the broader refactoring across the test suite.

tests/streams/pending_prune_days_test.go (1)

26-26: LGTM! Both test functions migrated consistently.

Both test initialization blocks correctly updated to use the statement-based seed provisioning approach.

Also applies to: 37-37

internal/benchmark/digest/digest_benchmark_test.go (1)

201-201: LGTM! Benchmark test seed provisioning updated correctly.

tests/streams/aggregation/aggr06_single_active_taxonomy_test.go (1)

36-36: LGTM! Aggregation test updated correctly.

tests/streams/index_change_test.go (1)

27-27: LGTM! Index change test updated correctly.

tests/streams/aggregation/aggr07_inexistent_streams_test.go (1)

32-32: LGTM! Test updated correctly.

tests/extensions/erc20/common_test.go (1)

31-31: LGTM! ERC20 test helper updated correctly.

The seed provisioning migration is implemented correctly with the variable declaration and field assignment both updated consistently.

Also applies to: 53-55

tests/streams/database_size_test.go (1)

28-28: LGTM! Database size test updated correctly.

tests/streams/attestation/attestation_retrieval_test.go (2)

23-23: LGTM! Seed data migration applied correctly.

The migration from SeedScripts to SeedStatements is consistent with the repository-wide refactor to use inline seed statements instead of script paths.


111-111: LGTM! Consistent seed data migration.

Second test properly updated with the same SeedStatements pattern.

tests/extensions/tn_cache/resolution_transaction_test.go (1)

28-28: LGTM! Seed migration correctly applied.

Consistent with the repository-wide migration to inline seed statements.

tests/streams/complex_composed_test.go (1)

35-35: LGTM! Seed data migration applied.

Follows the consistent pattern for migrating to inline seed statements.

tests/extensions/database-size/database_size_extension_test.go (1)

30-30: LGTM! Consistent seed migration.

Properly migrated to use SeedStatements with the new helper function.

tests/streams/query/metadata_test.go (1)

49-49: LGTM! Migration applied correctly.

Seed data now uses inline statements as intended by the repository-wide refactor.

extensions/tn_attestation/harness_integration_test.go (1)

83-83: LGTM! Seed migration in harness test.

Correctly migrated to use inline seed statements via GetSeedScriptStatements().

tests/streams/backward_compatibility_test.go (1)

18-18: LGTM! Backward compatibility test updated.

Seed migration applied consistently with other test files.

tests/extensions/tn_cache/cache_integration_test.go (3)

39-39: LGTM! Cache integration test migrated.

First of three tests in this file correctly updated to use inline seed statements.


221-221: LGTM! Include children test migrated.

Second test properly updated with the seed migration pattern.


243-243: LGTM! Base time variants test migrated.

Third test consistently updated to use inline seed statements.

tests/streams/gamefi_index_test.go (1)

103-103: Line 103 change is correct, but cannot verify test execution due to unrelated compilation errors in test infrastructure.

The change from SeedScripts: migrations.GetSeedScriptPaths() to SeedStatements: migrations.GetSeedScriptStatements() is correct and properly uses the new seed provisioning API. However, the test suite has compilation failures in unrelated test files (cache_base_time_variants_test.go, complex_composed_test.go) that appear to be pre-existing infrastructure issues with testutils type exports. These prevent verification that the test passes with the new fee system.

Action required: Verify that:

  1. The unrelated compilation errors are resolved or pre-existing
  2. TestGamefiIndex passes with the fee system active (lines 165, 334 create streams which now incur fees)

Comment thread tests/streams/stream_creation_fee_test.go
@MicBun MicBun requested a review from outerlook October 31, 2025 20:20
@MicBun
Copy link
Copy Markdown
Contributor Author

MicBun commented Oct 31, 2025

It is now ready to review again @outerlook

@MicBun MicBun enabled auto-merge (squash) November 1, 2025 13:10
@MicBun MicBun changed the title chore: add stream creation fees with role exemptions chore: add stream creation fees Nov 1, 2025
@MicBun MicBun merged commit 87519c9 into main Nov 1, 2025
8 of 9 checks passed
@MicBun MicBun deleted the feesOnCreateStream branch November 1, 2025 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants