forked from hyperledger/besu
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eth_getBlockByNumber and eth_getBlockByHash Shanghai Acceptance Test (h…
…yperledger#5146) Add an acceptance test to ensure eth_getBlockByNumber and eth_getBlockByHash return withdrawals correctly for shanghai Signed-off-by: Simon Dudley <simon.dudley@consensys.net>
- Loading branch information
1 parent
f1a0dce
commit e8da631
Showing
14 changed files
with
507 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...edger/besu/tests/acceptance/jsonrpc/EthGetBlockByNumberAndHashShanghaiAcceptanceTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright Hyperledger Besu Contributors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.tests.acceptance.jsonrpc; | ||
|
||
import java.io.IOException; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
|
||
import org.junit.AfterClass; | ||
import org.junit.BeforeClass; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Parameterized; | ||
|
||
@RunWith(Parameterized.class) | ||
public class EthGetBlockByNumberAndHashShanghaiAcceptanceTest extends AbstractJsonRpcTest { | ||
private static final String TEST_RESOURCES_DIR = "/jsonrpc/eth/getBlockBy/"; | ||
private static final String GENESIS_FILE = TEST_RESOURCES_DIR + "genesis.json"; | ||
private static final String TEST_CASE_PATH = TEST_RESOURCES_DIR + "test-cases/"; | ||
|
||
private static AbstractJsonRpcTest.JsonRpcTestsContext testsContext; | ||
|
||
public EthGetBlockByNumberAndHashShanghaiAcceptanceTest( | ||
final String ignored, final URI testCaseFileURI) { | ||
super(ignored, testsContext, testCaseFileURI); | ||
} | ||
|
||
@BeforeClass | ||
public static void init() throws IOException { | ||
testsContext = new JsonRpcTestsContext(GENESIS_FILE); | ||
} | ||
|
||
@Parameterized.Parameters(name = "{0}") | ||
public static Iterable<Object[]> testCases() throws URISyntaxException { | ||
return testCases(TEST_CASE_PATH); | ||
} | ||
|
||
@AfterClass | ||
public static void tearDown() { | ||
testsContext.cluster.close(); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
acceptance-tests/tests/src/test/resources/jsonrpc/eth/getBlockBy/genesis.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"config": { | ||
"chainId":1, | ||
"homesteadBlock":0, | ||
"eip150Block":0, | ||
"eip155Block":0, | ||
"eip158Block":0, | ||
"byzantiumBlock":0, | ||
"constantinopleBlock":0, | ||
"petersburgBlock":0, | ||
"istanbulBlock":0, | ||
"muirGlacierBlock":0, | ||
"berlinBlock":0, | ||
"londonBlock":0, | ||
"shanghaiTime":10, | ||
"clique": { | ||
"period": 5, | ||
"epoch": 30000 | ||
}, | ||
"terminalTotalDifficulty":0 | ||
}, | ||
"nonce":"0x42", | ||
"timestamp":"0x0", | ||
"extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"gasLimit":"0x1C9C380", | ||
"difficulty":"0x400000000", | ||
"mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"coinbase":"0x0000000000000000000000000000000000000000", | ||
"alloc":{ | ||
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":{"balance":"0x6d6172697573766477000000"} | ||
}, | ||
"number":"0x0", | ||
"gasUsed":"0x0", | ||
"parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"baseFeePerGas":"0x7" | ||
} |
35 changes: 35 additions & 0 deletions
35
...ests/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/01_execute_payload_1.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "engine_newPayloadV2", | ||
"params": [ | ||
{ | ||
"parentHash": "0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", | ||
"feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"stateRoot": "0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"blockNumber": "0x1", | ||
"gasLimit": "0x1c9c380", | ||
"gasUsed": "0x0", | ||
"timestamp": "0x5", | ||
"extraData": "0x", | ||
"baseFeePerGas": "0x7", | ||
"blockHash": "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", | ||
"transactions": [] | ||
} | ||
], | ||
"id": 67 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 67, | ||
"result": { | ||
"status": "VALID", | ||
"latestValidHash": "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", | ||
"validationError": null | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
36 changes: 36 additions & 0 deletions
36
...ests/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/02_execute_payload_2.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "engine_newPayloadV2", | ||
"params": [ | ||
{ | ||
"parentHash": "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", | ||
"feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"stateRoot": "0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"blockNumber": "0x2", | ||
"gasLimit": "0x1c9c380", | ||
"gasUsed": "0x0", | ||
"timestamp": "0x10", | ||
"extraData": "0x", | ||
"baseFeePerGas": "0x7", | ||
"blockHash": "0x7c2a09bedc85268606805e6df579e758af8d832ef9826927ce4b4b14452a32cf", | ||
"transactions": [], | ||
"withdrawals": [] | ||
} | ||
], | ||
"id": 67 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 67, | ||
"result": { | ||
"status": "VALID", | ||
"latestValidHash": "0x7c2a09bedc85268606805e6df579e758af8d832ef9826927ce4b4b14452a32cf", | ||
"validationError": null | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
49 changes: 49 additions & 0 deletions
49
...ests/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/03_execute_payload_3.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{ | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "engine_newPayloadV2", | ||
"params": [ | ||
{ | ||
"parentHash": "0x7c2a09bedc85268606805e6df579e758af8d832ef9826927ce4b4b14452a32cf", | ||
"feeRecipient": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"stateRoot": "0x7a6f2e03f2348dc75731e6e767c97a88da50430748a030874e27f7c3fac3d49d", | ||
"receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"prevRandao": "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"blockNumber": "0x3", | ||
"gasLimit": "0x1c9c380", | ||
"gasUsed": "0x0", | ||
"timestamp": "0x11", | ||
"extraData": "0x", | ||
"baseFeePerGas": "0x7", | ||
"blockHash": "0x77edeba4adb3cb3e365fccb48393c8445a5c4c6648ec660806c2ce1e9de13fd3", | ||
"transactions": [], | ||
"withdrawals": [ | ||
{ | ||
"index": "0x0", | ||
"validatorIndex": "0x0", | ||
"address": "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"amount": "0x1" | ||
}, | ||
{ | ||
"index": "0x1", | ||
"validatorIndex": "0x0", | ||
"address": "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73", | ||
"amount": "0x2" | ||
} | ||
] | ||
} | ||
], | ||
"id": 67 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 67, | ||
"result": { | ||
"status": "VALID", | ||
"latestValidHash": "0x77edeba4adb3cb3e365fccb48393c8445a5c4c6648ec660806c2ce1e9de13fd3", | ||
"validationError": null | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
28 changes: 28 additions & 0 deletions
28
...ests/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/04_update_forkchoice.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"request": { | ||
"jsonrpc": "2.0", | ||
"method": "engine_forkchoiceUpdatedV2", | ||
"params": [ | ||
{ | ||
"headBlockHash": "0x77edeba4adb3cb3e365fccb48393c8445a5c4c6648ec660806c2ce1e9de13fd3", | ||
"safeBlockHash": "0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", | ||
"finalizedBlockHash": "0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a" | ||
}, | ||
null | ||
], | ||
"id": 67 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 67, | ||
"result": { | ||
"payloadStatus": { | ||
"status": "VALID", | ||
"latestValidHash": "0x77edeba4adb3cb3e365fccb48393c8445a5c4c6648ec660806c2ce1e9de13fd3", | ||
"validationError": null | ||
}, | ||
"payloadId": null | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
33 changes: 33 additions & 0 deletions
33
...ests/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/05_get_genesis_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"request": { | ||
"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0", false],"id":1 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result" : { | ||
"number" : "0x0", | ||
"hash" : "0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", | ||
"mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"nonce" : "0x0000000000000042", | ||
"sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"transactionsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot" : "0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", | ||
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"miner" : "0x0000000000000000000000000000000000000000", | ||
"difficulty" : "0x400000000", | ||
"totalDifficulty" : "0x400000000", | ||
"extraData":"0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"baseFeePerGas" : "0x7", | ||
"size" : "0x275", | ||
"gasLimit" : "0x1c9c380", | ||
"gasUsed" : "0x0", | ||
"timestamp" : "0x0", | ||
"uncles" : [ ], | ||
"transactions" : [ ] | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
33 changes: 33 additions & 0 deletions
33
...s/tests/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/06_get_last_paris_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"request": { | ||
"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x1", false],"id":1 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result" : { | ||
"number" : "0x1", | ||
"hash" : "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", | ||
"mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash" : "0x3b8fb240d288781d4aac94d3fd16809ee413bc99294a085798a589dae51ddd4a", | ||
"nonce" : "0x0000000000000000", | ||
"sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"transactionsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot" : "0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", | ||
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"difficulty" : "0x0", | ||
"totalDifficulty" : "0x400000000", | ||
"extraData" : "0x", | ||
"baseFeePerGas" : "0x7", | ||
"size" : "0x1fa", | ||
"gasLimit" : "0x1c9c380", | ||
"gasUsed" : "0x0", | ||
"timestamp" : "0x5", | ||
"uncles" : [ ], | ||
"transactions" : [ ] | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
35 changes: 35 additions & 0 deletions
35
...sts/src/test/resources/jsonrpc/eth/getBlockBy/test-cases/07_get_first_shanghai_block.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{ | ||
"request": { | ||
"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x2", false],"id":1 | ||
}, | ||
"response": { | ||
"jsonrpc": "2.0", | ||
"id": 1, | ||
"result" : { | ||
"number" : "0x2", | ||
"hash" : "0x7c2a09bedc85268606805e6df579e758af8d832ef9826927ce4b4b14452a32cf", | ||
"mixHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", | ||
"parentHash" : "0x3559e851470f6e7bbed1db474980683e8c315bfce99b2a6ef47c057c04de7858", | ||
"nonce" : "0x0000000000000000", | ||
"sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", | ||
"logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", | ||
"transactionsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"stateRoot" : "0xca3149fa9e37db08d1cd49c9061db1002ef1cd58db2210f2115c8c989b2bdf45", | ||
"receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"miner" : "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", | ||
"difficulty" : "0x0", | ||
"totalDifficulty" : "0x400000000", | ||
"extraData" : "0x", | ||
"baseFeePerGas" : "0x7", | ||
"size" : "0x21c", | ||
"gasLimit" : "0x1c9c380", | ||
"gasUsed" : "0x0", | ||
"timestamp" : "0x10", | ||
"uncles" : [ ], | ||
"transactions" : [ ], | ||
"withdrawalsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", | ||
"withdrawals": [ ] | ||
} | ||
}, | ||
"statusCode": 200 | ||
} |
Oops, something went wrong.