-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Create rust.mdc #129
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
Create rust.mdc #129
Conversation
WalkthroughA new documentation file, Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
✨ 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.
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 (5)
rules-new/rust.mdc (5)
17-19: Fix typo in constraint-macro example
bump]is missing its opening bracket and is not wrapped inside the#[account(...)]attribute, which may confuse readers unfamiliar with Anchor syntax.- - Validate accounts strictly using constraint macros (e.g., `#[account(mut)]`, `seeds`, `bump]`) + - Validate accounts strictly using constraint macros, e.g. + ```rust + #[account( + mut, + seeds = [b"seed", authority.key().as_ref()], + bump + )] + ```
24-28: Clarify packed-layout adviceYou recommend both
#[repr(C)]here and#[repr(packed)]later (line 57). These have different guarantees; mixing them may mislead newcomers.Consider collapsing into a single bullet such as:
- Always include `#[account(zero_copy)]` or `#[repr(C)]` for packed structures + For zero-copy accounts, combine + `#[account(zero_copy)]` with `#[repr(packed)]` (or `#[repr(C)]` when explicit padding is acceptable) to guarantee a deterministic on-chain layout.
30-36: Update log-message access pathAnchor’s confirmed transaction object exposes logs under
tx.meta.logMessages, nottx.confirmation.logMessages.- Validate program logs using `tx.confirmation.logMessages` + Validate program logs using `tx.meta.logMessages`
45-47: Remove Ethereum terminology
msg.senderis an Ethereum concept and may confuse Solana readers.- Always validate `msg.sender`/signer with `account_info.is_signer` + Always validate the signer with `account_info.is_signer`
74-77: Align provider variable name with Anchor examplesMost Anchor TS examples use
provider.wallet.publicKey;anchorProviderisn’t standard and could cause friction when readers copy/paste.- Use `anchorProvider.wallet.publicKey` for signer verification in tests + Use `provider.wallet.publicKey` for signer verification in tests
|
I pushed a fix in commit 8cabeb1, please review it. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chainI'll examine the file you've added to provide a proper review of your Rust Solana development guidelines. 🏁 Script executed: Length of output: 4267 @z3roai Thank you for adding this comprehensive Rust + Solana development guidelines document! I've reviewed the ✅ StrengthsComprehensive Coverage: The document covers all essential aspects of Solana development from program structure to CI/CD, making it a valuable resource for developers. Technical Accuracy: The recommendations align with current best practices:
Well-Organized Structure: The use of emoji icons and clear sections makes the guidelines easily scannable and developer-friendly. Practical Examples: Each section provides actionable advice rather than abstract concepts, which is perfect for cursor rules. 📝 Minor SuggestionsThe content is solid overall. Just a couple of small observations:
The document successfully fills a gap in the repository by providing specialized guidance for the growing Solana ecosystem. The technical depth and practical focus make it a valuable resource for developers working with Rust and Anchor. Recommendation: ✅ Approve - This is a high-quality addition that enhances the repository's coverage of blockchain development environments. |
|
I pushed a fix in commit 7028157, please review it. |
This PR adds a .cursorrules config for Rust-based Solana smart contract development using the Anchor framework.
Summary by CodeRabbit