-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Propose to remove new account creation data size check from cost model #30204
Comments
seems reasonable. does #30205 need a feature gate as well, or no since the behavior change only affects the current slot leader? |
No need feature gate if "land this before #30035", otherwise need to be gated. Another motivation for do it now 😄 |
Also checked the metrics, mainnet-beta seems never hit this check anyway:
|
These checks in the cost model are the only way to add limits on new allocations within a block. We'll be able to limit new allocations per transaction with #27375, but we won't be able to limit allocations per block (#25517) elsewhere. As noted, the current checks are not comprehensive in what they can—and do—check, so it may be appropriate to remove them. I'm not sure I am willing to be that person though 😸 |
Good point to distinguish per-transaction and per-block. I wonder if limiting allocation per block has actual use. Transactions from multiple blocks are replayed simultaneously anyway. Before being able to limit-per-transaction, set cap per block helps a bit. Since we can set limit per transaction now (limits on both new allocation per tx, and total data loaded per tx), hence time to reevaluate the need of limit-allocations-per-block. |
does #27385 account for both system program allocations and the realloc syscall? |
Yep! solana/sdk/src/transaction_context.rs Lines 996 to 1010 in 27f18f9
|
Problem
As part of effort to define detailed costs for accounts (such as costs to load read/write/executable/lookup accounts, and costs of loaded account data size, etc), I would like to clean up this block of code that limits how many new account data size each block can allocate, utilizing cost_model.
For context, it was implemented as a quick way to limit data size accounts can take, adding preventive check at leader side was the quickest way. However, due to the fact that cost_model functions before transactions being processed, the implementation was limited to check only instructions that create accounts.
Since then more comprehensive approaches were consisted and implemented: (thanks to @brooksprumo for documenting)
Capping allocations per transaction
Capping total loaded account data size
IMO, with these two changes, the block of code in question can/should be removed. POC here. It would not only clean up the code, gain some perf back, also make it easier to define cost for data size accounts loads.
Some other resources/contexts:
Capping total accounts data size
Capping allocations per block
Proposed Solution
The text was updated successfully, but these errors were encountered: