coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.69k stars 1.35k forks source link

program.account.escrow.all() => Trying to access beyond buffer length ? #2781

Closed effeaucarre closed 9 months ago

effeaucarre commented 9 months ago

Hello, i had a script with an old anchor version ("@project-serum/anchor": "^0.14.0",), and the program.account.escrow.all() worked perfectly.

i have now a recent version ("@coral-xyz/anchor": "^0.29.0",), and this is not working anymore.

accounts are exactly the same.

I get the following error : trying to access beyond buffer length ?

It looks like a version problem... but how can i solve it ? I tried to install the same old version, but it's not working neither. May be a problem in a dependency ?

acheroncrypto commented 9 months ago

It's hard to debug when you only share the error and not how to reproduce. The version 0.14.0 is 2+ year old but program.account.<name>.all most likely hasn't changed a lot since then.

effeaucarre commented 9 months ago

i tried to load the 4K+ accounts 1 by 1 , and saw that 2 are generating this error. May be struct has changed in the mean time... but don't think so. Do you know if there is a way to exclude some address of the .all() to avoid the error ?

very hard to explain how to reproduce since i guess it's linked to the said accounts. The only thing i don't understand is what it worked with older version, and not anymore...

acheroncrypto commented 9 months ago

Dou know if there is a way to exclude some address of the .all() to avoid the error ?

You can add filters to the all([...]) method.

effeaucarre commented 9 months ago

do you know where we can find documentation about this filters ? the only documentation i can find is about rust...

acheroncrypto commented 9 months ago

You can check out GetProgramAccountsFilter documentation since the filters are the same for Connection.getProgramAccounts and program.account.<name>.all.

Please ask questions like these in Solana StackExchange or Anchor Discord.