diff --git a/core/vm/contracts.go b/core/vm/contracts.go index fe480387c2..539d34388a 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -36,7 +36,7 @@ import ( var ( errPrecompileDisabled = errors.New("sha256, ripemd160, blake2f precompiles temporarily disabled") - errModexpUnsupportedInput = errors.New("modexp temporarily accepts only 32-byte (256-bit) inputs") + errModexpUnsupportedInput = errors.New("modexp temporarily only accepts inputs of 32 bytes (256 bits) or less") ) // PrecompiledContract is the basic interface for native Go contracts. The implementation @@ -411,8 +411,8 @@ func (c *bigModExp) Run(input []byte) ([]byte, error) { expLen = new(big.Int).SetBytes(getData(input, 32, 32)).Uint64() modLen = new(big.Int).SetBytes(getData(input, 64, 32)).Uint64() ) - // Check that all inputs are `u256` (32 - bytes), revert otherwise - if baseLen != 32 || expLen != 32 || modLen != 32 { + // Check that all inputs are `u256` (32 - bytes) or less, revert otherwise + if baseLen > 32 || expLen > 32 || modLen > 32 { return nil, errModexpUnsupportedInput } if len(input) > 96 { diff --git a/core/vm/testdata/precompiles/fail-modexp.json b/core/vm/testdata/precompiles/fail-modexp.json index a19829af2c..16f8e28140 100644 --- a/core/vm/testdata/precompiles/fail-modexp.json +++ b/core/vm/testdata/precompiles/fail-modexp.json @@ -1,12 +1,7 @@ [ - { - "Input": "000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020", - "ExpectedError": "modexp temporarily accepts only 32-byte (256-bit) inputs", - "Name": "too small input" - }, { "Input": "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020", - "ExpectedError": "modexp temporarily accepts only 32-byte (256-bit) inputs", + "ExpectedError": "modexp temporarily only accepts inputs of 32 bytes (256 bits) or less", "Name": "too big input" } ] \ No newline at end of file diff --git a/core/vm/testdata/precompiles/fail-modexp_eip2565.json b/core/vm/testdata/precompiles/fail-modexp_eip2565.json index a19829af2c..16f8e28140 100644 --- a/core/vm/testdata/precompiles/fail-modexp_eip2565.json +++ b/core/vm/testdata/precompiles/fail-modexp_eip2565.json @@ -1,12 +1,7 @@ [ - { - "Input": "000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020", - "ExpectedError": "modexp temporarily accepts only 32-byte (256-bit) inputs", - "Name": "too small input" - }, { "Input": "000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000020", - "ExpectedError": "modexp temporarily accepts only 32-byte (256-bit) inputs", + "ExpectedError": "modexp temporarily only accepts inputs of 32 bytes (256 bits) or less", "Name": "too big input" } ] \ No newline at end of file diff --git a/core/vm/testdata/precompiles/modexp.json b/core/vm/testdata/precompiles/modexp.json index 72ffc6307d..7e6fe8343b 100644 --- a/core/vm/testdata/precompiles/modexp.json +++ b/core/vm/testdata/precompiles/modexp.json @@ -1,16 +1,30 @@ [ { - "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Input": "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", "Name": "eip_example1", "Gas": 13056, "NoBenchmark": false }, { - "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", "Expected": "0000000000000000000000000000000000000000000000000000000000000000", "Name": "eip_example2", "Gas": 13056, "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Expected": "0000000000000000000000000000000000000000000000000000000000000001", + "Name": "eip_example3", + "Gas": 13056, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Expected": "0000000000000000000000000000000000000000000000000000000000000000", + "Name": "eip_example4", + "Gas": 13056, + "NoBenchmark": false } ] \ No newline at end of file diff --git a/core/vm/testdata/precompiles/modexp_eip2565.json b/core/vm/testdata/precompiles/modexp_eip2565.json index 266f2f9dcb..876ba06e09 100644 --- a/core/vm/testdata/precompiles/modexp_eip2565.json +++ b/core/vm/testdata/precompiles/modexp_eip2565.json @@ -1,16 +1,30 @@ [ { - "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Input": "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", "Expected": "0000000000000000000000000000000000000000000000000000000000000001", "Name": "eip_example1", "Gas": 1360, "NoBenchmark": false }, { - "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Input": "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", "Expected": "0000000000000000000000000000000000000000000000000000000000000000", "Name": "eip_example2", "Gas": 1360, "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Expected": "0000000000000000000000000000000000000000000000000000000000000001", + "Name": "eip_example3", + "Gas": 1360, + "NoBenchmark": false + }, + { + "Input": "0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2efffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f", + "Expected": "0000000000000000000000000000000000000000000000000000000000000000", + "Name": "eip_example4", + "Gas": 1360, + "NoBenchmark": false } ] \ No newline at end of file diff --git a/params/version.go b/params/version.go index ebf2e94583..63705f7a38 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 4 // Major version component of the current release VersionMinor = 2 // Minor version component of the current release - VersionPatch = 8 // Patch version component of the current release + VersionPatch = 9 // Patch version component of the current release VersionMeta = "sepolia" // Version metadata to append to the version string )