Conversation
WalkthroughThis change removes the entire address derivation layer and related tests, deletes core common types and utilities, updates imports to use github.com/vultisig/vultisig-go/common, and restructures dependencies in go.mod. No new features were added; primary modifications are deletions and module import/path updates. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Poem
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
cmd/vulticheck/main.go (1)
72-78: Fix potential nil dereference when Evaluate returns an errorIf eng.Evaluate returns an error, matchingRule may be nil; dereferencing it will panic.
Apply this diff:
- matchingRule, err := eng.Evaluate(&policy, common.Chain(*chainID), txBytes) - if err != nil { - log.Printf("Failed to evaluate transaction: %v", err) - } - - log.Printf("Matching rule: %s", matchingRule.GetId()) + matchingRule, err := eng.Evaluate(&policy, common.Chain(*chainID), txBytes) + if err != nil { + log.Printf("Failed to evaluate transaction: %v", err) + } else if matchingRule != nil { + log.Printf("Matching rule: %s", matchingRule.GetId()) + } else { + log.Printf("No matching rule found") + }
🧹 Nitpick comments (9)
engine/engine.go (2)
52-59: Make chain ID comparison robust to case mismatchesTo avoid subtle mismatches between resource path and chain.String(), compare case-insensitively rather than lowercasing only one side.
Apply this diff:
- if resourcePath.ChainId != strings.ToLower(chain.String()) { + if !strings.EqualFold(resourcePath.ChainId, chain.String()) { e.logger.Printf( "Skipping rule %s: target chain %s is not '%s'", rule.GetId(), resourcePath.ChainId, chain.String(), ) continue }
165-167: Remove unreachable branch after nil-guardconfigurationData is set to a non-nil struct on Line 158 if nil, so this nil check is dead code.
Apply this diff:
- if configurationData == nil { - policyJson = emptyJson - }cmd/vulticheck/main.go (1)
20-21: Optional: improve UX for chain flagUsing raw ints for -chain is error-prone. Consider accepting well-known chain names (e.g., "ethereum") and mapping to common.Chain.
I can wire a small map[string]common.Chain and parse the flag accordingly if you want.
engine/evm/evm_test.go (3)
450-454: Don’t ignore error from NativeSymbol()Assert no error to avoid masking failures if the common API changes or returns an error.
Apply this diff:
- native, _ := vgcommon.Ethereum.NativeSymbol() + native, err := vgcommon.Ethereum.NativeSymbol() + if err != nil { + t.Fatalf("Failed to get native symbol: %v", err) + } evm, err := NewEvm(native)
856-860: Repeat: check error from NativeSymbol()Mirror the earlier pattern to avoid silent failures in tests.
Apply this diff:
- native, _ := vgcommon.Ethereum.NativeSymbol() + native, err := vgcommon.Ethereum.NativeSymbol() + if err != nil { + t.Fatalf("Failed to get native symbol: %v", err) + } evm, err := NewEvm(native)
1057-1063: Repeat: check error from NativeSymbol()Keep tests consistent and fail fast on unexpected errors.
Apply this diff:
- native, _ := vgcommon.Ethereum.NativeSymbol() - evm, err := NewEvm(native) + native, err := vgcommon.Ethereum.NativeSymbol() + if err != nil { + t.Fatalf("Failed to get native symbol: %v", err) + } + evm, err := NewEvm(native)go.mod (3)
11-11: Dependency on vultisig-go looks aligned with the migrationPinned to a pseudo-version which is fine for moving targets. Consider tagging a semver once stabilized for downstream consumers.
16-81: Tidy module deps after migrationThere are many indirect entries and dual btcutil module paths present. Running go mod tidy after this migration will simplify the graph and reduce noise.
I can provide a one-off script to run tidy and check for unwanted replaces if your CI environment allows it.
3-3: go directive supports patch versions; no change requiredThe
godirective ingo.modaccepts full Go version strings, including patch releases (e.g.,1.24.2). Language semantics are based on the major.minor “language version” (truncating after the minor).
You can leavego 1.24.2as-is, or—purely for consistency—opt to shorten it togo 1.24.• Location: go.mod (line 3)
• Optional diff:-go 1.24.2 +go 1.24Citations:
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (7)
go.sumis excluded by!**/*.sumtypes/constraint.pb.gois excluded by!**/*.pb.gotypes/parameter_constraint.pb.gois excluded by!**/*.pb.gotypes/policy.pb.gois excluded by!**/*.pb.gotypes/recipe_specification.pb.gois excluded by!**/*.pb.gotypes/resource.pb.gois excluded by!**/*.pb.gotypes/rule.pb.gois excluded by!**/*.pb.go
📒 Files selected for processing (28)
address/address.go(0 hunks)address/address_test.go(0 hunks)address/bch.go(0 hunks)address/bch_test.go(0 hunks)address/bitcoin.go(0 hunks)address/bitcoin_test.go(0 hunks)address/cosmos.go(0 hunks)address/cosmos_test.go(0 hunks)address/dot.go(0 hunks)address/dot_test.go(0 hunks)address/evm.go(0 hunks)address/evm_test.go(0 hunks)address/ltc.go(0 hunks)address/ltc_test.go(0 hunks)address/sol.go(0 hunks)address/sol_test.go(0 hunks)address/ss85.go(0 hunks)address/sui.go(0 hunks)address/sui_test.go(0 hunks)address/xrp.go(0 hunks)address/xrp_test.go(0 hunks)cmd/vulticheck/main.go(1 hunks)common/chain.go(0 hunks)common/utils.go(0 hunks)engine/engine.go(1 hunks)engine/engine_test.go(1 hunks)engine/evm/evm_test.go(6 hunks)go.mod(1 hunks)
💤 Files with no reviewable changes (23)
- address/evm_test.go
- address/sol.go
- address/sol_test.go
- address/sui.go
- address/ltc.go
- address/cosmos.go
- address/bitcoin.go
- address/xrp_test.go
- address/dot.go
- address/bitcoin_test.go
- address/ltc_test.go
- address/bch_test.go
- address/xrp.go
- address/dot_test.go
- address/ss85.go
- address/sui_test.go
- address/bch.go
- address/cosmos_test.go
- address/evm.go
- address/address.go
- common/utils.go
- common/chain.go
- address/address_test.go
🔇 Additional comments (7)
engine/engine.go (2)
15-15: Import path migration to vultisig-go/common looks correctThe switch to github.com/vultisig/vultisig-go/common is consistent with the PR objective and aligns with the rest of the repo changes.
201-208: SupportedTypes is a single enum, not a list — no change needed
TheSupportedTypesfield is defined as a singularConstraintType(notrepeated), andGetSupportedTypes()returns that enum value. The existing equality check correctly verifies support; a membership loop is unnecessary.Likely an incorrect or invalid review comment.
cmd/vulticheck/main.go (1)
9-9: Import path migration to vultisig-go/common looks correctMatches the engine changes and PR goals.
engine/engine_test.go (1)
14-14: Tests updated to new common import path — looks goodThe switch to github.com/vultisig/vultisig-go/common aligns with production code.
engine/evm/evm_test.go (3)
16-16: Import alias change to vgcommon is correctReferences resolve cleanly and are consistent with the migration.
474-477: LGTM: error check present hereThis instance correctly checks the error from NativeSymbol().
1079-1082: LGTM: error check present hereThis test also correctly checks the error from NativeSymbol().
Overview
This PR removes duplicated code from the recipes repository and migrates to use the new
vultisig-goshared library for address derivation, vault encryption, common utilities, and type definitions.Note: This change is part of a larger effort to move these packages into a common repo (vultisig-go). Since both verifier and plugin currently has code affected by the change imported from recipes, recipes need to be merged first, followed by verifier and then plugin (see draft pr below). After this PR is merged, the recipes version need to be bumped in both verifier and plugin, before those changes can be merged.
📋 Changes
Removed Packages
recipes/address/- Migrated tovultisig-go/addressrecipes/common/- Migrated tovultisig-go/commonandvultisig-go/cryptorecipes/types/vault.go- Migrated tovultisig-go/typesUpdated Imports
Before:
After:
🔗 Related PRs
Summary by CodeRabbit