Skip to content

Commit

Permalink
Merge pull request #76 from jflo/gha_testReportPermissions
Browse files Browse the repository at this point in the history
Gha test report permissions
  • Loading branch information
jflo authored Feb 7, 2024
2 parents 944d074 + 4f916b8 commit 38781e6
Show file tree
Hide file tree
Showing 58 changed files with 882 additions and 174 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ jobs:
#then drop file extension, then insert --tests option between each.
run: cat testList.txt | sed -e 's@acceptance-tests/tests/src/test/java/@--tests\ @g;s@/@.@g;s/\.java//g' > gradleArgs.txt
- name: run acceptance tests
run: ./gradlew acceptanceTest `cat gradleArgs.txt` -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
run: ./gradlew acceptanceTestNotPrivacy `cat gradleArgs.txt` -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: cleanup tempfiles
run: rm testList.txt gradleArgs.txt
- name: Upload Acceptance Test Results
Expand All @@ -108,6 +108,7 @@ jobs:
if: (success() || failure()) # always run even if the build step fails
with:
report_paths: 'acceptance-tests/tests/build/test-results/acceptanceTest/TEST-*.xml'
annotate_only: true
acceptance-tests:
runs-on: ubuntu-22.04
needs: [ acceptanceTestEthereum ]
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,6 @@ jobs:
if: (success() || failure())
with:
report_paths: '**/build/test-results/integrationTest/TEST-*.xml'
annotate_only: true


1 change: 1 addition & 0 deletions .github/workflows/reference-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ jobs:
if: success() || failure() # always run even if the build step fails
with:
report_paths: '**/build/test-results/referenceTest/TEST-*.xml'
annotate_only: true
reference-tests:
runs-on: ubuntu-22.04
needs: [ referenceTestEthereum ]
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
- Added configuration options for `pragueTime` to genesis file for Prague fork development [#6473](https://github.com/hyperledger/besu/pull/6473)
- Moving trielog storage to RocksDB's blobdb to improve write amplications [#6289](https://github.com/hyperledger/besu/pull/6289)
- Support for `shanghaiTime` fork and Shanghai EVM smart contracts in QBFT/IBFT chains [#6353](https://github.com/hyperledger/besu/pull/6353)
- Change ExecutionHaltReason for contract creation collision case to return ILLEGAL_STATE_CHANGE [#6518](https://github.com/hyperledger/besu/pull/6518)
- Experimental feature `--Xbonsai-code-using-code-hash-enabled` for storing Bonsai code storage by code hash [#6505](https://github.com/hyperledger/besu/pull/6505)

### Bug fixes
- Fix the way an advertised host configured with `--p2p-host` is treated when communicating with the originator of a PING packet [#6225](https://github.com/hyperledger/besu/pull/6225)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public void unsubscribe(final Subscription subscription) {

public void verifyTotalEventsReceived(final int expectedTotalEventCount) {
WaitUtils.waitFor(
() -> assertThat(connection.getSubscriptionEvents()).hasSize(expectedTotalEventCount));
60, () -> assertThat(connection.getSubscriptionEvents()).hasSize(expectedTotalEventCount));
}
}
27 changes: 27 additions & 0 deletions acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,33 @@ task acceptanceTestMainnet(type: Test) {
doFirst { mkdir "${buildDir}/jvmErrorLogs" }
}

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

useJUnitPlatform {}

dependsOn(rootProject.installDist)
setSystemProperties(test.getSystemProperties())
systemProperty 'acctests.runBesuAsProcess', 'true'
systemProperty 'java.security.properties', "${buildDir}/resources/test/acceptanceTesting.security"
mustRunAfter rootProject.subprojects*.test
description = 'Runs MAINNET Besu acceptance tests (excluding privacy since they run nightly, and are being refactored).'
group = 'verification'

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

testLogging {
exceptionFormat = 'full'
showStackTraces = true
showStandardStreams = Boolean.getBoolean('acctests.showStandardStreams')
showExceptions = true
showCauses = true
}

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

task acceptanceTestCliqueBft(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
include '**/bft/**'
Expand Down
7 changes: 7 additions & 0 deletions besu/src/main/java/org/hyperledger/besu/cli/BesuCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,13 @@ private PrivacyParameters privacyParameters() {
if (syncMode == SyncMode.FAST) {
throw new ParameterException(commandLine, String.format("%s %s", "Fast sync", errorSuffix));
}
if (syncMode == SyncMode.SNAP) {
throw new ParameterException(commandLine, String.format("%s %s", "Snap sync", errorSuffix));
}
if (syncMode == SyncMode.CHECKPOINT) {
throw new ParameterException(
commandLine, String.format("%s %s", "Checkpoint sync", errorSuffix));
}
if (isPruningEnabled()) {
throw new ParameterException(commandLine, String.format("%s %s", "Pruning", errorSuffix));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.hyperledger.besu.cli.options.stable;

import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_CODE_USING_CODE_HASH_ENABLED;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_LIMIT_TRIE_LOGS_ENABLED;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.DEFAULT_BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE;
import static org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration.Unstable.MINIMUM_BONSAI_TRIE_LOG_RETENTION_LIMIT;
Expand Down Expand Up @@ -85,6 +86,14 @@ public static class Unstable {
description =
"The max number of blocks to load and prune trie logs for at startup. (default: ${DEFAULT-VALUE})")
private int bonsaiTrieLogPruningWindowSize = DEFAULT_BONSAI_TRIE_LOG_PRUNING_WINDOW_SIZE;

@CommandLine.Option(
hidden = true,
names = {"--Xbonsai-code-using-code-hash-enabled"},
arity = "1",
description =
"Enables code storage using code hash instead of by account hash. (default: ${DEFAULT-VALUE})")
private boolean bonsaiCodeUsingCodeHashEnabled = DEFAULT_BONSAI_CODE_USING_CODE_HASH_ENABLED;
}
/**
* Create data storage options.
Expand Down Expand Up @@ -138,6 +147,8 @@ static DataStorageOptions fromConfig(final DataStorageConfiguration domainObject
domainObject.getUnstable().getBonsaiLimitTrieLogsEnabled();
dataStorageOptions.unstableOptions.bonsaiTrieLogPruningWindowSize =
domainObject.getUnstable().getBonsaiTrieLogPruningWindowSize();
dataStorageOptions.unstableOptions.bonsaiCodeUsingCodeHashEnabled =
domainObject.getUnstable().getBonsaiCodeStoredByCodeHashEnabled();

return dataStorageOptions;
}
Expand All @@ -151,6 +162,7 @@ public DataStorageConfiguration toDomainObject() {
ImmutableDataStorageConfiguration.Unstable.builder()
.bonsaiLimitTrieLogsEnabled(unstableOptions.bonsaiLimitTrieLogsEnabled)
.bonsaiTrieLogPruningWindowSize(unstableOptions.bonsaiTrieLogPruningWindowSize)
.bonsaiCodeStoredByCodeHashEnabled(unstableOptions.bonsaiCodeUsingCodeHashEnabled)
.build())
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,8 +580,7 @@ public BesuController build() {

final ProtocolSchedule protocolSchedule = createProtocolSchedule();
final GenesisState genesisState =
GenesisState.fromConfig(
dataStorageConfiguration.getDataStorageFormat(), genesisConfig, protocolSchedule);
GenesisState.fromConfig(dataStorageConfiguration, genesisConfig, protocolSchedule);

final VariablesStorage variablesStorage = storageProvider.createVariablesStorage();

Expand Down
18 changes: 18 additions & 0 deletions besu/src/test/java/org/hyperledger/besu/cli/BesuCommandTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -2590,6 +2590,24 @@ public void privacyWithFastSyncMustError() {
assertThat(commandOutput.toString(UTF_8)).isEmpty();
}

@Test
public void privacyWithSnapSyncMustError() {
parseCommand("--sync-mode=SNAP", "--privacy-enabled");

assertThat(commandErrorOutput.toString(UTF_8))
.contains("Snap sync cannot be enabled with privacy.");
assertThat(commandOutput.toString(UTF_8)).isEmpty();
}

@Test
public void privacyWithCheckpointSyncMustError() {
parseCommand("--sync-mode=CHECKPOINT", "--privacy-enabled");

assertThat(commandErrorOutput.toString(UTF_8))
.contains("Checkpoint sync cannot be enabled with privacy.");
assertThat(commandOutput.toString(UTF_8)).isEmpty();
}

@Test
public void privacyWithPruningMustError() {
parseCommand("--pruning-enabled", "--privacy-enabled");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,28 @@ public void bonsaiTrieLogRetentionLimitShouldBeAboveMinimum() {
"511");
}

@Test
public void bonsaiCodeUsingCodeHashEnabledCanBeEnabled() {
internalTestSuccess(
dataStorageConfiguration ->
assertThat(
dataStorageConfiguration.getUnstable().getBonsaiCodeStoredByCodeHashEnabled())
.isEqualTo(true),
"--Xbonsai-code-using-code-hash-enabled",
"true");
}

@Test
public void bonsaiCodeUsingCodeHashEnabledCanBeDisabled() {
internalTestSuccess(
dataStorageConfiguration ->
assertThat(
dataStorageConfiguration.getUnstable().getBonsaiCodeStoredByCodeHashEnabled())
.isEqualTo(false),
"--Xbonsai-code-using-code-hash-enabled",
"false");
}

@Override
protected DataStorageConfiguration createDefaultDomainObject() {
return DataStorageConfiguration.DEFAULT_CONFIG;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public void setup() throws IOException {

inMemoryWorldState =
new BonsaiWorldStateKeyValueStorage(
storageProvider, new NoOpMetricsSystem(), DataStorageConfiguration.DEFAULT_CONFIG);
storageProvider,
new NoOpMetricsSystem(),
DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);

createTrieLog(blockHeader1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,18 @@ BesuControllerBuilder visitWithMockConfigs(final BesuControllerBuilder builder)

@Test
public void shouldDisablePruningIfBonsaiIsEnabled() {
DataStorageConfiguration dataStorageConfiguration =
ImmutableDataStorageConfiguration.builder()
.dataStorageFormat(DataStorageFormat.BONSAI)
.bonsaiMaxLayersToLoad(DataStorageConfiguration.DEFAULT_BONSAI_MAX_LAYERS_TO_LOAD)
.build();
BonsaiWorldState mockWorldState = mock(BonsaiWorldState.class, Answers.RETURNS_DEEP_STUBS);
doReturn(worldStateArchive)
.when(besuControllerBuilder)
.createWorldStateArchive(
any(WorldStateStorage.class), any(Blockchain.class), any(CachedMerkleTrieLoader.class));
doReturn(mockWorldState).when(worldStateArchive).getMutable();

when(storageProvider.createWorldStateStorage(dataStorageConfiguration))
when(storageProvider.createWorldStateStorage(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG))
.thenReturn(bonsaiWorldStateStorage);
besuControllerBuilder.isPruningEnabled(true).dataStorageConfiguration(dataStorageConfiguration);
besuControllerBuilder
.isPruningEnabled(true)
.dataStorageConfiguration(DataStorageConfiguration.DEFAULT_BONSAI_CONFIG);
besuControllerBuilder.build();

verify(storageProvider, never())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ private boolean mustIgnore(final TraceFrame frame) {
} else if (frame.getExceptionalHaltReason().isPresent()) {
final Optional<ExceptionalHaltReason> haltReason = frame.getExceptionalHaltReason();
return haltReason.get() != ExceptionalHaltReason.INVALID_JUMP_DESTINATION
&& haltReason.get() != ExceptionalHaltReason.INSUFFICIENT_GAS;
&& haltReason.get() != ExceptionalHaltReason.INSUFFICIENT_GAS
&& haltReason.get() != ExceptionalHaltReason.ILLEGAL_STATE_CHANGE;
} else {
return frame.isVirtualOperation();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"init" : "0x600160015560015460025560ff60005360016000f3",
"value" : "0x0"
},
"error" : "Out of gas",
"error" : "Illegal state change",
"subtraces" : 0,
"traceAddress" : [ 0 ],
"type" : "create"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.hyperledger.besu.ethereum.core.Withdrawal;
import org.hyperledger.besu.ethereum.mainnet.ProtocolSchedule;
import org.hyperledger.besu.ethereum.mainnet.ScheduleBasedBlockHeaderFunctions;
import org.hyperledger.besu.ethereum.worldstate.DataStorageFormat;
import org.hyperledger.besu.ethereum.worldstate.DataStorageConfiguration;
import org.hyperledger.besu.evm.account.MutableAccount;
import org.hyperledger.besu.evm.log.LogsBloomFilter;
import org.hyperledger.besu.evm.worldstate.WorldUpdater;
Expand Down Expand Up @@ -77,16 +77,18 @@ public static GenesisState fromJson(final String json, final ProtocolSchedule pr
/**
* Construct a {@link GenesisState} from a JSON string.
*
* @param dataStorageFormat A {@link DataStorageFormat} describing the storage format to use
* @param dataStorageConfiguration A {@link DataStorageConfiguration} describing the storage
* configuration
* @param json A JSON string describing the genesis block
* @param protocolSchedule A protocol Schedule associated with
* @return A new {@link GenesisState}.
*/
public static GenesisState fromJson(
final DataStorageFormat dataStorageFormat,
final DataStorageConfiguration dataStorageConfiguration,
final String json,
final ProtocolSchedule protocolSchedule) {
return fromConfig(dataStorageFormat, GenesisConfigFile.fromConfig(json), protocolSchedule);
return fromConfig(
dataStorageConfiguration, GenesisConfigFile.fromConfig(json), protocolSchedule);
}

/**
Expand All @@ -98,27 +100,28 @@ public static GenesisState fromJson(
*/
public static GenesisState fromConfig(
final GenesisConfigFile config, final ProtocolSchedule protocolSchedule) {
return fromConfig(DataStorageFormat.FOREST, config, protocolSchedule);
return fromConfig(DataStorageConfiguration.DEFAULT_CONFIG, config, protocolSchedule);
}

/**
* Construct a {@link GenesisState} from a JSON object.
*
* @param dataStorageFormat A {@link DataStorageFormat} describing the storage format to use
* @param dataStorageConfiguration A {@link DataStorageConfiguration} describing the storage
* configuration
* @param config A {@link GenesisConfigFile} describing the genesis block.
* @param protocolSchedule A protocol Schedule associated with
* @return A new {@link GenesisState}.
*/
public static GenesisState fromConfig(
final DataStorageFormat dataStorageFormat,
final DataStorageConfiguration dataStorageConfiguration,
final GenesisConfigFile config,
final ProtocolSchedule protocolSchedule) {
final List<GenesisAccount> genesisAccounts = parseAllocations(config).toList();
final Block block =
new Block(
buildHeader(
config,
calculateGenesisStateHash(dataStorageFormat, genesisAccounts),
calculateGenesisStateHash(dataStorageConfiguration, genesisAccounts),
protocolSchedule),
buildBody(config));
return new GenesisState(block, genesisAccounts);
Expand Down Expand Up @@ -164,8 +167,9 @@ private static void writeAccountsTo(
}

private static Hash calculateGenesisStateHash(
final DataStorageFormat dataStorageFormat, final List<GenesisAccount> genesisAccounts) {
try (var worldState = createGenesisWorldState(dataStorageFormat)) {
final DataStorageConfiguration dataStorageConfiguration,
final List<GenesisAccount> genesisAccounts) {
try (var worldState = createGenesisWorldState(dataStorageConfiguration)) {
writeAccountsTo(worldState, genesisAccounts, null);
return worldState.rootHash();
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hyperledger.besu.ethereum.core.TransactionReceipt;
import org.hyperledger.besu.ethereum.core.feemarket.CoinbaseFeePriceCalculator;
import org.hyperledger.besu.ethereum.processing.TransactionProcessingResult;
import org.hyperledger.besu.evm.ClassicEVMs;
import org.hyperledger.besu.evm.MainnetEVMs;
import org.hyperledger.besu.evm.contractvalidation.MaxCodeSizeRule;
import org.hyperledger.besu.evm.contractvalidation.PrefixCodeRule;
Expand Down Expand Up @@ -355,7 +356,7 @@ public static ProtocolSpecBuilder spiralDefinition(
// EIP-3855
.evmBuilder(
(gasCalculator, jdCacheConfig) ->
MainnetEVMs.shanghai(
ClassicEVMs.spiral(
gasCalculator, chainId.orElse(BigInteger.ZERO), evmConfiguration))
// EIP-3651
.transactionProcessorBuilder(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public Optional<Bytes> getAccount(final Hash accountHash) {
}

@Override
public Optional<Bytes> getCode(final Bytes32 codeHash, final Hash accountHash) {
public Optional<Bytes> getCode(final Hash codeHash, final Hash accountHash) {
return isClosedGet() ? Optional.empty() : super.getCode(codeHash, accountHash);
}

Expand Down
Loading

0 comments on commit 38781e6

Please sign in to comment.