|
17 | 17 |
|
18 | 18 | /* NOTE: THE FOLLOWING CONSTANTS ARE CONSENSUS CRITICAL AND CANNOT BE |
19 | 19 | CHANGED WITHOUT COORDINATING WITH ANZA. */ |
20 | | -#define FD_PACK_MAX_COST_PER_BLOCK (48000000UL) |
21 | | -#define FD_PACK_MAX_VOTE_COST_PER_BLOCK (36000000UL) |
22 | | -#define FD_PACK_MAX_WRITE_COST_PER_ACCT (12000000UL) |
| 20 | + |
| 21 | +/* These are bounds on known limits. Upper bound values are used to |
| 22 | + calculate memory footprints while lower bounds are used for |
| 23 | + initializing consensus-dependent logic and invariant checking. As a |
| 24 | + leader, it is OK to produce blocks using limits smaller than the |
| 25 | + active on-chain limits. Replay should always use the correct |
| 26 | + chain-derived limits. |
| 27 | +
|
| 28 | + The actual limits used by pack may be updated dynamically to some |
| 29 | + in-bounds value. If there is an anticipated feature activation that |
| 30 | + changes these limits, the upper bound should be the largest |
| 31 | + anticipated value while the lower bound should be the current active |
| 32 | + limit. For Frankendancer, the actual value used for consensus will be |
| 33 | + retreived from Agave. */ |
| 34 | +#define FD_PACK_MAX_COST_PER_BLOCK_LOWER_BOUND (48000000UL) |
| 35 | +#define FD_PACK_MAX_VOTE_COST_PER_BLOCK_LOWER_BOUND (36000000UL) |
| 36 | +#define FD_PACK_MAX_WRITE_COST_PER_ACCT_LOWER_BOUND (12000000UL) |
| 37 | + |
| 38 | +#define FD_PACK_MAX_COST_PER_BLOCK_UPPER_BOUND (60000000UL) /* simd 0256 */ |
| 39 | +#define FD_PACK_MAX_VOTE_COST_PER_BLOCK_UPPER_BOUND (36000000UL) |
| 40 | +#define FD_PACK_MAX_WRITE_COST_PER_ACCT_UPPER_BOUND (12000000UL) |
| 41 | + |
23 | 42 | #define FD_PACK_FEE_PER_SIGNATURE (5000UL) /* In lamports */ |
24 | 43 |
|
25 | 44 | /* Each block is limited to 32k parity shreds. We don't want pack to |
@@ -202,20 +221,26 @@ FD_FN_PURE ulong fd_pack_current_block_cost( fd_pack_t const * pack ); |
202 | 221 | FD_FN_PURE ulong fd_pack_bank_tile_cnt( fd_pack_t const * pack ); |
203 | 222 |
|
204 | 223 | /* fd_pack_set_block_limits: Updates the limits provided fd_pack_new to |
205 | | - the new values. Any future microblocks produced by this pack object |
206 | | - will not cause a block to have more than max_microblocks_per_block |
207 | | - non-empty microblocks or more than max_data_bytes_per_block data |
208 | | - bytes (counting microblock headers as before). Limits are inclusive, |
209 | | - as per usual (i.e. a block may have exactly |
210 | | - max_microblocks_per_block microblocks, but not more). pack must be |
211 | | - a valid local join. |
| 224 | + these new values. Any future microblocks produced by this pack |
| 225 | + object will not cause a block to have more than |
| 226 | + limits->max_microblocks_per_block non-empty microblocks or more than |
| 227 | + limits->max_data_bytes_per_block data bytes (counting microblock |
| 228 | + headers as before). future microblocks will also exclude those that |
| 229 | + cause the total block cost to exceed limits->max_cost_per_block. |
| 230 | + Similarly those that cause the total vote-only cost to exceed |
| 231 | + limits->max_vote_cost_per_block. Also, those that cause the total |
| 232 | + per-account, per block write cost to exceed |
| 233 | + limits->max_write_cost_per_acct. Note that |
| 234 | + limits->max_txn_per_microblock is ignored. Limits are inclusive, as |
| 235 | + per usual (i.e. a block may have exactly max_microblocks_per_block |
| 236 | + microblocks, but not more). pack must be a valid local join. |
212 | 237 |
|
213 | 238 | The typical place to call this is immediately after |
214 | 239 | fd_pack_end_block; if this is called after some microblocks have been |
215 | 240 | produced for the current block, and the current block already exceeds |
216 | 241 | the limits, all the remaining microblocks in the block will be empty, |
217 | 242 | but the call is valid. */ |
218 | | -void fd_pack_set_block_limits( fd_pack_t * pack, ulong max_microblocks_per_block, ulong max_data_bytes_per_block ); |
| 243 | +void fd_pack_set_block_limits( fd_pack_t * pack, fd_pack_limits_t const * limits ); |
219 | 244 |
|
220 | 245 | /* Return values for fd_pack_insert_txn_fini: Non-negative values |
221 | 246 | indicate the transaction was accepted and may be returned in a future |
|
0 commit comments