Skip to content

Idl: Limit account size to 60kb, allow closing idl accounts - #2329

Merged
Henry-E merged 16 commits into
otter-sec:masterfrom
ckamm:ckamm/idl-close
Jan 5, 2023
Merged

Idl: Limit account size to 60kb, allow closing idl accounts#2329
Henry-E merged 16 commits into
otter-sec:masterfrom
ckamm:ckamm/idl-close

Conversation

@ckamm

@ckamm ckamm commented Dec 21, 2022

Copy link
Copy Markdown
Contributor

Originally by @microwavedcola1

@vercel

vercel Bot commented Dec 21, 2022

Copy link
Copy Markdown

@microwavedcola1 is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

@Henry-E

Henry-E commented Dec 22, 2022

Copy link
Copy Markdown

This looks nice, thanks for adding. @microwavedcola1 I don't know if you would mind adding a typescript test demonstrating the new close functionality to the existing set of IDL tests.

https://github.com/coral-xyz/anchor/blob/master/tests/anchor-cli-idl/tests/idl.ts

Also as with the other PRs

  • don't forget to check cargo clippy
  • please add a changelog with this as a new features

Thanks for all the great PRs! They all look like very nice additions to anchor, looking forward to merging.

@Henry-E

Henry-E commented Dec 26, 2022

Copy link
Copy Markdown

I played around with adding accounts larger than 10kb (by adding a realloc / resize account function) and it seems like adding bytes to write buffer causes a memory issue before it can even reach account sizes above 10kb. So unless someone wants to switch over all the old IDL code to using zero copy accounts, this is probably as big as the account can be for now.

Not to mention, one issue with updating the IDL code to newer account types is that account types like Account rely on having the owner attribute implemented. But because the IDL accounts structs have their macros expanded while still in the anchor crate, then there's no way to know what the program ID to use is. Again, unless someone wants to port all of this code to being stored in a quote stream that only gets executed at the downstream program's compile time.

Anyway, I just need to

  • Fix the test (already added but it's failing silently somehow in the CI, just add a wait timer between tests to allow the validator to catch up)
  • Fix the clippy errors
  • update the change log

And then it's ready to merge i think

@Henry-E Henry-E changed the title Idl: Limit account size to 10kb, allow closing idl accounts Idl: Limit account size to 60kb, allow closing idl accounts Jan 4, 2023
@Henry-E

Henry-E commented Jan 4, 2023

Copy link
Copy Markdown

Weird compile error happening with some programs but not others. It's possible that it's linked to the use of try_into() that was added in a number of places. Maybe there's a more explicit casting we can do instead? I read through a couple of the passing vs. failing programs and it's not clear what differences there are between them that could be causing this (i.e. they were both essentially empty/placeholder programs).

error[E0599]: no method named `try_into` found for type `u32` in the current scope
   --> programs/multiple-suites-run-single/src/lib.rs:5:1
    |
5   | #[program]
    | ^^^^^^^^^^ method not found in `u[32](https://github.com/coral-xyz/anchor/actions/runs/3840033520/jobs/6538648897#step:10:33)`
    
    error[E0599]: no method named `try_into` found for type `usize` in the current scope
   --> programs/multiple-suites-run-single/src/lib.rs:5:1
    |
5   | #[program]
    | ^^^^^^^^^^ method not found in `usize`
    |

edit: Mostly sure this is due to no including fully qualified paths for try_into. Will add them in now.

@Henry-E
Henry-E merged commit 27bb695 into otter-sec:master Jan 5, 2023
dovahcrow pushed a commit to dovahcrow/anchor that referenced this pull request Jan 13, 2023
akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Mar 25, 2026
@jamie-osec jamie-osec added this to the Pre-1.0 milestone Jun 24, 2026
frolovdev pushed a commit to frolovdev/anchor that referenced this pull request Jul 22, 2026
akash-osec pushed a commit to akash-osec/anchor that referenced this pull request Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants