From c76f69635780b232dbadacc9d261b2e7ca140958 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 25 Jul 2024 08:15:57 -0400 Subject: [PATCH 1/4] initial draft --- proposals/XXXX-static-instruction-limit.md | 66 ++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 proposals/XXXX-static-instruction-limit.md diff --git a/proposals/XXXX-static-instruction-limit.md b/proposals/XXXX-static-instruction-limit.md new file mode 100644 index 000000000..516e7fbfb --- /dev/null +++ b/proposals/XXXX-static-instruction-limit.md @@ -0,0 +1,66 @@ +--- +simd: 'XXXX' +title: Static Instruction Limit +authors: + - Andrew Fitzgerald (anza) +category: Standard/Meta +type: Core +status: Draft +created: 2024-07-24 +feature: +supersedes: +superseded-by: +extends: +--- + +## Summary + +Transactions will fail execution in SVM if the transactions use more than 64 +instructions, including CPI calls. +This proposal is to make transactions that use more than 64 top-level +instructions fail sanitization checks and be rejected by the network. + +## Motivation + +The current limit of 64 instructions is a runtime failure, and makes sense +in the context of CPIs. +It is bad user experience to allow creation and submission of transactions that +have no chance of being executed successfully. +Several other checks worst-case performance scales with the number of +top-level instructions in a transaction, so limiting this number can help the +worst-case performance. + +## Alternatives Considered + +Do nothing. + +## New Terminology + +None. + +## Detailed Design + +Any transaction that has more than 64 top-level instructions cannot be included +in a block. +If a block contains a transaction with more than 64 top-level instructions, the +block must be marked as invalid. + +## Impact + +- Users are prevented from creating transactions that cannot be executed successfully. +- Smaller upper bound on number of instructions can help performance of validator. + +## Security Considerations + +- Requires a feature-gate to enable the new limit. + +## Drawbacks *(Optional)* + +- Similar to the runtime check on number of instructions including CPI, logic + is duplicated. +- Can no longer collect fees from transactions that are rejected due to new + limit. + +## Backwards Compatibility *(Optional)* + +- Some transactions that are currently valid will be rejected. From 07496ede6a62204a9471718bd84ab26396521e7b Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 25 Jul 2024 08:17:33 -0400 Subject: [PATCH 2/4] Update XXXX to 0160 --- ...ic-instruction-limit.md => 0160-static-instruction-limit.md} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename proposals/{XXXX-static-instruction-limit.md => 0160-static-instruction-limit.md} (99%) diff --git a/proposals/XXXX-static-instruction-limit.md b/proposals/0160-static-instruction-limit.md similarity index 99% rename from proposals/XXXX-static-instruction-limit.md rename to proposals/0160-static-instruction-limit.md index 516e7fbfb..5fdf1d219 100644 --- a/proposals/XXXX-static-instruction-limit.md +++ b/proposals/0160-static-instruction-limit.md @@ -1,5 +1,5 @@ --- -simd: 'XXXX' +simd: '0160' title: Static Instruction Limit authors: - Andrew Fitzgerald (anza) From ac8ebe6127fe61dee381c97b8686bf5e0ee93400 Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Thu, 25 Jul 2024 08:18:35 -0400 Subject: [PATCH 3/4] Standard category --- proposals/0160-static-instruction-limit.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/0160-static-instruction-limit.md b/proposals/0160-static-instruction-limit.md index 5fdf1d219..da2311ab9 100644 --- a/proposals/0160-static-instruction-limit.md +++ b/proposals/0160-static-instruction-limit.md @@ -3,7 +3,7 @@ simd: '0160' title: Static Instruction Limit authors: - Andrew Fitzgerald (anza) -category: Standard/Meta +category: Standard type: Core status: Draft created: 2024-07-24 From 4398665f2ae72df927fd532effcb6b145903700a Mon Sep 17 00:00:00 2001 From: Andrew Fitzgerald Date: Fri, 2 Aug 2024 10:43:25 -0500 Subject: [PATCH 4/4] alternatives --- proposals/0160-static-instruction-limit.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/proposals/0160-static-instruction-limit.md b/proposals/0160-static-instruction-limit.md index da2311ab9..4e12cf742 100644 --- a/proposals/0160-static-instruction-limit.md +++ b/proposals/0160-static-instruction-limit.md @@ -32,7 +32,17 @@ worst-case performance. ## Alternatives Considered -Do nothing. +- Do nothing. +- Allow transactions with more than 64 top-level instructions to be included in + blocks, but skip execution only taking fees. + - Checking the number of top-level instructions in a transaction is a + relatively cheap operation and can be done very early in the processing of + a transaction, similar to the current check that the number of required + signatures matches the number of signatures provided. + - Additionally, if we still allow more than 64 top-level instructions in a + transaction we would still need to parse all the instructions to determine + the fee, so there is a performance benefit in strictly limiting the number + of top-level instructions. ## New Terminology