Skip to content

Commit

Permalink
Merge branch 'main' into jcKZGUprev
Browse files Browse the repository at this point in the history
  • Loading branch information
jflo authored Mar 18, 2024
2 parents 4aef975 + 5c1e1e1 commit 80f9457
Show file tree
Hide file tree
Showing 87 changed files with 755 additions and 100 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ jobs:
path: 'build/distributions/besu*.zip'
name: besu-${{ github.ref_name }}.zip
compression-level: 0
- name: Artifactory Publish
env:
ARTIFACTORY_USER: ${{ secrets.BESU_ARTIFACTORY }}
run: ./gradlew -Prelease.releaseVersion=${{ github.ref_name }} -Pversion=${{github.ref_name}} artifactoryPublish
testWindows:
runs-on: windows-2022
needs: artifacts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ jobs:
- name: run unit tests
id: unitTest
run: ./gradlew $GRADLEW_UNIT_TEST_ARGS
- name: Upload Acceptance Test Results
- name: Upload Unit Test Results
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: unit-${{matrix.filename}}-test-results
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2326,7 +2326,7 @@ Workaround - Limit the number of blocks queried by each `eth_getLogs` call.
- Implemented private contract log filters including JSON-RPC methods to interact with private filters. [\#735](https://github.com/hyperledger/besu/pull/735)
- Implemented EIP-2315: Simple Subroutines for the EVM [\#717](https://github.com/hyperledger/besu/pull/717)
- Implemented Splunk logging. [\#725](https://github.com/hyperledger/besu/pull/725)
- Implemented optional native library encryption. [\#675](https://github.com/hyperledger/besu/pull/675). To enable add `--Xsecp256k1-native-enabled` (for transaciton signatures) and/or `--Xaltbn128-native-enabled` (for altbn128 precomiled contracts) as command line options.
- Implemented optional native library encryption. [\#675](https://github.com/hyperledger/besu/pull/675). To enable add `--Xsecp256k1-native-enabled` (for transaction signatures) and/or `--Xaltbn128-native-enabled` (for altbn128 precomiled contracts) as command line options.

### Bug Fixes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import java.math.BigInteger;
import java.util.function.UnaryOperator;

import org.junit.Ignore;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -51,12 +52,15 @@ public void setUp() throws Exception {
}

@Test
@Ignore("flaky with timeout")
public void shouldSendSuccessfullyToLenientNodeWithoutChainId() {
final TransferTransaction tx = createTransactionWithoutChainId();
final String rawTx = tx.signedTransactionData();
final String txHash = tx.transactionHash();

lenientNode.verify(eth.expectSuccessfulEthRawTransaction(rawTx));

// this line is where the test is flaky
// Tx should be included on-chain
miningNode.verify(eth.expectSuccessfulTransactionReceipt(txHash));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2598,7 +2598,7 @@ String getLogLevel() {
}

/**
* Returns the flag indicating that version compatiblity checks will be made.
* Returns the flag indicating that version compatibility checks will be made.
*
* @return true if compatibility checks should be made, otherwise false
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ protected ProtocolSchedule createProtocolSchedule() {
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
badBlockManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ protected ProtocolSchedule createProtocolSchedule() {
isRevertReasonEnabled,
bftExtraDataCodec().get(),
evmConfiguration,
miningParameters,
badBlockManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ protected ProtocolSchedule createProtocolSchedule() {
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
badBlockManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ protected MiningCoordinator createTransitionMiningCoordinator(
@Override
protected ProtocolSchedule createProtocolSchedule() {
return MergeProtocolSchedule.create(
configOptionsSupplier.get(), privacyParameters, isRevertReasonEnabled, badBlockManager);
configOptionsSupplier.get(),
privacyParameters,
isRevertReasonEnabled,
miningParameters,
badBlockManager);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ protected ProtocolSchedule createProtocolSchedule() {
isRevertReasonEnabled,
bftExtraDataCodec().get(),
evmConfiguration,
miningParameters,
badBlockManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.hyperledger.besu.ethereum.chain.GenesisState;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.MilestoneStreamingProtocolSchedule;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.forkid.ForkId;
import org.hyperledger.besu.ethereum.forkid.ForkIdManager;
import org.hyperledger.besu.ethereum.mainnet.DefaultProtocolSchedule;
Expand Down Expand Up @@ -188,11 +189,13 @@ private static MilestoneStreamingTransitionProtocolSchedule createSchedule(
MilestoneStreamingProtocolSchedule preMergeProtocolSchedule =
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
MainnetProtocolSchedule.fromConfig(configOptions, new BadBlockManager()));
MainnetProtocolSchedule.fromConfig(
configOptions, MiningParameters.MINING_DISABLED, new BadBlockManager()));
MilestoneStreamingProtocolSchedule postMergeProtocolSchedule =
new MilestoneStreamingProtocolSchedule(
(DefaultProtocolSchedule)
MergeProtocolSchedule.create(configOptions, false, new BadBlockManager()));
MergeProtocolSchedule.create(
configOptions, false, MiningParameters.MINING_DISABLED, new BadBlockManager()));
final MilestoneStreamingTransitionProtocolSchedule schedule =
new MilestoneStreamingTransitionProtocolSchedule(
preMergeProtocolSchedule, postMergeProtocolSchedule);
Expand Down
10 changes: 2 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,6 @@ publishing {
groupId = '.'
version = project.version
artifactId = 'besu'
artifact("$buildDir/distributions/besu-${project.version}.zip")
artifact("$buildDir/distributions/besu-${project.version}.tar.gz") { extension = 'tar.gz' }
}
}
}
Expand All @@ -698,11 +696,6 @@ def artifactoryOrg = System.getenv('ARTIFACTORY_ORG') ?: 'hyperledger'
artifactory {
contextUrl = "https://hyperledger.jfrog.io/${artifactoryOrg}"
publish {
repository {
repoKey = "besu-binaries"
username = artifactoryUser
password = artifactoryKey
}
defaults {
publications('distArtifactory')
publishArtifacts = true
Expand Down Expand Up @@ -766,9 +759,10 @@ task distDocker {
dockerPlatform = "--platform ${project.getProperty('docker-platform')}"
println "Building for platform ${project.getProperty('docker-platform')}"
}
def gitDetails = getGitCommitDetails(10)
executable "sh"
workingDir dockerBuildDir
args "-c", "docker build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${getCheckedOutGitCommitHash()} -t ${image} ."
args "-c", "docker build ${dockerPlatform} --build-arg BUILD_DATE=${buildTime()} --build-arg VERSION=${dockerBuildVersion} --build-arg VCS_REF=${gitDetails.hash} -t ${image} ."
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,13 @@ default boolean isConsensusMigration() {
*/
boolean isZeroBaseFee();

/**
* Force a Base Fee as Gas Price network to used with London/EIP-1559.
*
* @return true, if you want the next block to use the base fee as gas price.
*/
boolean isFixedBaseFee();

/**
* The deposit contract address that should be in the logger field in Receipt of Deposit
* transaction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public class JsonGenesisConfigOptions implements GenesisConfigOptions {
private static final String DISCOVERY_CONFIG_KEY = "discovery";
private static final String CHECKPOINT_CONFIG_KEY = "checkpoint";
private static final String ZERO_BASE_FEE_KEY = "zerobasefee";
private static final String FIXED_BASE_FEE_KEY = "fixedbasefee";
private static final String DEPOSIT_CONTRACT_ADDRESS_KEY = "depositcontractaddress";

private final ObjectNode configRoot;
Expand Down Expand Up @@ -421,6 +422,11 @@ public boolean isZeroBaseFee() {
return getOptionalBoolean(ZERO_BASE_FEE_KEY).orElse(false);
}

@Override
public boolean isFixedBaseFee() {
return getOptionalBoolean(FIXED_BASE_FEE_KEY).orElse(false);
}

@Override
public Optional<Address> getDepositContractAddress() {
Optional<String> inputAddress = JsonUtil.getString(configRoot, DEPOSIT_CONTRACT_ADDRESS_KEY);
Expand Down Expand Up @@ -492,6 +498,10 @@ public Map<String, Object> asMap() {
builder.put("zeroBaseFee", true);
}

if (isFixedBaseFee()) {
builder.put("fixedBaseFee", true);
}

return builder.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public class StubGenesisConfigOptions implements GenesisConfigOptions, Cloneable
private TransitionsConfigOptions transitions = TransitionsConfigOptions.DEFAULT;
private static final DiscoveryOptions DISCOVERY_OPTIONS = DiscoveryOptions.DEFAULT;
private boolean zeroBaseFee = false;
private boolean fixedBaseFee = false;

@Override
public StubGenesisConfigOptions clone() {
Expand Down Expand Up @@ -424,6 +425,11 @@ public boolean isZeroBaseFee() {
return zeroBaseFee;
}

@Override
public boolean isFixedBaseFee() {
return fixedBaseFee;
}

@Override
public List<Long> getForkBlockNumbers() {
return Collections.emptyList();
Expand Down Expand Up @@ -704,6 +710,17 @@ public StubGenesisConfigOptions zeroBaseFee(final boolean zeroBaseFee) {
return this;
}

/**
* Fixed base fee per gas stub genesis config options.
*
* @param fixedBaseFee the zero base fee override
* @return the stub genesis config options
*/
public StubGenesisConfigOptions fixedBaseFee(final boolean fixedBaseFee) {
this.fixedBaseFee = fixedBaseFee;
return this;
}

/**
* Classic fork block stub genesis config options.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,27 @@ void asMapIncludesZeroBaseFee() {
assertThat(config.asMap()).containsOnlyKeys("zeroBaseFee").containsValue(true);
}

@Test
void isFixedBaseFeeShouldDefaultToFalse() {
final GenesisConfigOptions config = GenesisConfigFile.fromConfig("{}").getConfigOptions();

assertThat(config.isFixedBaseFee()).isFalse();
}

@Test
void isFixedBaseFeeParsedCorrectly() {
final GenesisConfigOptions config = fromConfigOptions(Map.of("fixedbasefee", true));

assertThat(config.isFixedBaseFee()).isTrue();
}

@Test
void asMapIncludesFixedBaseFee() {
final GenesisConfigOptions config = fromConfigOptions(Map.of("fixedbasefee", true));

assertThat(config.asMap()).containsOnlyKeys("fixedBaseFee").containsValue(true);
}

@Test
void shouldGetDepositContractAddress() {
final GenesisConfigOptions config =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.datatypes.Address;
import org.hyperledger.besu.datatypes.Wei;
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.core.PrivacyParameters;
import org.hyperledger.besu.ethereum.core.Util;
import org.hyperledger.besu.ethereum.mainnet.BlockHeaderValidator;
Expand Down Expand Up @@ -58,6 +59,7 @@ public class CliqueProtocolSchedule {
* @param privacyParameters the privacy parameters
* @param isRevertReasonEnabled the is revert reason enabled
* @param evmConfiguration the evm configuration
* @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
Expand All @@ -68,6 +70,7 @@ public static ProtocolSchedule create(
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {

final CliqueConfigOptions cliqueConfig = config.getCliqueConfigOptions();
Expand Down Expand Up @@ -103,6 +106,7 @@ public static ProtocolSchedule create(
privacyParameters,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
badBlockManager)
.createProtocolSchedule();
}
Expand All @@ -115,6 +119,7 @@ public static ProtocolSchedule create(
* @param nodeKey the node key
* @param isRevertReasonEnabled the is revert reason enabled
* @param evmConfiguration the evm configuration
* @param miningParameters the mining parameters
* @param badBlockManager the cache to use to keep invalid blocks
* @return the protocol schedule
*/
Expand All @@ -125,6 +130,7 @@ public static ProtocolSchedule create(
final NodeKey nodeKey,
final boolean isRevertReasonEnabled,
final EvmConfiguration evmConfiguration,
final MiningParameters miningParameters,
final BadBlockManager badBlockManager) {
return create(
config,
Expand All @@ -133,6 +139,7 @@ public static ProtocolSchedule create(
PrivacyParameters.DEFAULT,
isRevertReasonEnabled,
evmConfiguration,
miningParameters,
badBlockManager);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.hyperledger.besu.ethereum.chain.BadBlockManager;
import org.hyperledger.besu.ethereum.core.BlockHeader;
import org.hyperledger.besu.ethereum.core.BlockHeaderTestFixture;
import org.hyperledger.besu.ethereum.core.MiningParameters;
import org.hyperledger.besu.ethereum.mainnet.HeaderValidationMode;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSpec;
Expand Down Expand Up @@ -66,6 +67,7 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());

final ProtocolSpec homesteadSpec = protocolSchedule.getByBlockHeader(blockHeader(1));
Expand All @@ -89,6 +91,7 @@ public void parametersAlignWithMainnetWithAdjustments() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager())
.getByBlockHeader(blockHeader(0));

Expand All @@ -112,6 +115,7 @@ public void zeroEpochLengthThrowsException() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
Expand All @@ -131,6 +135,7 @@ public void negativeEpochLengthThrowsException() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager()))
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Epoch length in config must be greater than zero");
Expand All @@ -154,6 +159,7 @@ public void shouldValidateBaseFeeMarketTransition() {
NODE_KEY,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());

BlockHeader emptyFrontierParent =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public void setup() {
proposerNodeKey,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());

final Address otherAddress = Util.publicKeyToAddress(otherKeyPair.getPublicKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void setup() {
proposerNodeKey,
false,
EvmConfiguration.DEFAULT,
MiningParameters.MINING_DISABLED,
new BadBlockManager());
cliqueEthContext = mock(EthContext.class, RETURNS_DEEP_STUBS);
blockHeaderBuilder = new BlockHeaderTestFixture();
Expand Down
Loading

0 comments on commit 80f9457

Please sign in to comment.