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

Fix impl for writealloc CPI size limits #40

Merged
merged 2 commits into from
Mar 29, 2024
Merged

Fix impl for writealloc CPI size limits #40

merged 2 commits into from
Mar 29, 2024

Conversation

amilz
Copy link
Contributor

@amilz amilz commented Mar 29, 2024

I think we need to add some margin to data_len to account for the AccountMeta we're passing into the instruction. We have 3 of them at 34 bytes ea (Pubkey + 2 bool) = 102 bytes above our limit (which is consistent with my testing).

Ref:

Solution add accounts.len() * 34 to data_len

Having trouble w/ my local client building so i haven't tested it.

I'm not certain, but my hunch is that we need to add some margin to data_len to account for the AccountMeta we're passing into the instruction.  We have 3 of them at 34 bytes ea (Pubkey + 2 bool) = 102 bytes above our limit.
edit pretty sure this is the case. check out: https://github.com/solana-labs/solana/blob/15d18a03e5203aec6452605cf6381afca46983fa/programs/bpf_loader/src/syscalls.rs#L2750-L2763
(34 * ix.accounts.len() + ix.data.len() <= 1280)
@amilz amilz changed the title update impl for writealloc size limits Fix impl for writealloc CPI size limits Mar 29, 2024
Copy link
Contributor

@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.

Thank you!

@febo febo merged commit a99a1f3 into nifty-oss:main Mar 29, 2024
12 checks passed
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