Skip to content
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

feat: spl withdraw and call #3520

Merged
merged 20 commits into from
Feb 14, 2025
Merged

feat: spl withdraw and call #3520

merged 20 commits into from
Feb 14, 2025

Conversation

skosito
Copy link
Contributor

@skosito skosito commented Feb 11, 2025

Description

solana PR: zeta-chain/protocol-contracts-solana#77

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

  • New Features

    • Introduced SPL withdraw-and-call integration to enhance token operations.
    • Added support for multi-value confirmations for improved transaction reliability.
    • Expanded blockchain processing for both SOL and SPL tokens, with new messaging capabilities.
  • Bug Fixes

    • Resolved issues with duplicate event handling and confirmation processing.
    • Addressed transaction spam and end-to-end testing failures.
  • Refactor & Tests

    • Streamlined deployment and execution workflows.
    • Expanded test coverage for SPL token operations.

Copy link
Contributor

coderabbitai bot commented Feb 11, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

This pull request integrates SPL token withdrawal and call functionality into the system. It introduces new fields and enumerations (e.g., ConfirmationParams and ConfirmationMode), refactors existing components (including Bitcoin and EVM observers), and enhances end-to-end testing scenarios for Solana-based transactions. Additionally, the changes update Docker configurations and dependency versions, modify PDA address computations, and add new methods for constructing and signing SPL-related transactions, thereby streamlining SPL token operations and improving overall code reliability.

Changes

Files Change Summary
changelog.md Updated changelog with new feature "SPL withdraw and call integration", added new field ConfirmationParams, deprecated confirmation_count, introduced ConfirmationMode enum, new command track-cctx, and new message MsgRemoveInboundTracker.
cmd/zetae2e/local/local.go Added a new test case (e2etests.TestSPLWithdrawAndCallName) to the Solana tests suite in the local E2E test function.
contrib/localnet/solana/Dockerfile Removed default ENTRYPOINT and CMD instructions.
contrib/localnet/solana/connected_spl-keypair.json Introduced a new JSON configuration file containing a 64-integer keypair for Solana SPL programs.
contrib/localnet/solana/start-solana.sh Added a command to deploy the connected_spl.so program during the local Solana setup.
e2e/e2etests/e2etests.go Added new test case TestSPLWithdrawAndCallName for SPL withdrawal functionality and updated default deposit value in TestSPLDepositName from "12000000" to "24000000".
e2e/e2etests/test_solana_withdraw_and_call.go Replaced a hardcoded connected program public key with the reference to runner.ConnectedProgramID in the TestSolanaWithdrawAndCall function.
e2e/e2etests/test_spl_withdraw_and_call.go Introduced a new end-to-end test validating SPL token withdrawal and call functionality, including balance checks and PDA validations.
e2e/runner/setup_solana.go Extended the SetupSolana method to initialize a connected SPL program by computing its PDA and broadcasting the initialization transaction.
e2e/runner/solana.go Added a new variable ConnectedSPLProgramID and a method WithdrawAndCallSPLZRC20 to handle SPL token withdrawal and call operations.
go.mod Updated the version for github.com/zeta-chain/protocol-contracts-solana/go-idl dependency.
pkg/contracts/solana/gateway.go Added new constant DiscriminatorExecuteSPL, refactored PDA address computation by introducing ComputePdaAddress, and added ComputeConnectedSPLPdaAddress for SPL-specific PDA computation.
pkg/contracts/solana/gateway.json Added a new instruction execute_spl_token with corresponding arguments and account definitions for handling SPL token operations.
pkg/contracts/solana/gateway_message.go Added new constant InstructionExecuteSPL and introduced the MsgExecuteSPL struct along with associated methods to encapsulate SPL token execution messages.
pkg/contracts/solana/instruction.go Added new types WithdrawSPLInstructionParams and ExecuteSPLInstructionParams with their respective parsing functions to support SPL token operations.
zetaclient/chains/solana/observer/outbound.go Updated the ParseGatewayInstruction function to enhance error handling for the coin.CoinType_ERC20 case by attempting alternative parsing methods.
zetaclient/chains/solana/signer/execute_spl.go Introduced new methods createAndSignMsgExecuteSPL and signExecuteSPLTx for constructing and signing messages related to SPL token execution.
zetaclient/chains/solana/signer/signer.go Modified the TryProcessOutbound method to differentiate between cross-chain calls and standard withdrawals, and added the new helper method prepareExecuteSPLTx for handling SPL execution transactions.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant Signer
    participant SolanaChain
    participant SPLProgram

    Client->>Signer: Request SPL Withdraw & Call Transaction
    Signer->>Signer: Validate parameters & construct message (WithdrawAndCallSPLZRC20)
    Signer->>SolanaChain: Submit signed transaction
    SolanaChain->>SPLProgram: Execute SPL token instruction
    SPLProgram-->>SolanaChain: Provide transaction confirmation and update balances
    SolanaChain-->>Signer: Transaction confirmation details
    Signer-->>Client: Return transaction status and details
Loading
sequenceDiagram
    participant OutboundObserver
    participant Contracts
    participant Signer

    OutboundObserver->>Contracts: ParseInstructionWithdrawSPL for ERC20 transaction
    alt Parsing Fails
        Contracts->>Contracts: Execute ParseInstructionExecuteSPL alternative
    end
    Contracts-->>OutboundObserver: Return parsed instruction object
    OutboundObserver-->>Signer: Forward instruction for processing
Loading

Possibly related PRs

Suggested reviewers

  • swift1337
  • ws4charlie

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

!!!WARNING!!!
nosec detected in the following files: zetaclient/chains/solana/signer/execute_spl.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203
Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

@github-actions github-actions bot added the nosec label Feb 11, 2025
Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 0% with 198 lines in your changes missing coverage. Please review.

Project coverage is 64.83%. Comparing base (51a4465) to head (ea8d49d).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/solana/signer/execute_spl.go 0.00% 118 Missing ⚠️
zetaclient/chains/solana/signer/signer.go 0.00% 71 Missing ⚠️
zetaclient/chains/solana/observer/outbound.go 0.00% 5 Missing ⚠️
zetaclient/chains/solana/signer/execute.go 0.00% 1 Missing ⚠️
zetaclient/chains/solana/signer/whitelist.go 0.00% 1 Missing ⚠️
zetaclient/chains/solana/signer/withdraw.go 0.00% 1 Missing ⚠️
zetaclient/chains/solana/signer/withdraw_spl.go 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3520      +/-   ##
===========================================
- Coverage    65.22%   64.83%   -0.40%     
===========================================
  Files          453      454       +1     
  Lines        30967    31154     +187     
===========================================
  Hits         20199    20199              
- Misses        9903    10090     +187     
  Partials       865      865              
Files with missing lines Coverage Δ
zetaclient/chains/solana/signer/execute.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/signer/whitelist.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/signer/withdraw.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/signer/withdraw_spl.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/observer/outbound.go 31.81% <0.00%> (-0.59%) ⬇️
zetaclient/chains/solana/signer/signer.go 13.91% <0.00%> (-2.87%) ⬇️
zetaclient/chains/solana/signer/execute_spl.go 0.00% <0.00%> (ø)

@skosito skosito added the SOLANA_TESTS Run make start-solana-test label Feb 11, 2025
@skosito skosito marked this pull request as ready for review February 13, 2025 14:48
@skosito skosito requested a review from a team as a code owner February 13, 2025 14:48
Copy link
Contributor

@swift1337 swift1337 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but I'd ask for @brewmaster012's review

Base automatically changed from sol-withdraw-and-call to develop February 13, 2025 18:28
@skosito skosito requested a review from lumtis February 13, 2025 18:46
@skosito skosito requested a review from ws4charlie February 13, 2025 18:46
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (13)
zetaclient/chains/solana/signer/execute_spl.go (2)

16-27: Clarify function documentation regarding the cancelTx parameter.
While the docstring states this function creates and signs an SPL message, it would be beneficial to explicitly mention that cancelTx zeroes out the withdrawal amount to abort the transaction.


34-37: Consider introducing an informational log when cancelTx is triggered.
Currently, if cancelTx is true, the amount is silently zeroed. Logging or explicitly returning a message could help troubleshoot or audit canceled transactions.

pkg/contracts/solana/gateway_message.go (1)

16-16: Extend testing coverage for the new instruction identifier.
Adding a unit test that ensures InstructionExecuteSPL is handled correctly can prevent future regressions.

e2e/e2etests/test_solana_withdraw_and_call.go (1)

48-58: Leverage parameterization for test data.
Currently, the test hardcodes "hello" in WithdrawAndCallSOLZRC20. To broaden coverage, passing various messages (e.g., large or non-ASCII) would validate different edge cases.

e2e/e2etests/test_spl_withdraw_and_call.go (3)

33-34: Consider improving error message for insufficient balance.

The error message could be more descriptive to help with debugging.

-require.Equal(r, 1, zrc20BalanceBefore.Cmp(withdrawAmount), "Insufficient balance for withdrawal")
+require.Equal(r, 1, zrc20BalanceBefore.Cmp(withdrawAmount), 
+  "Insufficient balance for withdrawal: have %v, need %v", zrc20BalanceBefore, withdrawAmount)

35-43: Consider using constants for magic numbers.

The approval amount of 1 SOL could be defined as a constant at the package level.

+const (
+    // MaxApprovedWithdrawalAmount represents the maximum amount that can be withdrawn (1 SOL)
+    MaxApprovedWithdrawalAmount = solana.LAMPORTS_PER_SOL
+)

-approvedAmount := new(big.Int).SetUint64(solana.LAMPORTS_PER_SOL)
+approvedAmount := new(big.Int).SetUint64(MaxApprovedWithdrawalAmount)

83-90: Consider using a dedicated package for Solana-specific types.

The ConnectedPdaInfo struct could be moved to a dedicated package for better organization.

Consider moving this struct to pkg/contracts/solana/types.go.

e2e/runner/setup_solana.go (1)

97-122: Consider extracting common initialization logic.

The initialization code for connected and connected SPL programs follows the same pattern. Consider extracting the common logic into a helper function.

+func (r *E2ERunner) initializeProgram(
+    privkey solana.PrivateKey,
+    programID solana.PublicKey,
+    pda solana.PublicKey,
+    discriminator [8]byte,
+) error {
+    var inst solana.GenericInstruction
+    accountSlice := []*solana.AccountMeta{
+        solana.Meta(privkey.PublicKey()).WRITE().SIGNER(),
+        solana.Meta(pda).WRITE(),
+        solana.Meta(solana.SystemProgramID),
+    }
+    inst.ProgID = programID
+    inst.AccountValues = accountSlice
+
+    type InitializeParams struct {
+        Discriminator [8]byte
+    }
+    var err error
+    inst.DataBytes, err = borsh.Serialize(InitializeParams{
+        Discriminator: discriminator,
+    })
+    if err != nil {
+        return err
+    }
+
+    signedTx := r.CreateSignedTransaction([]solana.Instruction{&inst}, privkey, []solana.PrivateKey{})
+    _, out := r.BroadcastTxSync(signedTx)
+    r.Logger.Info("initialize program logs: %v", out.Meta.LogMessages)
+    return nil
+}
pkg/contracts/solana/instruction.go (1)

283-310: Fix incorrect comment for the amount field.

The comment for the amount field incorrectly refers to "withdraw" instead of "execute".

-	// Amount is the lamports amount for the withdraw
+	// Amount is the lamports amount for the execute
zetaclient/chains/solana/signer/signer.go (1)

412-482: Enhance error handling with wrapped errors.

The error handling could be improved by wrapping errors with context using errors.Wrap or errors.Wrapf, similar to other functions in the codebase.

 	// get mint details to get decimals
 	mint, err := signer.decodeMintAccountDetails(ctx, cctx.InboundParams.Asset)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrap(err, "decodeMintAccountDetails error")
 	}

 	message, err := hex.DecodeString(cctx.RelayedMessage)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrapf(err, "decodeString %s error", cctx.RelayedMessage)
 	}
 	msg, err := contracts.DecodeExecuteMsg(message)
 	if err != nil {
-		return nil, err
+		return nil, errors.Wrapf(err, "decodeExecuteMsg %s error", cctx.RelayedMessage)
 	}
e2e/runner/solana.go (2)

602-602: Address TODO comment about gas limit.

The gas limit calculation needs to be determined and implemented.

Would you like me to help determine an appropriate gas limit calculation for this operation?


24-25: Consider making program IDs configurable.

Hard-coded program IDs should be moved to configuration to support different environments.

Consider:

  1. Moving these to a configuration struct
  2. Passing them through constructor or setup methods
  3. Supporting environment-specific values
changelog.md (1)

13-13: Fix markdown formatting for URL.

The URL should be properly formatted as a markdown link.

Apply this diff to fix the markdown formatting:

-* [3520] (https://github.com/zeta-chain/node/pull/3520) - SPL withdraw and call integration
+* [3520](https://github.com/zeta-chain/node/pull/3520) - SPL withdraw and call integration
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

13-13: Bare URL used
null

(MD034, no-bare-urls)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 51a4465 and 85cb448.

⛔ Files ignored due to path filters (3)
  • contrib/localnet/solana/connected_spl.so is excluded by !**/*.so
  • contrib/localnet/solana/gateway.so is excluded by !**/*.so
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (18)
  • changelog.md (1 hunks)
  • cmd/zetae2e/local/local.go (1 hunks)
  • contrib/localnet/solana/Dockerfile (0 hunks)
  • contrib/localnet/solana/connected_spl-keypair.json (1 hunks)
  • contrib/localnet/solana/start-solana.sh (1 hunks)
  • e2e/e2etests/e2etests.go (3 hunks)
  • e2e/e2etests/test_solana_withdraw_and_call.go (2 hunks)
  • e2e/e2etests/test_spl_withdraw_and_call.go (1 hunks)
  • e2e/runner/setup_solana.go (1 hunks)
  • e2e/runner/solana.go (2 hunks)
  • go.mod (1 hunks)
  • pkg/contracts/solana/gateway.go (2 hunks)
  • pkg/contracts/solana/gateway.json (1 hunks)
  • pkg/contracts/solana/gateway_message.go (3 hunks)
  • pkg/contracts/solana/instruction.go (2 hunks)
  • zetaclient/chains/solana/observer/outbound.go (1 hunks)
  • zetaclient/chains/solana/signer/execute_spl.go (1 hunks)
  • zetaclient/chains/solana/signer/signer.go (2 hunks)
💤 Files with no reviewable changes (1)
  • contrib/localnet/solana/Dockerfile
✅ Files skipped from review due to trivial changes (1)
  • contrib/localnet/solana/connected_spl-keypair.json
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.go`: Review the Go code, point out issues relative to ...

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • zetaclient/chains/solana/observer/outbound.go
  • cmd/zetae2e/local/local.go
  • e2e/e2etests/test_solana_withdraw_and_call.go
  • e2e/runner/solana.go
  • e2e/e2etests/test_spl_withdraw_and_call.go
  • e2e/runner/setup_solana.go
  • zetaclient/chains/solana/signer/signer.go
  • e2e/e2etests/e2etests.go
  • pkg/contracts/solana/instruction.go
  • zetaclient/chains/solana/signer/execute_spl.go
  • pkg/contracts/solana/gateway.go
  • pkg/contracts/solana/gateway_message.go
`**/*.sh`: Review the shell scripts, point out issues relati...

**/*.sh: Review the shell scripts, point out issues relative to security, performance, and maintainability.

  • contrib/localnet/solana/start-solana.sh
🪛 markdownlint-cli2 (0.17.2)
changelog.md

13-13: Bare URL used
null

(MD034, no-bare-urls)

⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-zetanode
  • GitHub Check: lint
  • GitHub Check: build-and-test
  • GitHub Check: gosec
  • GitHub Check: build
  • GitHub Check: Analyze (go)
🔇 Additional comments (17)
zetaclient/chains/solana/signer/execute_spl.go (2)

79-81: Use consistent casing for the key-sign error message.
A previous review recommended adjusting the message to lowercase for stylistic consistency.


88-171: Confirm the necessity of including all token attributes in the transaction hash.
The current approach excludes certain fields (e.g., the relayer's or TSS's public key) from the message hash. Verify if this is intentional to preserve the correct signer context and prevent replay attacks.

pkg/contracts/solana/gateway_message.go (1)

222-223: Validate critical fields in MsgExecute's hashing logic.
It omits the sender from the hash, which might permit replay if the sender is not otherwise validated. Ensure this aligns with your security model.

pkg/contracts/solana/gateway.go (3)

45-46: LGTM!

The new discriminator constant for SPL token execution is well-documented and follows the established pattern.


72-80: LGTM!

The ComputePdaAddress function provides a flexible and reusable way to compute PDA addresses with custom seeds.


82-85: LGTM!

The refactored functions ComputeConnectedPdaAddress and ComputeConnectedSPLPdaAddress effectively utilize the new generic ComputePdaAddress function, promoting code reuse.

Also applies to: 87-90

e2e/e2etests/test_spl_withdraw_and_call.go (1)

19-23: LGTM!

The function documentation clearly explains the test's purpose and expected behavior.

zetaclient/chains/solana/observer/outbound.go (1)

316-321: LGTM!

The error handling for SPL token instructions follows the same pattern as gas token instructions, maintaining consistency in the codebase.

pkg/contracts/solana/instruction.go (1)

219-242: LGTM! Well-structured instruction parameters.

The struct follows the established pattern and correctly implements the OutboundInstruction interface.

cmd/zetae2e/local/local.go (1)

416-416: LGTM! Test case addition.

The new test case follows the established pattern for Solana tests.

e2e/runner/solana.go (1)

558-621: LGTM! Well-structured implementation.

The function follows the established pattern and correctly handles token approvals, message encoding, and transaction execution.

e2e/e2etests/e2etests.go (1)

61-61: LGTM! New test constant follows naming convention.

The new test constant TestSPLWithdrawAndCallName is well-defined and follows the established naming pattern.

contrib/localnet/solana/start-solana.sh (1)

16-16: LGTM! Program deployment follows existing pattern.

The deployment of connected_spl.so is correctly placed after related program deployments.

go.mod (1)

314-314:

✅ Verification successful

Verify compatibility with the new go-idl version.

The update to protocol-contracts-solana/go-idl (v0.0.0-20250211174435-9680e27af84a) supports the new SPL functionality. Ensure all dependent packages are compatible with this version.


🏁 Script executed:

#!/bin/bash
# Check for any version conflicts or breaking changes
go mod tidy
go mod verify

Length of output: 23918


Compatibility Verified: Updated go-idl Dependency

The update to github.com/zeta-chain/protocol-contracts-solana/go-idl (v0.0.0-20250211174435-9680e27af84a) has been validated for compatibility. Running go mod tidy and go mod verify produced no conflicts or errors, confirming that all dependent packages are compatible with the new SPL functionality support.

pkg/contracts/solana/gateway.json (2)

533-687: LGTM! Well-structured SPL token execution instruction.

The execute_spl_token instruction is well-documented and follows the established pattern:

  • Comprehensive documentation with clear argument descriptions
  • Proper account definitions with appropriate write permissions
  • Unique discriminator
  • Complete set of required arguments including security parameters

588-593:

❓ Verification inconclusive

Verify ATA account initialization.

Ensure that the pda_ata and destination_program_pda_ata accounts are properly initialized before token transfers. Consider adding a check in the instruction to verify the accounts exist.

Also applies to: 610-615


🏁 Script executed:

#!/bin/bash
# Search for ATA initialization patterns in the codebase
ast-grep --pattern 'create_associated_token_account($$$)'

Length of output: 59


Action Required: Confirm ATA Account Initialization

Please verify that both the pda_ata and destination_program_pda_ata accounts are fully initialized prior to any token transfer operations. Our initial check using the AST pattern for create_associated_token_account($$$) did not return any evidence of such initialization. This uncertainty applies to the asset definitions in the JSON (lines 588–593 and 610–615).

  • Manually confirm whether the associated token account creation is handled elsewhere, or if explicit checks (or instruction logic) are required to ensure the accounts exist before token transfers.
  • If initialization is handled in a different part of the codebase (or via off-chain flows), add a comment or documentation reference to clarify this process.
  • Consider updating the logic to include an explicit check if no prior initialization guarantees exist.
changelog.md (1)

1-892: LGTM! Well-structured changelog.

The changelog follows best practices with:

  • Clear version sections
  • Organized subsections (Features, Fixes, Refactors, etc.)
  • PR links and descriptions
  • Breaking changes clearly highlighted
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

13-13: Bare URL used
null

(MD034, no-bare-urls)


162-162: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


166-166: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


168-168: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


174-174: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


176-176: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


178-178: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


179-179: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


183-183: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


185-185: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


189-189: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


191-191: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


599-599: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


601-601: Bare URL used
null

(MD034, no-bare-urls)


646-646: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


702-702: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall looks good.

@skosito
Copy link
Contributor Author

skosito commented Feb 14, 2025

@brewmaster012 i will merge this PR just so its not long lived, but if you spot something we can just fix it afterwards, please let me know

also, most of the important points we are already discussing on solana repo PRs, so this is ok to merge imo

@skosito skosito added this pull request to the merge queue Feb 14, 2025
Merged via the queue into develop with commit 9b2b4ad Feb 14, 2025
44 of 45 checks passed
@skosito skosito deleted the spl-withdraw-and-call branch February 14, 2025 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking:cli nosec SOLANA_TESTS Run make start-solana-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants