From 2f8d9a7e7e33e9d074349949534baa0de0ff0d2e Mon Sep 17 00:00:00 2001 From: frederico leal Date: Mon, 16 Mar 2026 19:23:43 +0100 Subject: [PATCH 1/2] Adding RSKIP-552 placeholder --- IPs/RSKIP552.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 IPs/RSKIP552.md diff --git a/IPs/RSKIP552.md b/IPs/RSKIP552.md new file mode 100644 index 00000000..de4f0404 --- /dev/null +++ b/IPs/RSKIP552.md @@ -0,0 +1,49 @@ +--- +rskip: 552 +title: Title +created: 16-MAR-26 +author: FML (@fmacleal) +purpose: Sca,Usa,Fair,Sec or ST +layer: Core +complexity: 1 +status: Draft,Accepted,Adopted,Deferred or Rejected +description: +--- + +|RSKIP | 552 | +| :------------ |:--------------------------------------------| +|**Title** | Title | +|**Created** | 16-MAR-26 | +|**Author** | FML | +|**Purpose** | Sca,Usa,Fair,Sec or ST | +|**Layer** | Core | +|**Complexity** | 1 | +|**Status** | Draft,Accepted,Adopted,Deferred or Rejected | + +## Abstract + +To be completed... + +## Motivation + +To be completed... + +## Specification + +To be completed... + +### Subsection 1 of Specification such as format. + +To be completed... + +## Rationale + +Discuss design decisions, community debates and possible attacks. + +## References + +[1] Other RSKIP https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP??.md + +### Copyright + +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). \ No newline at end of file From 674ca47e1fe97ce7dd0eb4772e90c8b0f82cd3db Mon Sep 17 00:00:00 2001 From: frederico leal Date: Tue, 24 Mar 2026 15:50:56 +0100 Subject: [PATCH 2/2] Adding the RSKIP-552 content improvements about blake2f --- .DS_Store | Bin 0 -> 8196 bytes .gitignore | 2 ++ IPs/RSKIP552.md | 62 +++++++++++++++++++++++++++++++----------------- README.md | 1 + 4 files changed, 43 insertions(+), 22 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000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OC;K z8Xx~YIIaQic}lx^(fMkul9ktHYcC~^F)DNPYc)bUt}c=(akOcIZBm!Ylrq|M!7h)k zkSR$u$!FEp=xT*hQL7T{^5~t4tU)jv)J+N{rB*H2gxaR?{XkHlZCmkwl6xp2i^Z(6Nt@&T;Odh!RHe5FRG1KZ?ij6rRR2 zcoxqQ-d`fbbG*NXH}ED-;2pe+_i!3#a26lq6MTx#C<89yJ6ysq_*LNe3a+~aUumVQ z4#85gU|Wv8pT;U#P*JCG2r+)vx?)(lN3L_9kU?Kvj?nrjD5kJ+A$M4!P zs(Y#O!u7@l^-ZYpuj54h>p0OX|1hL}j8wTzBB0}fl7z~?{t)oDe_n^@e|Y}i80Y^V D-R5hL literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index 45c15053..a3136aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ _site .sass-cache .jekyll-metadata +.DS_Store/ +.idea/ \ No newline at end of file diff --git a/IPs/RSKIP552.md b/IPs/RSKIP552.md index de4f0404..1cf9474e 100644 --- a/IPs/RSKIP552.md +++ b/IPs/RSKIP552.md @@ -1,49 +1,67 @@ --- rskip: 552 -title: Title +title: Improve Blake2F Input Validation created: 16-MAR-26 author: FML (@fmacleal) -purpose: Sca,Usa,Fair,Sec or ST -layer: Core +purpose: Sec +layer: Core complexity: 1 -status: Draft,Accepted,Adopted,Deferred or Rejected -description: +status: Draft +description: Add null-safety checks to Blake2F precompiled contract input handling --- -|RSKIP | 552 | -| :------------ |:--------------------------------------------| -|**Title** | Title | -|**Created** | 16-MAR-26 | -|**Author** | FML | -|**Purpose** | Sca,Usa,Fair,Sec or ST | -|**Layer** | Core | -|**Complexity** | 1 | -|**Status** | Draft,Accepted,Adopted,Deferred or Rejected | +# Improve Blake2F Input Validation + +|RSKIP | 552 | +| :------------ |:---------------------------------------------| +|**Title** | Improve Blake2F Input Validation | +|**Created** | 16-MAR-26 | +|**Author** | FML | +|**Purpose** | Sec | +|**Layer** | Core | +|**Complexity** | 1 | +|**Status** | Draft | ## Abstract -To be completed... +This RSKIP improves the input validation of the Blake2F precompiled contract (address `0x0000000000000000000000000000000000000009`) introduced by [RSKIP-153](https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP153.md). The change ensures that the Blake2F precompile handles all possible calldata states correctly, including edge cases not covered by the original implementation. Additionally, the exception handling in the precompile execution path within the EVM is improved to increase robustness. ## Motivation -To be completed... +The Blake2F precompiled contract, enabled via RSKIP-153, expects calldata of exactly 213 bytes. The precompile validates the input length before proceeding. However, the current implementation does not handle all possible calldata edge cases consistently. + +To ensure the Blake2F precompile handles all possible input states consistently and deterministically, explicit validation should be added for edge cases not covered by the original implementation. This aligns the precompile with defensive programming best practices and strengthens the overall robustness of the consensus execution path. ## Specification -To be completed... +This RSKIP introduces the following changes, activated conditionally via a new consensus rule (`RSKIP552`): + +### 1. Improved input validation in gas calculation + +When `RSKIP552` is active, the gas calculation logic for the Blake2F precompile handles all possible input states, including edge-case calldata. Invalid inputs return zero gas, consistent with the existing behavior for malformed input of incorrect length. + +### 2. Improved input validation in execution -### Subsection 1 of Specification such as format. +When `RSKIP552` is active, the execution logic for the Blake2F precompile handles all possible input states. Edge-case calldata is rejected with the existing error for incorrect input length, consistent with how other malformed inputs are handled. -To be completed... +### 3. Improved exception handling in precompile execution + +The exception handling in the EVM's precompile execution path is improved to ensure that all error conditions during precompile execution are properly caught and handled, resulting in the call returning zero to the caller. + +## Backward Compatibility + +This change is activated via a consensus rule (`RSKIP552`) and will take effect at a specific network upgrade block height. Before activation, the behavior of the Blake2F precompile remains unchanged. After activation, the only behavioral difference is that transactions targeting the Blake2F precompile with edge-case calldata will be handled consistently with other malformed-input scenarios. ## Rationale -Discuss design decisions, community debates and possible attacks. +Precompiled contracts should handle all possible input states gracefully, following the principle of defensive input validation. This change ensures that the Blake2F precompile behaves consistently and deterministically regardless of how the calling transaction is encoded. ## References -[1] Other RSKIP https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP??.md +[1] [RSKIP-153 - Add BLAKE2 Compression Function F Precompile](https://github.com/rsksmart/RSKIPs/blob/master/IPs/RSKIP153.md) + +[2] [EIP-152 - BLAKE2b F Compression Function](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-152.md) ### Copyright -Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). \ No newline at end of file +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). diff --git a/README.md b/README.md index 59dcdbbf..6bbd1e07 100644 --- a/README.md +++ b/README.md @@ -252,6 +252,7 @@ You can find an easily browseable version of this information [here](https://ips | 540 |[Bridge method `getEstimatedFeesForNextPegOutEvent` improvements and new parameterized method](IPs/RSKIP540.md)| 04-DEC-2025 | MI | Usa | Core | 1 | Draft | | 543 |[Implement EIP-2718 Typed Transactions in Rootstock](IPs/RSKIP543.md)| 05-JAN-2026 | PDG, SM | Sca, Usa | Core | 2 | Draft | | 544 |[Reject new contract code starting with the `0xEF` byte](IPs/RSKIP544.md)| 05-JAN-2026 | PDG, SM | Usa | Core | 1 | Draft | +| 552 |[Improve Blake2F Input Validation](IPs/RSKIP552.md)| 16-MAR-2026 | FML | Sec | Core | 1 | Draft | # Author Index