Skip to content

Commit

Permalink
Release 23.10.0-RC burn in (hyperledger#5989)
Browse files Browse the repository at this point in the history
* Expose getSize to transaction interface (hyperledger#5983)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>

* Add parameters to EVM library fluent API (hyperledger#5930)

Add the ability to configure more parameters in the fluent API.
Specifically contract address, coinbase, difficulty, mixHash/prevRandao,
baseFee, block number, timestamp, gas limit, previous block hashes, and
versioned hashes. Also create EVM forks parametrically instead of by
a method name.

Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>

* Validation ordering (hyperledger#5986)

* re-ordering error reporting priority
* fixes fork checking on getPayload
* adds acceptance test reproducing an issue where built blocks have proofs > txs
* test coverage and fix for subtle re-org bug prior to proposals
---------

Signed-off-by: Justin Florentine <justin+github@florentine.us>

* [4844] EngineNewPayload - Add Blob Count validation (hyperledger#5973)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>

* Plugin Api - Add evaluateTransactionPostProcessing to TransactionSelector interface (hyperledger#5988)

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>

* Only use the builder to create transactions (hyperledger#5980)

Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>

---------

Signed-off-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Signed-off-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Co-authored-by: Gabriel-Trintinalia <gabriel.trintinalia@consensys.net>
Co-authored-by: Danno Ferrin <danno.ferrin@swirldslabs.com>
Co-authored-by: Justin Florentine <justin+github@florentine.us>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
  • Loading branch information
4 people committed Nov 10, 2023
1 parent 44ad404 commit 512b49b
Show file tree
Hide file tree
Showing 69 changed files with 3,980 additions and 3,706 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ public BesuNode createExecutionEngineGenesisNode(final String name, final String
.bootnodeEligible(false)
.miningEnabled()
.jsonRpcEnabled()
.jsonRpcTxPool()
.engineRpcEnabled(true)
.jsonRpcDebug()
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -82,9 +83,18 @@ public void test() throws IOException {
testsContext.mapper.readValue(testCaseFileURI.toURL(), JsonRpcTestCase.class);

final String rpcMethod = String.valueOf(testCase.getRequest().get("method"));

OkHttpClient client = testsContext.httpClient;
if (System.getenv("BESU_DEBUG_CHILD_PROCESS_PORT") != null) {
// if running in debug mode, set a longer timeout
client =
testsContext
.httpClient
.newBuilder()
.readTimeout(900, java.util.concurrent.TimeUnit.SECONDS)
.build();
}
final Call testRequest =
testsContext.httpClient.newCall(
client.newCall(
new Request.Builder()
.url(getRpcUrl(rpcMethod))
.post(RequestBody.create(testCase.getRequest().toString(), MEDIA_TYPE_JSON))
Expand All @@ -93,6 +103,7 @@ public void test() throws IOException {

assertThat(response.code()).isEqualTo(testCase.getStatusCode());
final ObjectNode actualBody = JsonUtil.objectNodeFromString(response.body().string());
evaluateResponse(actualBody, testRequest, testCase, testCaseFileURI.toURL());
final ObjectNode expectedBody =
JsonUtil.objectNodeFromString(testCase.getResponse().toString());
assertThat(actualBody)
Expand All @@ -101,6 +112,12 @@ public void test() throws IOException {
.isEqualTo(expectedBody);
}

protected void evaluateResponse(
final ObjectNode responseBody,
final Call testRequest,
final JsonRpcTestCase testCase,
final URL url) {}

private String getRpcUrl(final String rpcMethod) {
if (rpcMethod.contains("eth_") || rpcMethod.contains("engine_")) {
return testsContext.besuNode.engineRpcUrl().get();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright contributors to Hyperledger Besu.
*
* 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 static org.assertj.core.api.Assertions.assertThat;

import org.hyperledger.besu.tests.acceptance.dsl.rpc.JsonRpcTestCase;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.JsonNodeType;
import com.fasterxml.jackson.databind.node.ObjectNode;
import okhttp3.Call;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

@RunWith(Parameterized.class)
public class ExecutionEngineCancunBlockBuildingAcceptanceTest extends AbstractJsonRpcTest {
private static final String GENESIS_FILE = "/jsonrpc/engine/cancun/genesis.json";
private static final String TEST_CASE_PATH = "/jsonrpc/engine/cancun/test-cases/block-production";

private static JsonRpcTestsContext testsContext;

public ExecutionEngineCancunBlockBuildingAcceptanceTest(
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);
}

@Override
protected void evaluateResponse(
final ObjectNode responseBody,
final Call testRequest,
final JsonRpcTestCase testCase,
final URL url) {
if (url.toString().endsWith("10_cancun_build_on_genesis.json")) {
// if we just asked the node to build, give it some time to build
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
if (url.toString().endsWith("12_cancun_get_built_block.json")) {

// final ObjectNode rpcResponse = JsonUtil.objectNodeFromString(response.body().string());
final ObjectNode result = (ObjectNode) responseBody.get("result");
final ObjectNode execPayload = (ObjectNode) result.get("executionPayload");
final ObjectNode blobsBundle = (ObjectNode) result.get("blobsBundle");
assertThat(execPayload.get("transactions").getNodeType()).isEqualTo(JsonNodeType.ARRAY);
final ArrayNode transactions = (ArrayNode) execPayload.get("transactions");
// actually, you need to decode the transactions and count how many unique
// versioned hashes are referenced amongst them.
assertThat(blobsBundle.get("commitments").getNodeType()).isEqualTo(JsonNodeType.ARRAY);
final ArrayNode commitments = (ArrayNode) blobsBundle.get("commitments");
assertThat(blobsBundle.get("blobs").getNodeType()).isEqualTo(JsonNodeType.ARRAY);
final ArrayNode blobs = (ArrayNode) blobsBundle.get("blobs");
final ArrayNode proofs = (ArrayNode) blobsBundle.get("proofs");
assertThat(2).isEqualTo(transactions.size());
assertThat(6).isEqualTo(commitments.size());
assertThat(6).isEqualTo(blobs.size());
assertThat(6).isEqualTo(proofs.size());
}
}

@AfterClass
public static void tearDown() {
testsContext.cluster.close();
}
}
Loading

0 comments on commit 512b49b

Please sign in to comment.