From a3f5756384a7aa11eaccd55c7f7da67702bdb126 Mon Sep 17 00:00:00 2001 From: gajinder Date: Fri, 3 May 2024 17:31:34 +0530 Subject: [PATCH] Update EIP-3935: restrict contract input to 8 bytes to prevent overflow in checks --- EIPS/eip-2935.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/EIPS/eip-2935.md b/EIPS/eip-2935.md index 3ab311ccd6029c..1c3bedde8b79e6 100644 --- a/EIPS/eip-2935.md +++ b/EIPS/eip-2935.md @@ -71,8 +71,8 @@ def resolve_blockhash(block: Block, state: State, arg: uint64): Exact evm assembly that can be used for the contract to resolve `BLOCKHASH` ``` -// check if inputsize>32 revert -push1 0x20 +// check if inputsize>8 revert +push1 0x08 calldatasize gt push1 0x31 @@ -88,7 +88,7 @@ gt push1 0x29 jumpi -// check if blocknumber > input + 8192 then return 0 +// check if blocknumber > input + 8192 then return 0, no overflow expected for input of 8 bytes push0 calldataload push2 0x2000 @@ -130,6 +130,8 @@ revert stop ``` + + Corresponding bytecode: `60203611603157600143035f35116029575f356120000143116029576120005f3506545f5260205ff35b5f5f5260205ff35b5f5ffd00`