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

Anchor 0.29 Deploy failure on instruction #2926

Open
mgild opened this issue Apr 23, 2024 · 2 comments
Open

Anchor 0.29 Deploy failure on instruction #2926

mgild opened this issue Apr 23, 2024 · 2 comments
Labels

Comments

@mgild
Copy link
Contributor

mgild commented Apr 23, 2024

#[derive(Clone, AnchorSerialize, AnchorDeserialize)]
pub struct StateSetConfigsParams {
    pub new_authority: Option<Pubkey>,
    pub min_quote_verify_votes: Option<u64>,
    pub test_only_disable_mr_enclave_check: Option<u8>,
    pub stake_pool: Option<Pubkey>,
    pub stake_program: Option<Pubkey>,
    pub add_advisory: Option<Vec<u32>>,
    pub rm_advisory: Option<Vec<u32>>,
}

Above produces consistent deploy failure when used as instruciton parameter. Below succeeds

#[derive(Clone, AnchorSerialize, AnchorDeserialize)]
pub struct StateSetConfigsParams {
    pub new_authority: Option<Pubkey>,
    pub min_quote_verify_votes: Option<u64>,
    pub test_only_disable_mr_enclave_check: Option<u8>,
    pub stake_pool: Option<Pubkey>,
    pub stake_program: Option<Pubkey>,
    pub add_advisory: Option<u32>,
    pub rm_advisory: Option<u32>,
}
@mgild
Copy link
Contributor Author

mgild commented Apr 23, 2024

In fact, just using an Option is making transaction size go haywire

@acheroncrypto
Copy link
Collaborator

#[derive(Clone, AnchorSerialize, AnchorDeserialize)]
pub struct StateSetConfigsParams {
    pub new_authority: Option<Pubkey>,
    pub min_quote_verify_votes: Option<u64>,
    pub test_only_disable_mr_enclave_check: Option<u8>,
    pub stake_pool: Option<Pubkey>,
    pub stake_program: Option<Pubkey>,
-   pub add_advisory: Option<Vec<u32>>,
-   pub rm_advisory: Option<Vec<u32>>,
+   pub add_advisory: Option<u32>,
+   pub rm_advisory: Option<u32>,
}

Is it because of the Option<Vec<_>>?

Or, could it be because this data structure potentially has multiple ways to be de/serialized by borsh?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants