-
Notifications
You must be signed in to change notification settings - Fork 20
fix: remove unused imports in starknet client for cleaner code #630
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis change reorganizes seed generation responsibility in the account derivation flow. The system now generates a cryptographically secure random seed in the receive_address service before deriving the Starknet account, rather than relying on automatic seed generation within the client. The starknet client now requires explicit seeds, and voyager RPC event formatting corrects field naming from singular to plural "topics". Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (5 warnings)
✨ Finishing touches
🧪 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 |
There was a problem hiding this 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 (2)
utils/crypto/crypto.go (1)
328-336: LGTM - Proper cryptographic seed generation.The implementation correctly uses
crypto/randfor secure randomness with appropriate entropy (256 bits). Minor nit: the comment says "generateSecureSeed" (lowercase) while the function is exported asGenerateSecureSeed.🔎 Optional: Fix comment casing
-// generateSecureSeed generates a cryptographically secure random seed +// GenerateSecureSeed generates a cryptographically secure random seed func GenerateSecureSeed() (string, error) {services/receive_address.go (1)
54-71: Misleading variable naming:saltEncryptedstores the seed with suffix, not the salt.The encrypted value stores
seed + "-paycrest", which is the input used to derive the salt (via SHA256 inGenerateDeterministicAccount), not the salt itself. The actual salt isSHA256(seed + "-paycrest"). To reconstruct the account later, code must decrypt the value, strip the-paycrestsuffix, and pass the raw seed back toGenerateDeterministicAccount(as done inservices/order/starknet.go:95).Consider renaming for clarity:
seedWithSuffix→seedForStorage(more descriptive of purpose)saltEncrypted→seedEncrypted(accurately reflects contents)- Error message: update
"failed to encrypt salt"to"failed to encrypt seed"This eliminates the misleading naming and reduces the cognitive load for developers maintaining code that decrypts and uses this value.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
services/receive_address.go(1 hunks)services/starknet/client.go(1 hunks)services/voyager.go(2 hunks)utils/crypto/crypto.go(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
services/voyager.go (1)
utils/rpc_events.go (1)
TransferStarknetSelector(20-20)
services/receive_address.go (1)
utils/crypto/crypto.go (3)
GenerateSecureSeed(329-336)EncryptPlain(40-62)NormalizeStarknetAddress(313-325)
⏰ 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: build-and-test
🔇 Additional comments (3)
services/voyager.go (2)
1090-1090: LGTM - Field name aligns with RPC event format.The rename from
"topic"to"topics"is consistent with the event format used inservices/starknet/client.go(seehandleOrderCreated,handleOrderSettled, etc.), ensuring transformed Voyager events are compatible with the same processing logic.
1241-1241: Consistent with transfer event transformation.Same field name correction applied here, maintaining consistency across both transformation functions.
services/starknet/client.go (1)
566-569: Good enforcement of explicit seed requirement.Making the seed parameter mandatory with a clear error message is cleaner than implicit seed generation. Callers now use
cryptoUtils.GenerateSecureSeed()explicitly, which improves traceability and testability.
Description
References
Testing
Checklist
mainBy submitting a PR, I agree to Paycrest's Contributor Code of Conduct and Contribution Guide.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.