2

I would love to know how a Solana program's size is calculated.

Do PDA's size that are owned by the program add up when this calculation is done? What about arguments?

1 Answer 1

4

A Solana program data account's size is pretty much just the size of the .so file plus 45 bytes for the metadata on the programdata: https://github.com/anza-xyz/agave/blob/edd2fffe1d75dc71b3604e41b5dfeb74af5fb7be/sdk/program/src/bpf_loader_upgradeable.rs#L82

On top of that, you have the base program account, which is 36 bytes: https://github.com/anza-xyz/agave/blob/edd2fffe1d75dc71b3604e41b5dfeb74af5fb7be/sdk/program/src/bpf_loader_upgradeable.rs#L72

Solana programs only store bytecode, so there's no account data included at all. PDAs are separate accounts, so they are not included in the program size.

And I'm not sure what you mean by "arguments", but maybe you mean instruction data? Those are also not stored in the program, they come from the transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.