fix(declare-program): handle numeric instruction suffixes#4568
Open
abhinavgautam01 wants to merge 1 commit into
Open
fix(declare-program): handle numeric instruction suffixes#4568abhinavgautam01 wants to merge 1 commit into
abhinavgautam01 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4281
Summary
Fixes
declare_program!account module re-exports for instruction names that contain an underscore before a numeric suffix, such asinitialize_with_token_2022.Previously, generated internal account modules normalized the instruction name through CamelCase and then snake_case, while the public client/CPI account re-exports used the raw IDL instruction name. That could make the re-export look for
__cpi_client_accounts_initialize_with_token_2022even though the generated module was named__cpi_client_accounts_initialize_with_token2022.Changes
declare_program!client/CPI account re-export module names the same way as generated account modules.initialize_with_token_2022.declare-programfixture IDL.Testing
cargo +nightly fmt --check -p anchor-attribute-programcargo test -p anchor-attribute-program test_gen_accounts_mod_name_matches_generated_accountscargo check -p declare-program --features cpicargo check -p externalcargo clippy -p anchor-attribute-program --all-targets -- -D warningsgit diff --checkNote: full workspace
cargo +nightly fmt --checkcurrently fails on an unrelated pre-existing import ordering diff inlang/src/lib.rs, which this PR does not touch...