Skip to content

p-ata: Idempotent w/ existing ATA#200

Merged
grod220 merged 5 commits intomainfrom
create-ix-part-1
Mar 13, 2026
Merged

p-ata: Idempotent w/ existing ATA#200
grod220 merged 5 commits intomainfrom
create-ix-part-1

Conversation

@grod220
Copy link
Member

@grod220 grod220 commented Mar 6, 2026

This PR adds the first portion of the Pinocchio create_associated_token_account flow covering the idempotent w/ existing ATA case.

Also integrates mollusk fixtures to serve as conformance testing between old and new programs.

@grod220 grod220 force-pushed the create-ix-part-1 branch 2 times, most recently from 4c63763 to 9e39e98 Compare March 6, 2026 21:38
@grod220 grod220 requested review from febo and joncinque March 6, 2026 21:41
@grod220
Copy link
Member Author

grod220 commented Mar 10, 2026

With anza-xyz/pinocchio#349 in progress, was able to remove the shim! 🎊

@grod220 grod220 requested review from febo and removed request for febo and joncinque March 11, 2026 10:33
@grod220
Copy link
Member Author

grod220 commented Mar 11, 2026

Update: going to investigate p-token style fixtures approach to testing both binaries

Comment on lines +75 to +78
cargo $(nightly) test --features mollusk-svm/fuzz --manifest-path program/Cargo.toml \
--test create_always \
--test create_idempotent \
--test create_shared && \
Copy link
Member Author

Choose a reason for hiding this comment

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

Found this to be the way we can do conformance testing only on the code paths that have been migrated so far. It also serves a dual purpose as think it's helpful to break down large test files into smaller scoped ones.

@grod220 grod220 requested a review from febo March 11, 2026 23:37

harness
.ctx
.process_and_validate_instruction(&instruction, &[Check::err(ProgramError::IllegalOwner)]);
Copy link

@febo febo Mar 12, 2026

Choose a reason for hiding this comment

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

nit: This error is a bit misleading, since the owner is correct. Maybe is_valid_existing_ata_for_idempotent needs to return specific errors depending of which assert failed. But I do see that the processor is not complete, so maybe is something that you will address later.

Copy link
Member Author

Choose a reason for hiding this comment

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

You're right. It's a strange case. From the caller's perspective they submitted a valid wallet/mint/token-program and the ATA address has a token program owned account sitting there (but with invalid data).

This error is inherited from the current program. Wouldn't changing it break conformance?

Copy link

Choose a reason for hiding this comment

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

Ah, I see, if unpack fails in the original program (which will in this case), it will then reach the ProgramError::IllegalOwner error. You are right, we can't change that. So this is correct, it is replicating the same behaviour.

Copy link

@febo febo left a comment

Choose a reason for hiding this comment

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

Just a few small nits.

@grod220 grod220 mentioned this pull request Mar 12, 2026
34 tasks
@grod220 grod220 requested a review from febo March 12, 2026 19:31
Copy link

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks good! I think it only needs a rebase.


harness
.ctx
.process_and_validate_instruction(&instruction, &[Check::err(ProgramError::IllegalOwner)]);
Copy link

Choose a reason for hiding this comment

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

Ah, I see, if unpack fails in the original program (which will in this case), it will then reach the ProgramError::IllegalOwner error. You are right, we can't change that. So this is correct, it is replicating the same behaviour.

@grod220 grod220 requested a review from febo March 13, 2026 11:33
Copy link

@febo febo left a comment

Choose a reason for hiding this comment

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

Looks good!

@grod220 grod220 merged commit 8c1db3e into main Mar 13, 2026
27 checks passed
@grod220 grod220 deleted the create-ix-part-1 branch March 13, 2026 16:01
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