refactor(chain): return named parameter structs from tBTC getters - #4188
Open
piotr-roslaniec wants to merge 1 commit into
Open
refactor(chain): return named parameter structs from tBTC getters#4188piotr-roslaniec wants to merge 1 commit into
piotr-roslaniec wants to merge 1 commit into
Conversation
The on-chain parameter getters returned wide positional tuples (up to 11 values plus err) that callers destructured with long blank-identifier lists, where a positional slip would compile silently. Replace them with named structs (MovingFundsParameters, WalletParameters, DepositParameters, RedemptionParameters) in pkg/tbtc so callers access fields by name. GetMovingFundsParameters lives on tbtc.BridgeChain (embedded by tbtcpg.Chain); the other three on tbtcpg.Chain. All structs live in pkg/tbtc, which the ethereum adapter and tbtcpg already import.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (11)
📝 WalkthroughWalkthroughTBTC parameter getters now return shared structs for deposit, redemption, wallet, and moving-funds settings. Interfaces, Ethereum and local implementations, validation logic, and fee-estimation consumers are updated to use the new struct fields. ChangesTBTC parameter consolidation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
lrsaturnino
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The on-chain tBTC parameter getters returned wide positional tuples that
callers destructured with long blank-identifier lists. For example:
GetMovingFundsParametersreturned 11 values pluserr. Because many of thevalues share a type, a positional slip in one of these lists compiles cleanly
and fails silently at runtime.
This replaces the wide tuples with named structs in
pkg/tbtc, so callersaccess fields by name:
Changes
pkg/tbtc/parameters.godefiningMovingFundsParameters,WalletParameters,DepositParameters,RedemptionParameters.GetMovingFundsParameters(ontbtc.BridgeChain, embedded bytbtcpg.Chain)and the three others (on
tbtcpg.Chain) now return the corresponding struct.pkg/tbtc, which both the ethereum adapter andtbtcpgalready import, so no new dependency edges are introduced.
declarations in
pkg/tbtc/moving_funds.go, both local test chains (which getsimpler — their internal struct aliases are dropped), and all call sites.
Net: the diff removes more than it adds; the change is a simplification.
Notes for review
original tuple order, and the
tbtcpgtests discriminate a wrong-but-same-typed field pick (e.g.
moved_funds_sweepsetsTxMaxTotalFeeto 0 butSweepTxMaxTotalFeeto a non-zero value).pkg/tbtc's test-onlylocalChain.GetWalletParametersis left as the oldwide-tuple
panic("unsupported")stub. It satisfies notbtcinterface (onlytbtcpg.ChaindeclaresGetWalletParameters), so it is dead in thetbtcpackage and was left untouched to keep the change surgical.
Verification
go build ./...andgo vet ./...clean.pkg/tbtc,pkg/tbtcpg, andpkg/chain/ethereumtest suites pass.Summary by CodeRabbit
New Features
Refactor