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

fuzz: program_result as u64 #75

Merged
merged 1 commit into from
Jan 13, 2025
Merged

Conversation

febo
Copy link
Contributor

@febo febo commented Jan 12, 2025

Problem

Currently, the program_result in the structEffects is a u32 value. But the built-in InstructionError values occupy the upper 32 bits – casting the resulting u64 to u32 effectively drops their value. The issue is apparent when the instruction fails with a ProgramError::Custom(0) and fixtures are generated. The result of the cast in this case be 0, which is the same value as the ProgramResult::Success:

let program_result = match &program_result {
        ProgramResult::Success => 0,
        ProgramResult::Failure(e) => u64::from(e.clone()) as u32,
        ProgramResult::UnknownError(_) => u32::MAX, //TODO
};

Solution

Update the value of program_result to be a u64.

@febo febo marked this pull request as ready for review January 12, 2025 22:43
Copy link
Collaborator

@buffalojoec buffalojoec left a comment

Choose a reason for hiding this comment

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

Thanks!!

@buffalojoec buffalojoec merged commit 81393c6 into anza-xyz:main Jan 13, 2025
4 checks passed
buffalojoec pushed a commit that referenced this pull request Jan 13, 2025
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