Fix Blake2b precompile regression (#2919)

Introduced by #2865
Detected on Holesky block 2.406.802 tx no 11
And on MainNet block 19.633.393
This commit is contained in:
andri lim 2024-12-10 02:52:34 +07:00 committed by GitHub
parent c32726671f
commit 57157a6f76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 109 additions and 2 deletions

View File

@ -379,6 +379,9 @@ func blake2bf(c: Computation): EvmResultVoid =
c.output.setLen(64)
if not blake2b_F(input, c.output):
# unlike other precompiles, blake2b upon
# error should return zero length output
c.output.setLen(0)
return err(prcErr(PrcInvalidParam))
ok()

View File

@ -681,7 +681,16 @@ const
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
),
TestSpec(
name: "Blake2b precompiles regression, holesky 2.406.802 # 11",
base: "testdata/00-528",
input: t8nInput(
"alloc.json", "txs.rlp", "env.json", "Cancun", "", "17000"
),
output: T8nOutput(alloc: true, result: true),
expOut: "exp.json",
),
]
proc main() =

View File

@ -1,2 +1,2 @@
{"pc":0,"op":0,"gas":"0x0","gasCost":"0xfffffffffffecb68","memSize":0,"stack":[],"depth":1,"refund":0,"opName":"STOP","error":"PrcInvalidParam"}
{"output":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","gasUsed":"0x13498","error":"PrcInvalidParam"}
{"output":"","gasUsed":"0x13498","error":"PrcInvalidParam"}

26
tools/t8n/testdata/00-528/alloc.json vendored Normal file

File diff suppressed because one or more lines are too long

12
tools/t8n/testdata/00-528/env.json vendored Normal file
View File

@ -0,0 +1,12 @@
{
"currentBaseFee" : "10",
"currentCoinbase" : "0x8fc558a2b0352f9e03488986679374c961a599bb",
"currentDifficulty" : null,
"currentGasLimit" : "30000000",
"currentNumber" : "2406802",
"currentRandom" : "0x4e9706f5ba778390744684db2ff79bcb5dcb01f12abc80fe0c00f51b683d1de4",
"currentTimestamp" : "1727279772",
"currentExcessBlobGas" : "0",
"parentBeaconBlockRoot" : "0xbe5770ef9724d97fc836c3b8c80c8dd470c5abc2a9e7055cdca3088c1c7c062f",
"withdrawals": []
}

56
tools/t8n/testdata/00-528/exp.json vendored Normal file

File diff suppressed because one or more lines are too long

1
tools/t8n/testdata/00-528/txs.rlp vendored Normal file
View File

@ -0,0 +1 @@
"0xf87fb87d02f87a8242683984030cb99c84030cb9a78401b2e02094d9c9c67288f3a8eff7b2746bdff6e9c933f042fb880de0b6b3a7640000847a5f0dc4c080a08609509b59a44a69f425f8b22c44c5f2f870194aeefe5417cc7f2fba2a469c0aa06b889b0d35370b254baaf4162ea350395e3eae1a2b2d59de6c550844c4b86261"