Skip to content

feat: bridge with hoodi tt2 non-custodial contract#1298

Merged
MicBun merged 2 commits intomainfrom
hooditttwo
Jan 13, 2026
Merged

feat: bridge with hoodi tt2 non-custodial contract#1298
MicBun merged 2 commits intomainfrom
hooditttwo

Conversation

@MicBun
Copy link
Member

@MicBun MicBun commented Jan 13, 2026

resolves: https://github.com/truflation/website/issues/3117

Summary by CodeRabbit

  • New Features

    • Added support for a second test token to enable parallel bridge operations.
    • Expanded withdrawal-proof output with additional fields for greater transparency.
  • Refactor

    • Renamed and re-scoped bridge declarations and related actions to a new token-focused namespace.
  • Tests

    • Updated tests and test messages to align with the renamed bridge and new token.

✏️ Tip: You can customize this high-level summary in your review settings.

@MicBun MicBun self-assigned this Jan 13, 2026
@MicBun MicBun added the type: feat New feature or request label Jan 13, 2026
@holdex
Copy link

holdex bot commented Jan 13, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 4h Update time Jan 13, 2026, 9:03 AM

@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The PR renames the Hoodi ERC20 bridge extension from hoodi_bridge to hoodi_tt, adds a second parallel extension hoodi_tt2, and updates related SQL migrations, public actions, and tests to use the new namespaces.

Changes

Cohort / File(s) Summary
ERC20 Bridge Extension Declarations
internal/migrations/erc20-bridge/000-extension.sql
Renamed exported alias hoodi_bridgehoodi_tt; added a new exported bridge hoodi_tt2 with its own token, proxy, and distribution_period configuration and comments.
ERC20 Bridge Actions
internal/migrations/erc20-bridge/001-actions.sql
Renamed action signatures and internal references from hoodi_*/hoodi_bridge.* to hoodi_tt_*/hoodi_tt.*; added parallel hoodi_tt2_* actions mirroring TT1 flows (info, wallet balance, bridge tokens), including fee transfer and event recording.
Migration Disabling
internal/migrations/erc20-bridge/003-disable-hoodi.prod.sql
Updated header/comments and UNUSED directive to reference hoodi_tt instead of hoodi_bridge.
Withdrawal Proof Action
internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql
Renamed public action to hoodi_tt_get_withdrawal_proof(); expanded RETURN TABLE schema (added contract, created_at, param_* fields, proofs/signatures arrays); switched internal call to hoodi_tt.list_wallet_rewards().
Tests
tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go, tests/streams/hoodi_withdrawal_fee_test.go
Updated MigrationHoodiAlias and all test references/messages to hoodi_tt; replaced hoodi_bridge_tokens calls with hoodi_tt_bridge_tokens and adjusted test expectations/logs accordingly.

Sequence Diagram(s)

(silently skipped — conditions for diagram generation not met)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • pr-time-tracker

Poem

🐰 I hopped through SQL, nosed each line,
Renamed the bridge to make it fine,
Brought a buddy, TT2, to play,
Tokens and tests now dance away,
Tiny paws, big migration day! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: bridge with hoodi tt2 non-custodial contract' accurately reflects the main change: adding support for a second Hoodi bridge (hoodi_tt2) alongside the renamed hoodi_tt bridge, with corresponding actions and test updates.
Docstring Coverage ✅ Passed Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b6d6599 and 4099b9b.

📒 Files selected for processing (2)
  • tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go
  • tests/streams/hoodi_withdrawal_fee_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/streams/hoodi_withdrawal_fee_test.go
⏰ 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). (3)
  • GitHub Check: slow-integration-tests
  • GitHub Check: lint
  • GitHub Check: acceptance-test
🔇 Additional comments (6)
tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go (6)

19-25: LGTM!

The constant rename from "hoodi_bridge" to "hoodi_tt" aligns with the migration namespace changes. The comment correctly references the source migration file.


27-55: LGTM!

Documentation and test name updates are consistent with the hoodi_tt namespace migration. The test setup logic remains correct.


109-120: LGTM!

The public action name is correctly updated to "hoodi_tt_get_withdrawal_proof". The call pattern using an empty namespace for public actions is consistent with the test framework.


219-226: LGTM!

Success logging is updated to reflect the renamed action.


231-301: LGTM!

Test naming and action call updated consistently to hoodi_tt. The test logic correctly validates that pending (unfinalized) epochs are excluded from withdrawal proof results.


303-448: LGTM!

Test naming and action calls updated consistently to hoodi_tt. The multi-user test logic correctly validates that individual users can retrieve their respective withdrawal proofs with correct amounts after epoch finalization.


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.

Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (6)
internal/migrations/erc20-bridge/001-actions.sql (1)

59-115: Add hoodi_tt2_get_withdrawal_proof action to maintain parity with hoodi_tt.

The hoodi_tt2 bridge is missing the withdrawal proof action. While hoodi_tt_get_withdrawal_proof exists in 004-withdrawal-proof-action.sql, there is no corresponding hoodi_tt2_get_withdrawal_proof. Since both test tokens have identical bridge action patterns, TT2 users will need withdrawal proof functionality. Add the missing action following the same pattern as hoodi_tt_get_withdrawal_proof, replacing hoodi_tt namespace references with hoodi_tt2.

tests/streams/hoodi_withdrawal_fee_test.go (5)

127-141: Inconsistent naming in log message.

Line 127 correctly uses hoodi_tt_bridge_tokens, but line 140's log message still references hoodi_bridge_tokens. Update for consistency.

Suggested fix
-		t.Logf("✅ hoodi_bridge_tokens correctly deducted 50 TRUF (10 withdrawal + 40 fee)")
+		t.Logf("✅ hoodi_tt_bridge_tokens correctly deducted 50 TRUF (10 withdrawal + 40 fee)")

167-172: Inconsistent naming in log message.

Line 167 correctly uses hoodi_tt_bridge_tokens, but line 171's log message still references hoodi_bridge_tokens.

Suggested fix
-		t.Logf("✅ hoodi_bridge_tokens correctly rejects insufficient balance (30 TRUF < 50 TRUF needed)")
+		t.Logf("✅ hoodi_tt_bridge_tokens correctly rejects insufficient balance (30 TRUF < 50 TRUF needed)")

214-216: Inconsistent naming in require message.

Line 215's require message still references hoodi_bridge_tokens while other test functions have been updated to use hoodi_tt_bridge_tokens.

Suggested fix
-		require.NoError(t, err, "hoodi_bridge_tokens with leader should succeed")
+		require.NoError(t, err, "hoodi_tt_bridge_tokens with leader should succeed")

354-385: Inconsistent function comment.

The function callHoodiWithdrawalAction comment at line 354 still references hoodi_bridge_tokens while line 374 correctly calls hoodi_tt_bridge_tokens.

Suggested fix
-// callHoodiWithdrawalAction calls the hoodi_bridge_tokens action
+// callHoodiWithdrawalAction calls the hoodi_tt_bridge_tokens action

99-100: Inconsistent test function comment.

The comment at line 99 still references hoodi_bridge_tokens. Update to hoodi_tt_bridge_tokens for consistency with the renamed action.

Suggested fix
-// Test 1: hoodi_bridge_tokens pays 40 TRUF fee
+// Test 1: hoodi_tt_bridge_tokens pays 40 TRUF fee
🤖 Fix all issues with AI agents
In @tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go:
- Around line 27-35: Update the stale comment in the
TestHoodiGetWithdrawalProofAction block: replace the phrase
"migration-registered hoodi_bridge instance" with "migration-registered hoodi_tt
instance" so the comment correctly reflects the renamed instance (refer to the
test function TestHoodiGetWithdrawalProofAction to locate the comment).
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8546c1c and b6d6599.

📒 Files selected for processing (6)
  • internal/migrations/erc20-bridge/000-extension.sql
  • internal/migrations/erc20-bridge/001-actions.sql
  • internal/migrations/erc20-bridge/003-disable-hoodi.prod.sql
  • internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql
  • tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go
  • tests/streams/hoodi_withdrawal_fee_test.go
🧰 Additional context used
🪛 Gitleaks (8.30.0)
internal/migrations/erc20-bridge/000-extension.sql

[high] 24-24: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)


[high] 34-34: Detected a Generic API Key, potentially exposing access to various services and sensitive operations.

(generic-api-key)

⏰ 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: slow-integration-tests
  • GitHub Check: acceptance-test
🔇 Additional comments (12)
internal/migrations/erc20-bridge/000-extension.sql (1)

22-41: LGTM! New hoodi_tt2 bridge extension and rename look good.

The static analysis warnings about "Generic API Key" on lines 24 and 34 are false positives — these are public Ethereum contract addresses (token and proxy contracts) that are intentionally documented here and publicly visible on block explorers.

internal/migrations/erc20-bridge/001-actions.sql (2)

1-17: LGTM! Renamed hoodi_tt actions are correctly updated.

The namespace migration from hoodi_* to hoodi_tt_* is consistent, and all internal calls now correctly reference hoodi_tt.info().


24-57: LGTM! Bridge tokens action properly handles fee collection and event recording.

The logic correctly:

  • Validates balance against total required (withdrawal + fee)
  • Transfers fee to leader before bridge operation
  • Records the transaction event after successful bridge
internal/migrations/erc20-bridge/004-withdrawal-proof-action.sql (1)

1-27: LGTM! Withdrawal proof action correctly renamed to hoodi_tt namespace.

The action properly:

  • Uses hoodi_tt.list_wallet_rewards for the internal call
  • Returns all required fields including validator signatures
  • Uses RETURN NEXT for multiple row support
internal/migrations/erc20-bridge/003-disable-hoodi.prod.sql (1)

1-7: LGTM! Disable migration correctly updated for hoodi_tt.

The UNUSE hoodi_tt directive and accompanying comments are consistent with the extension rename.

tests/extensions/erc20/erc20_bridge_withdrawal_proof_test.go (4)

19-25: LGTM! Test constants correctly updated.

The MigrationHoodiAlias constant is properly updated to "hoodi_tt" matching the extension rename.


38-228: LGTM! Test TestHoodiGetWithdrawalProofAction properly validates the renamed action.

The test comprehensively validates:

  • Merkle proof structure (32-byte root and proof elements)
  • Validator signatures (65 bytes each)
  • All 10 return columns
  • Correct chain/contract/recipient matching

231-301: LGTM! Pending epoch exclusion test correctly updated.

Test name and action calls properly reference hoodi_tt_get_withdrawal_proof.


303-448: LGTM! Multiple users test correctly validates independent withdrawal proofs.

The test properly verifies that each user receives their own withdrawal proof with correct amounts.

tests/streams/hoodi_withdrawal_fee_test.go (3)

23-30: LGTM!

The extension name constant is correctly updated to hoodi_tt, aligning with the renamed extension.


47-61: LGTM!

Comment correctly updated to reference the renamed hoodi_tt_bridge_tokens action.


63-97: LGTM!

Setup function comment correctly updated to reference the hoodi_tt instance name.

@MicBun MicBun merged commit 55461dc into main Jan 13, 2026
8 checks passed
@MicBun MicBun deleted the hooditttwo branch January 13, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant