From 336b1dcfc6e3fa76ed29edfd9eb4d58d4ad4c4d9 Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 28 May 2025 11:40:47 -0500 Subject: [PATCH 1/2] propose to reduce load data size limit to zero by default --- ...fault-loaded-accounts-data-size-to-zero.md | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 proposals/0288-default-loaded-accounts-data-size-to-zero.md diff --git a/proposals/0288-default-loaded-accounts-data-size-to-zero.md b/proposals/0288-default-loaded-accounts-data-size-to-zero.md new file mode 100644 index 000000000..9b449e6e9 --- /dev/null +++ b/proposals/0288-default-loaded-accounts-data-size-to-zero.md @@ -0,0 +1,95 @@ +--- +simd: '0288' +title: Set default value of loaded_accounts_bytes to zero +Author: Tao Zhu (Anza) +category: Standard +type: Core +status: Draft +created: 2025-05-27 +feature: +supersedes: +superseded-by: +extends: +--- + +## Summary + +This SIMD proposes setting the default value for loaded accounts data size to +**zero bytes** in the Solana runtime, replacing the current implicit default of +`MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES` (64MB). + +## Motivation + +Currently, the Solana runtime allows transactions to implicitly load up to 64MB +of account data: + +```rust +/// The total accounts data a transaction can load is limited to 64MiB to not break +/// anyone in Mainnet-beta today. It can be set by set_loaded_accounts_data_size_limit instruction +pub const MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES: NonZeroU32 = + NonZeroU32::new(64 * 1024 * 1024).unwrap(); +``` + +This generous default was intended to avoid accidental transaction failures +during development or early deployment phases. However, it introduces several +downsides: + +- Reduces transparency in runtime constraints. + +- Enables unintentional or excessive resource usage. + +- Increases the risk of performance degradation or abuse. + +By reducing the default to zero, developers and operators are required to +explicitly configure this budget, leading to safer, more predictable, and +better-controlled execution environments. + +This aligns with broader Solana design goals to ensure deterministic resource +consumption and to encourage clear contract behavior. + +## Alternative Considered + +- Reduce the default to a arbitrary value (e.g., 8MB or 16MB) instead of 0. + +## New Terminology + +None + +## Detailed Design + +1. Introduce a New Default Constant: + Add a new constant:`pub const DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES: usize = 0` + Use this wherever a default loaded account data size is required. + +2. Preserve the Current Maximum: + Continue to enforce `MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES` (64MB) as the upper +bound for explicitly configured limits. + +3. Gradual Ramp-Down Strategy: + Implement a phased reduction toward zero. For example, decrease +`DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES` by fixed increments (e.g., 8MB per +epoch). This gives developers time to adapt. + +4. Final Enforcement: + Once the target default of zero is reached, completely remove the default. +All accounts data size limits must then be explicitly defined by the transaction or runtime. + +## Impact + +This change is not backward-compatible by default. Workloads or tests that +rely on the implicit 64MB limit may break. + +To mitigate the impact: + +- Issue deprecation warnings during the ramp-down phase. + +- Provide guidance and tools for setting explicit limits using the +set_loaded_accounts_data_size_limit instruction. + +- Use feature gating to manage rollout and allow clusters to opt in progressively. + + +## Security Considerations + +To maintain consensus integrity, both Agave and Firedancer clients must adopt +this change in a coordinated fashion. From e452164c6671ff512af7b557b0c2c930634d0edc Mon Sep 17 00:00:00 2001 From: Tao Zhu Date: Wed, 28 May 2025 11:46:54 -0500 Subject: [PATCH 2/2] update simd number to match pr number --- ...ault-loaded-accounts-data-size-to-zero.md} | 25 ++++++++----------- 1 file changed, 10 insertions(+), 15 deletions(-) rename proposals/{0288-default-loaded-accounts-data-size-to-zero.md => 0289-default-loaded-accounts-data-size-to-zero.md} (80%) diff --git a/proposals/0288-default-loaded-accounts-data-size-to-zero.md b/proposals/0289-default-loaded-accounts-data-size-to-zero.md similarity index 80% rename from proposals/0288-default-loaded-accounts-data-size-to-zero.md rename to proposals/0289-default-loaded-accounts-data-size-to-zero.md index 9b449e6e9..1c7300578 100644 --- a/proposals/0288-default-loaded-accounts-data-size-to-zero.md +++ b/proposals/0289-default-loaded-accounts-data-size-to-zero.md @@ -1,10 +1,10 @@ --- -simd: '0288' -title: Set default value of loaded_accounts_bytes to zero -Author: Tao Zhu (Anza) +simd: '0289' +title: Set default loaded_accounts_bytes to zero +authors: Tao Zhu (Anza) category: Standard type: Core -status: Draft +status: Review created: 2025-05-27 feature: supersedes: @@ -21,14 +21,7 @@ This SIMD proposes setting the default value for loaded accounts data size to ## Motivation Currently, the Solana runtime allows transactions to implicitly load up to 64MB -of account data: - -```rust -/// The total accounts data a transaction can load is limited to 64MiB to not break -/// anyone in Mainnet-beta today. It can be set by set_loaded_accounts_data_size_limit instruction -pub const MAX_LOADED_ACCOUNTS_DATA_SIZE_BYTES: NonZeroU32 = - NonZeroU32::new(64 * 1024 * 1024).unwrap(); -``` +of account data, [code](https://github.com/anza-xyz/agave/blob/e9389a091f679c9e4595e4286091d1092f58f5dc/program-runtime/src/execution_budget.rs#L27-L30). This generous default was intended to avoid accidental transaction failures during development or early deployment phases. However, it introduces several @@ -47,7 +40,7 @@ better-controlled execution environments. This aligns with broader Solana design goals to ensure deterministic resource consumption and to encourage clear contract behavior. -## Alternative Considered +## Alternatives Considered - Reduce the default to a arbitrary value (e.g., 8MB or 16MB) instead of 0. @@ -58,7 +51,8 @@ None ## Detailed Design 1. Introduce a New Default Constant: - Add a new constant:`pub const DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES: usize = 0` + Add a new constant: + `pub const DEFAULT_LOADED_ACCOUNTS_DATA_SIZE_BYTES: usize = 0` Use this wherever a default loaded account data size is required. 2. Preserve the Current Maximum: @@ -72,7 +66,8 @@ epoch). This gives developers time to adapt. 4. Final Enforcement: Once the target default of zero is reached, completely remove the default. -All accounts data size limits must then be explicitly defined by the transaction or runtime. +All accounts data size limits must then be explicitly defined by the +transaction or runtime. ## Impact