Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into snapserver_at_least…
Browse files Browse the repository at this point in the history
…_1_resp
  • Loading branch information
jframe committed Jun 12, 2024
2 parents 524f9cf + c7e2e4d commit 8827c0d
Show file tree
Hide file tree
Showing 40 changed files with 1,492 additions and 406 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,18 @@

### Additions and Improvements
- Add two counters to DefaultBlockchain in order to be able to calculate TPS and Mgas/s [#7105](https://github.com/hyperledger/besu/pull/7105)
- Improve genesis state performance at startup [#6977](https://github.com/hyperledger/besu/pull/6977)
- Enable --Xbonsai-limit-trie-logs-enabled by default, unless sync-mode=FULL [#7181](https://github.com/hyperledger/besu/pull/7181)
- Promote experimental --Xbonsai-limit-trie-logs-enabled to production-ready, --bonsai-limit-trie-logs-enabled [#7192](https://github.com/hyperledger/besu/pull/7192)
- Promote experimental --Xbonsai-trie-logs-pruning-window-size to production-ready, --bonsai-trie-logs-pruning-window-size [#7192](https://github.com/hyperledger/besu/pull/7192)
- `admin_nodeInfo` JSON/RPC call returns the currently active EVM version [#7127](https://github.com/hyperledger/besu/pull/7127)
- Improve the selection of the most profitable built block [#7174](https://github.com/hyperledger/besu/pull/7174)
- Support for eth_maxPriorityFeePerGas [#5658](https://github.com/hyperledger/besu/issues/5658)
- Enable continuous profiling with default setting [#7006](https://github.com/hyperledger/besu/pull/7006)

### Bug fixes
- Make `eth_gasPrice` aware of the base fee market [#7102](https://github.com/hyperledger/besu/pull/7102)

- Validation errors ignored in accounts-allowlist and empty list [#7138](https://github.com/hyperledger/besu/issues/7138)
## 24.5.2

### Upcoming Breaking Changes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,16 +461,30 @@ public BesuNode createIbft2Node(final String name, final String genesisFile) thr
.build());
}

public BesuNode createIbft2Node(final String name) throws IOException {
return create(
public BesuNode createIbft2Node(final String name, final boolean fixedPort) throws IOException {
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithIbft2EnabledConfig(false);
rpcConfig.addRpcApi("ADMIN,TXPOOL");
if (fixedPort) {
rpcConfig.setPort(
Math.abs(name.hashCode() % 60000)
+ 1024); // Generate a consistent port for p2p based on node name
}
BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithIbft2EnabledConfig(false))
.jsonRpcConfiguration(rpcConfig)
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(GenesisConfigurationFactory::createIbft2GenesisConfig)
.build());
.genesisConfigProvider(GenesisConfigurationFactory::createIbft2GenesisConfig);
if (fixedPort) {
builder.p2pPort(
Math.abs(name.hashCode() % 60000)
+ 1024
+ 500); // Generate a consistent port for p2p based on node name (+ 500 to avoid
// clashing with RPC port or other nodes with a similar name)
}
return create(builder.build());
}

public BesuNode createQbftNodeWithTLS(final String name, final String type) throws IOException {
Expand Down Expand Up @@ -498,16 +512,31 @@ public BesuNode createQbftNodeWithTLSPKCS11(final String name) throws IOExceptio
return createQbftNodeWithTLS(name, KeyStoreWrapper.KEYSTORE_TYPE_PKCS11);
}

public BesuNode createQbftNode(final String name) throws IOException {
return create(
public BesuNode createQbftNode(final String name, final boolean fixedPort) throws IOException {
JsonRpcConfiguration rpcConfig = node.createJsonRpcWithQbftEnabledConfig(false);
rpcConfig.addRpcApi("ADMIN,TXPOOL");
if (fixedPort) {
rpcConfig.setPort(
Math.abs(name.hashCode() % 60000)
+ 1024); // Generate a consistent port for p2p based on node name
}

BesuNodeConfigurationBuilder builder =
new BesuNodeConfigurationBuilder()
.name(name)
.miningEnabled()
.jsonRpcConfiguration(node.createJsonRpcWithQbftEnabledConfig(false))
.jsonRpcConfiguration(rpcConfig)
.webSocketConfiguration(node.createWebSocketEnabledConfig())
.devMode(false)
.genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig)
.build());
.genesisConfigProvider(GenesisConfigurationFactory::createQbftGenesisConfig);
if (fixedPort) {
builder.p2pPort(
Math.abs(name.hashCode() % 60000)
+ 1024
+ 500); // Generate a consistent port for p2p based on node name (+ 500 to avoid
// clashing with RPC port or other nodes with a similar name)
}
return create(builder.build());
}

public BesuNode createCustomGenesisNode(
Expand Down
32 changes: 32 additions & 0 deletions acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ solidity {
resolvePackages = false
// TODO: remove the forced version, when DEV network is upgraded to support latest forks
version '0.8.19'
evmVersion 'london'
}

dependencies {
Expand Down Expand Up @@ -79,6 +80,7 @@ dependencies {
testImplementation 'org.web3j:besu'
testImplementation 'org.web3j:core'
testImplementation 'org.wiremock:wiremock'
testImplementation project(path: ':acceptance-tests:tests:shanghai')

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'
}
Expand Down Expand Up @@ -153,6 +155,7 @@ task acceptanceTestMainnet(type: Test) {
task acceptanceTestNotPrivacy(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
exclude '**/privacy/**'
exclude '**/bftsoak/**'

useJUnitPlatform {}

Expand Down Expand Up @@ -205,6 +208,35 @@ task acceptanceTestCliqueBft(type: Test) {
doFirst { mkdir "${buildDir}/jvmErrorLogs" }
}

task acceptanceTestBftSoak(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
include '**/bftsoak/**'

useJUnitPlatform {}

dependsOn(rootProject.installDist)
setSystemProperties(test.getSystemProperties())
systemProperty 'acctests.runBesuAsProcess', 'true'
// Set to any time > 60 minutes to run the soak test for longer
// systemProperty 'acctests.soakTimeMins', '120'
systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security"
mustRunAfter rootProject.subprojects*.test
description = 'Runs BFT soak test.'
group = 'verification'

jvmArgs "-XX:ErrorFile=${buildDir}/jvmErrorLogs/java_err_pid%p.log"

testLogging {
exceptionFormat = 'full'
showStackTraces = true
showStandardStreams = true
showExceptions = true
showCauses = true
}

doFirst { mkdir "${buildDir}/jvmErrorLogs" }
}

task acceptanceTestPrivacy(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
include '**/privacy/**'
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/CrossContractReader.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "./EventEmitter.sol";
// compile with:
// solc CrossContractReader.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/CrossContractReader.bin -a ./generated/CrossContractReader.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
// web3j generate solidity -b ./generated/CrossContractReader.bin -a ./generated/CrossContractReader.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract CrossContractReader {
uint counter;

Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/EventEmitter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pragma solidity >=0.7.0 <0.9.0;
// compile with:
// solc EventEmitter.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/EventEmitter.bin -a ./generated/EventEmitter.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
// web3j generate solidity -b ./generated/EventEmitter.bin -a ./generated/EventEmitter.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract EventEmitter {
address owner;
event stored(address _to, uint _amount);
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/RemoteSimpleStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "./SimpleStorage.sol";
// compile with:
// solc RemoteSimpleStorage.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/RemoteSimpleStorage.bin -a ./generated/RemoteSimpleStorage.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
// web3j generate solidity -b ./generated/RemoteSimpleStorage.bin -a ./generated/RemoteSimpleStorage.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract RemoteSimpleStorage {
SimpleStorage public simpleStorage;

Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/RevertReason.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pragma solidity >=0.7.0 <0.9.0;
// compile with:
// solc RevertReason.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/RevertReason.bin -a ./generated/RevertReason.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
// web3j generate solidity -b ./generated/RevertReason.bin -a ./generated/RevertReason.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract RevertReason {

function revertWithRevertReason() public pure returns (bool) {
Expand Down
2 changes: 1 addition & 1 deletion acceptance-tests/tests/contracts/SimpleStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pragma solidity >=0.7.0 <0.8.20;
// compile with:
// solc SimpleStorage.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/SimpleStorage.bin -a ./generated/SimpleStorage.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
// web3j generate solidity -b ./generated/SimpleStorage.bin -a ./generated/SimpleStorage.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract SimpleStorage {
uint data;

Expand Down
21 changes: 21 additions & 0 deletions acceptance-tests/tests/shanghai/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

plugins {
id 'org.web3j' version '4.11.3'
id 'org.web3j.solidity' version '0.4.1'
}

jar { enabled = true }

web3j {
generatedPackageName = 'org.hyperledger.besu.tests.web3j.generated'
}

sourceSets.main.solidity.srcDirs = [
"$projectDir/shanghaicontracts"
]

solidity {
resolvePackages = false
version '0.8.25'
evmVersion 'shanghai'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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
*/
pragma solidity >=0.8.20;

// compile with:
// solc SimpleStorageShanghai.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j generate solidity -b ./SimpleStorageShanghai.bin -a ./SimpleStorageShanghai.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract SimpleStorageShanghai {
uint data;

function set(uint value) public {
data = value;
}

function get() public view returns (uint) {
return data;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public static Stream<Arguments> getFactories() {
@FunctionalInterface
public interface NodeCreator {

BesuNode create(BesuNodeFactory factory, String name) throws Exception;
BesuNode create(BesuNodeFactory factory, String name, boolean fixedPort) throws Exception;
}

@FunctionalInterface
public interface FixedPortNodeCreator {

BesuNode createFixedPort(BesuNodeFactory factory, String name, boolean fixedPort)
throws Exception;
}

@FunctionalInterface
Expand All @@ -57,7 +64,11 @@ public BftAcceptanceTestParameterization(
}

public BesuNode createNode(BesuNodeFactory factory, String name) throws Exception {
return creatorFn.create(factory, name);
return creatorFn.create(factory, name, false);
}

public BesuNode createNodeFixedPort(BesuNodeFactory factory, String name) throws Exception {
return creatorFn.create(factory, name, true);
}

public BesuNode createNodeWithValidators(
Expand Down
Loading

0 comments on commit 8827c0d

Please sign in to comment.