Conversation
WalkthroughAdds THORChain support: new RPC client, indexer, config entry, key-sign validation handling, transaction hash computation, and retry-capable on-chain status checks; also updates module dependencies in go.mod. Changes
Sequence DiagramsequenceDiagram
participant API as Key-Sign API
participant Validator as Plugin Validator
participant Indexer as THORChain Indexer
participant SDK as THOR SDK
participant RPC as THORChain RPC
API->>Validator: Submit THORChain key-sign request
Validator->>Validator: base64 decode proposed tx -> txBytesEvaluate
Validator-->>API: validation result / error
Note over Indexer,SDK: ComputeTxHash flow
Indexer->>SDK: Sign proposedTx with sigs
alt sign success
SDK-->>Indexer: signedTx
Indexer->>Indexer: SHA-256(signedTx) -> uppercase hex
Indexer-->>API: tx hash
else sign error
SDK-->>Indexer: error
Indexer-->>API: error
end
Note over API,RPC: On-chain status query
API->>RPC: GetTxStatus(txHash)
rect rgba(220,240,255,0.4)
RPC->>RPC: enforce rate limiter
RPC->>RPC: makeRequestWithRetry (exp backoff + jitter)
RPC->>RPC: handle 429 Retry-After, non-200, parse tx_result
end
RPC-->>API: TxOnChainStatus (Pending/Success/Fail)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
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 |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
plugin/tx_indexer/pkg/rpc/thorchain.go (1)
146-148: Fix jitter calculation so it actually introduces varianceLine 147 casts the random factor to
time.Durationbefore multiplying, so it truncates to 0 ns and the backoff never jitters. Use float arithmetic first, then convert back totime.Duration.- jitter := time.Duration(rand.Float64()*0.5-0.25) * delay - return delay + jitter + scale := 1 + (rand.Float64()*0.5 - 0.25) + return time.Duration(float64(delay) * scale)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
go.sumis excluded by!**/*.sum
📒 Files selected for processing (7)
go.mod(1 hunks)internal/api/plugin.go(1 hunks)plugin/tx_indexer/chains_list.go(3 hunks)plugin/tx_indexer/pkg/chain/thorchain.go(1 hunks)plugin/tx_indexer/pkg/config/config.go(1 hunks)plugin/tx_indexer/pkg/rpc/thorchain.go(1 hunks)tx_indexer.example.json(1 hunks)
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-06-10T19:00:10.934Z
Learnt from: webpiratt
Repo: vultisig/verifier PR: 156
File: tx_indexer/chains_list.go:22-37
Timestamp: 2025-06-10T19:00:10.934Z
Learning: The tx_indexer component must have every supported RPC (currently Bitcoin and Ethereum) configured; partial configuration is considered invalid and the application should fail fast if any RPC initialisation fails.
Applied to files:
plugin/tx_indexer/chains_list.goplugin/tx_indexer/pkg/chain/thorchain.gotx_indexer.example.json
📚 Learning: 2025-08-17T04:27:23.578Z
Learnt from: neavra
Repo: vultisig/verifier PR: 316
File: internal/api/plugin.go:26-26
Timestamp: 2025-08-17T04:27:23.578Z
Learning: In the vultisig/verifier project, the migration to vultisig-go/common was selective - only certain utilities (GetQueryParam, GetUUIDParam, IsValidSortField, address derivation, crypto functions) were moved to the shared library. Other functionality like vultisig_validator and SystemMigrations intentionally remained in the original github.com/vultisig/verifier/common package and should not be flagged as stale imports.
Applied to files:
plugin/tx_indexer/chains_list.gogo.mod
📚 Learning: 2025-06-10T18:57:04.359Z
Learnt from: webpiratt
Repo: vultisig/verifier PR: 156
File: internal/api/plugin.go:72-86
Timestamp: 2025-06-10T18:57:04.359Z
Learning: In internal/api/plugin.go (SignPluginMessages), the correct workflow is to persist the transaction via txIndexerService.CreateTx *before* policy evaluation, leaving it in the PROPOSED state; this behavior is intentional and should not be treated as an issue.
Applied to files:
plugin/tx_indexer/pkg/chain/thorchain.gointernal/api/plugin.go
📚 Learning: 2025-06-03T10:33:27.789Z
Learnt from: webpiratt
Repo: vultisig/verifier PR: 105
File: internal/tx_indexer/worker_test.go:0-0
Timestamp: 2025-06-03T10:33:27.789Z
Learning: In integration tests for the tx_indexer package, test data is intentionally not cleaned up after tests finish to allow for manual inspection of database rows. The team considers tests isolated since each test creates its own unique data. Future CI integration may involve using testify.Suite package for better test management.
Applied to files:
plugin/tx_indexer/pkg/chain/thorchain.go
🧬 Code graph analysis (3)
plugin/tx_indexer/pkg/config/config.go (1)
plugin/tx_indexer/pkg/rpc/thorchain.go (1)
THORChain(18-22)
plugin/tx_indexer/chains_list.go (2)
plugin/tx_indexer/pkg/rpc/thorchain.go (2)
THORChain(18-22)NewTHORChain(24-40)plugin/tx_indexer/pkg/chain/thorchain.go (1)
NewTHORChainIndexer(17-21)
plugin/tx_indexer/pkg/rpc/thorchain.go (1)
plugin/tx_indexer/pkg/rpc/types.go (4)
TxOnChainStatus(9-9)TxOnChainFail(14-14)TxOnChainPending(12-12)TxOnChainSuccess(13-13)
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
go.mod(1 hunks)plugin/tx_indexer/pkg/rpc/thorchain.go(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- go.mod
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: webpiratt
Repo: vultisig/verifier PR: 156
File: tx_indexer/chains_list.go:22-37
Timestamp: 2025-06-10T19:00:10.934Z
Learning: The tx_indexer component must have every supported RPC (currently Bitcoin and Ethereum) configured; partial configuration is considered invalid and the application should fail fast if any RPC initialisation fails.
📚 Learning: 2025-06-10T18:57:04.359Z
Learnt from: webpiratt
Repo: vultisig/verifier PR: 156
File: internal/api/plugin.go:72-86
Timestamp: 2025-06-10T18:57:04.359Z
Learning: In internal/api/plugin.go (SignPluginMessages), the correct workflow is to persist the transaction via txIndexerService.CreateTx *before* policy evaluation, leaving it in the PROPOSED state; this behavior is intentional and should not be treated as an issue.
Applied to files:
plugin/tx_indexer/pkg/rpc/thorchain.go
🔇 Additional comments (1)
plugin/tx_indexer/pkg/rpc/thorchain.go (1)
97-98: Response body is correctly closed immediately after reading.This properly addresses the previous review feedback about socket leaks in the retry loop.
Summary by CodeRabbit
New Features
Chores