Skip to content

feat: (PRO-263) Add transfer hook example and related infrastructure#213

Merged
dev-jodee merged 4 commits intomainfrom
feat/pro-263-transfer-hook-testing
Sep 2, 2025
Merged

feat: (PRO-263) Add transfer hook example and related infrastructure#213
dev-jodee merged 4 commits intomainfrom
feat/pro-263-transfer-hook-testing

Conversation

@dev-jodee
Copy link
Copy Markdown
Contributor

@dev-jodee dev-jodee commented Sep 2, 2025

  • Introduced a new transfer hook example program with build scripts and configuration.
  • Updated Makefile to include a target for building the transfer hook program.
  • Added constants and keypair paths for the transfer hook mint.
  • Enhanced testing utilities to support transfer hook functionality, including mint creation and transaction simulation.
  • Updated dependencies to include spl-transfer-hook-interface for transfer hook operations.
  • Added tests to validate transfer hook behavior, including allowed and blocked transfers.

Important

Add transfer hook example program with build and test infrastructure, including new tests for allowed and blocked transfers.

  • Behavior:
    • Add transfer hook example program with build scripts in tests/src/common/transfer-hook-example.
    • Update Makefile to include build-transfer-hook target for building the transfer hook program.
    • Enhance testing utilities in extension_helpers.rs to support transfer hook functionality, including mint creation and transaction simulation.
    • Add tests in token_2022_extensions_test.rs to validate transfer hook behavior, including allowed and blocked transfers.
  • Dependencies:
    • Update dependencies in Cargo.toml and Cargo.lock to include spl-transfer-hook-interface for transfer hook operations.
  • Misc:
    • Add constants and keypair paths for the transfer hook mint in constants.rs.
    • Minor updates to setup-solana-validator to load transfer hook program.

This description was created by Ellipsis for 97cd81b. You can customize this summary. It will automatically update as commits are pushed.

📊 Test Coverage

Coverage

Coverage: 86.3%

View Detailed Coverage Report

- Introduced a new transfer hook example program with build scripts and configuration.
- Updated Makefile to include a target for building the transfer hook program.
- Added constants and keypair paths for the transfer hook mint.
- Enhanced testing utilities to support transfer hook functionality, including mint creation and transaction simulation.
- Updated dependencies to include `spl-transfer-hook-interface` for transfer hook operations.
- Added tests to validate transfer hook behavior, including allowed and blocked transfers.
@dev-jodee dev-jodee requested a review from amilz September 2, 2025 17:38
@linear
Copy link
Copy Markdown

linear bot commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 90d0ddb in 1 minute and 16 seconds. Click for details.
  • Reviewed 3311 lines of code in 17 files
  • Skipped 1 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. tests/tokens/token_2022_extensions_test.rs:40
  • Draft comment:
    Duplicate ATA creation instructions: Two nearly identical calls are used to create the fee payer ATA. Consider consolidating or clarifying distinct purposes if any.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. tests/tokens/token_2022_extensions_test.rs:107
  • Draft comment:
    Good use of error assertions for blocked extensions. Ensure error messages are consistent with backend responses (e.g. 'Custom(1)' vs 'custom program error: 0x1').
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. tests/tokens/token_2022_extensions_test.rs:296
  • Draft comment:
    Clarify units and comments in transfer fee tests. The comments mix USDC decimals and micro-units. A more explicit description of unit conversion would improve clarity.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
4. tests/tokens/token_2022_extensions_test.rs:441
  • Draft comment:
    Tests for transfer hook behavior are comprehensive. Consider adding inline comments for each step to document which account serves which role (e.g., extra account meta list vs. hook program account) for future maintainers.
  • Reason this comment was not posted:
    Confidence changes required: 20% <= threshold 50% None

Workflow ID: wflow_SaPuEQhPCZVUengG

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed e3f1405 in 43 seconds. Click for details.
  • Reviewed 16 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/workflows/rust.yml:80
  • Draft comment:
    Ensure the 'build-transfer-hook' target exists in the Makefile. Consider adding error handling or logging if the build fails.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_QpFhQsj5NLB9n4Cp

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 3f68637 in 1 minute and 23 seconds. Click for details.
  • Reviewed 77 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. .github/actions/setup-solana-validator/action.yml:29
  • Draft comment:
    Consider parameterizing the transfer hook program path and ID to avoid hard-coded values and potential relative path issues.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The suggestion is reasonable since hardcoded values and relative paths can be problematic. However, this is a test validator setup in a GitHub Action, likely used specifically for testing this particular transfer hook program. The values may be intentionally fixed for the test environment. Without more context about how this action is used across different scenarios, suggesting parameterization could add unnecessary complexity. I might be underestimating the reusability needs of this GitHub Action. Other users might want to load different programs or use different program IDs. While the action could be made more generic, the current implementation seems purposefully specific to testing a particular transfer hook program. Making it more generic would be a feature request rather than a clear code issue. The comment should be deleted as it suggests a potential enhancement rather than pointing out a clear code issue that needs to be fixed.
2. .github/actions/setup-solana-validator/action.yml:34
  • Draft comment:
    Ensure the background validator process is reliably terminated; consider adding signal traps or a cleanup step to avoid orphan processes.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_lQBn2n8BQljvpipN

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 97cd81b in 1 minute and 14 seconds. Click for details.
  • Reviewed 46 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. crates/lib/src/rpc_server/method/transfer_transaction.rs:151
  • Draft comment:
    Refactored test setup: replacing update_config and ConfigMockBuilder with setup_or_get_test_config streamlines initialization. Ensure that setup_or_get_test_config sets up the test config as expected.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. crates/lib/src/rpc_server/method/transfer_transaction.rs:157
  • Draft comment:
    Consider handling/validating the result of setup_or_get_test_config instead of discarding it (using 'let _ ='). This avoids silent failures if configuration setup fails.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None

Workflow ID: wflow_RvxdqekiHsG0Sfe8

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@dev-jodee dev-jodee merged commit ad909f3 into main Sep 2, 2025
2 checks passed
@dev-jodee dev-jodee deleted the feat/pro-263-transfer-hook-testing branch January 6, 2026 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants