Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increment private nonce even if transaction failed. #6593

Merged
merged 45 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9e57548
add flag and update Forest State
gtebrean Feb 19, 2024
62bbc2a
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean Apr 26, 2024
4826611
fix merge
gtebrean Apr 29, 2024
958600b
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean May 10, 2024
eceaf82
updates
gtebrean May 16, 2024
e2d4e96
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean May 16, 2024
8a38d85
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean May 18, 2024
30683b1
debug
gtebrean May 18, 2024
3940f4e
fix hash
gtebrean May 18, 2024
c7665c0
enable acceptancePrivacy tests
gtebrean May 18, 2024
4ede744
spotless
gtebrean May 18, 2024
d487715
enable acceptanceTests
gtebrean May 18, 2024
719117e
enable acceptanceTestsPrivacy
gtebrean May 18, 2024
0dc324e
enable acceptanceTestsPrivacy
gtebrean May 18, 2024
b79cab9
spotless
gtebrean May 18, 2024
d817886
debug phase
gtebrean May 18, 2024
818cd29
integration debug mess
gtebrean May 22, 2024
add450a
refactor
gtebrean May 23, 2024
908869c
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean May 23, 2024
d1cc3c1
fix conflicts
gtebrean May 23, 2024
b61714e
enable privacy tests
gtebrean May 23, 2024
7463e3b
fix
gtebrean May 23, 2024
f4b0581
clean
gtebrean May 23, 2024
1f372b7
potless
gtebrean May 23, 2024
641a61a
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean May 27, 2024
451e463
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean Jun 4, 2024
66ed9f5
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean Jun 5, 2024
77c8683
clean method
gtebrean Jun 26, 2024
1c10c80
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean Jun 27, 2024
83ea92a
clear transaction processor
gtebrean Jun 27, 2024
199a4ad
refactor method name
gtebrean Jul 1, 2024
b671c0c
extract interface
gtebrean Jul 1, 2024
01e7961
clean
gtebrean Jul 1, 2024
2238dab
fix import
gtebrean Jul 1, 2024
488cb0c
fix
gtebrean Jul 1, 2024
3955c95
fix doc
gtebrean Jul 1, 2024
3ac02fe
Merge remote-tracking branch 'upstream/main' into issue_1942_private_…
gtebrean Jul 1, 2024
b0cd635
remove changes to ForestMutableWorldState
pinges Jul 5, 2024
d1b22f5
Merge branch 'main' of github.com:hyperledger/besu into issue_1942_pr…
pinges Jul 5, 2024
0fd452f
clean up a bit
pinges Jul 5, 2024
8f88ef1
rename flag
gtebrean Jul 5, 2024
715bd09
Merge branch 'main' of github.com:hyperledger/besu into issue_1942_pr…
pinges Jul 10, 2024
2a2bf5c
some renaming and CHANGELOG entry
pinges Jul 10, 2024
e52a002
fix unit test
pinges Jul 10, 2024
6044b73
Merge branch 'main' into issue_1942_private_nonce
pinges Jul 10, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -671,6 +671,11 @@ static class PrivacyOptionGroup {
names = {"--privacy-flexible-groups-enabled"},
description = "Enable flexible privacy groups (default: ${DEFAULT-VALUE})")
private final Boolean isFlexiblePrivacyGroupsEnabled = false;

@Option(
names = {"--privacy-nonce-incrementation-enabled"},
description = "Enable private nonce incrementation even if the transaction didn't succeeded (default: ${DEFAULT-VALUE})")
private final Boolean isPrivateNonceIncrementationEnabled = false;
}

// Metrics Option Group
Expand Down Expand Up @@ -2032,6 +2037,8 @@ private PrivacyParameters privacyParameters() {
privacyOptionGroup.isFlexiblePrivacyGroupsEnabled);
privacyParametersBuilder.setPrivacyPluginEnabled(
unstablePrivacyPluginOptions.isPrivacyPluginEnabled());
privacyParametersBuilder.setPrivateNonceIncrementationEnabled(
privacyOptionGroup.isPrivateNonceIncrementationEnabled);

final boolean hasPrivacyPublicKey = privacyOptionGroup.privacyPublicKeyFile != null;

Expand Down
1 change: 1 addition & 0 deletions besu/src/test/resources/everything_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ privacy-multi-tenancy-enabled=true
privacy-marker-transaction-signing-key-file="./signerKey"
privacy-enable-database-migration=false
privacy-flexible-groups-enabled=false
privacy-nonce-incrementation-enabled=false

# Transaction Pool
tx-pool="layered"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public class PrivacyParameters {
private PrivateStateRootResolver privateStateRootResolver;
private PrivateWorldStateReader privateWorldStateReader;
private PrivacyPluginService privacyPluginService;
private boolean privateNonceIncrementationEnabled;

public Address getPrivacyAddress() {
if (isPrivacyPluginEnabled()) {
Expand Down Expand Up @@ -228,6 +229,14 @@ private PrivacyGroupGenesisProvider createPrivateGenesisProvider() {
}
}

public boolean isPrivateNonceIncrementationEnabled() {
return privateNonceIncrementationEnabled;
}

public void setPrivateNonceIncrementationEnabled(boolean privateNonceIncrementationEnabled) {
this.privateNonceIncrementationEnabled = privateNonceIncrementationEnabled;
}

@Override
public String toString() {
return "PrivacyParameters{"
Expand Down Expand Up @@ -263,6 +272,7 @@ public static class Builder {
private boolean flexiblePrivacyGroupsEnabled;
private boolean privacyPluginEnabled;
private PrivacyPluginService privacyPluginService;
private boolean privateNonceIncrementationEnabled;

public Builder setEnclaveUrl(final URI enclaveUrl) {
this.enclaveUrl = enclaveUrl;
Expand Down Expand Up @@ -314,6 +324,12 @@ public Builder setFlexiblePrivacyGroupsEnabled(final boolean flexiblePrivacyGrou
return this;
}

public Builder setPrivateNonceIncrementationEnabled(
Boolean isPrivateNonceIncrementationEnabled) {
this.privateNonceIncrementationEnabled = isPrivateNonceIncrementationEnabled;
return this;
}

public Builder setPrivacyPluginEnabled(final boolean privacyPluginEnabled) {
this.privacyPluginEnabled = privacyPluginEnabled;
return this;
Expand Down Expand Up @@ -382,6 +398,7 @@ public PrivacyParameters build() {
config.setMultiTenancyEnabled(multiTenancyEnabled);
config.setFlexiblePrivacyGroupsEnabled(flexiblePrivacyGroupsEnabled);
config.setPrivacyPluginEnabled(privacyPluginEnabled);
config.setPrivateNonceIncrementationEnabled(privateNonceIncrementationEnabled);
return config;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ private ClassicProtocolSpecs() {
public static ProtocolSpecBuilder classicRecoveryInitDefinition(
final OptionalInt contractSizeLimit,
final OptionalInt configStackSizeLimit,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return MainnetProtocolSpecs.homesteadDefinition(
contractSizeLimit, configStackSizeLimit, evmConfiguration)
contractSizeLimit, configStackSizeLimit, evmConfiguration, incrementPrivateTransaction)
.blockHeaderValidatorBuilder(
feeMarket -> MainnetBlockHeaderValidator.createClassicValidator())
.name("ClassicRecoveryInit");
Expand All @@ -69,9 +70,10 @@ public static ProtocolSpecBuilder tangerineWhistleDefinition(
final Optional<BigInteger> chainId,
final OptionalInt contractSizeLimit,
final OptionalInt configStackSizeLimit,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return MainnetProtocolSpecs.homesteadDefinition(
contractSizeLimit, configStackSizeLimit, evmConfiguration)
contractSizeLimit, configStackSizeLimit, evmConfiguration, incrementPrivateTransaction)
.isReplayProtectionSupported(true)
.gasCalculator(TangerineWhistleGasCalculator::new)
.transactionValidatorFactoryBuilder(
Expand All @@ -84,9 +86,14 @@ public static ProtocolSpecBuilder dieHardDefinition(
final Optional<BigInteger> chainId,
final OptionalInt ignoredConfigContractSizeLimit,
final OptionalInt configStackSizeLimit,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return tangerineWhistleDefinition(
chainId, OptionalInt.empty(), configStackSizeLimit, evmConfiguration)
chainId,
OptionalInt.empty(),
configStackSizeLimit,
evmConfiguration,
incrementPrivateTransaction)
.gasCalculator(DieHardGasCalculator::new)
.difficultyCalculator(ClassicDifficultyCalculators.DIFFICULTY_BOMB_PAUSED)
.name("DieHard");
Expand All @@ -97,8 +104,14 @@ public static ProtocolSpecBuilder gothamDefinition(
final OptionalInt contractSizeLimit,
final OptionalInt configStackSizeLimit,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
return dieHardDefinition(chainId, contractSizeLimit, configStackSizeLimit, evmConfiguration)
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return dieHardDefinition(
chainId,
contractSizeLimit,
configStackSizeLimit,
evmConfiguration,
incrementPrivateTransaction)
.blockReward(MAX_BLOCK_REWARD)
.difficultyCalculator(ClassicDifficultyCalculators.DIFFICULTY_BOMB_DELAYED)
.blockProcessorBuilder(
Expand All @@ -124,9 +137,15 @@ public static ProtocolSpecBuilder defuseDifficultyBombDefinition(
final OptionalInt contractSizeLimit,
final OptionalInt configStackSizeLimit,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return gothamDefinition(
chainId, contractSizeLimit, configStackSizeLimit, ecip1017EraRounds, evmConfiguration)
chainId,
contractSizeLimit,
configStackSizeLimit,
ecip1017EraRounds,
evmConfiguration,
incrementPrivateTransaction)
.difficultyCalculator(ClassicDifficultyCalculators.DIFFICULTY_BOMB_REMOVED)
.transactionValidatorFactoryBuilder(
(gasCalculator, gasLimitCalculator, feeMarket) ->
Expand All @@ -140,7 +159,8 @@ public static ProtocolSpecBuilder atlantisDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
final int contractSizeLimit =
configContractSizeLimit.orElse(MainnetProtocolSpecs.SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
Expand All @@ -149,7 +169,8 @@ public static ProtocolSpecBuilder atlantisDefinition(
configContractSizeLimit,
configStackSizeLimit,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.evmBuilder(MainnetEVMs::byzantium)
.evmConfiguration(evmConfiguration)
.gasCalculator(SpuriousDragonGasCalculator::new)
Expand Down Expand Up @@ -194,14 +215,16 @@ public static ProtocolSpecBuilder aghartaDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return atlantisDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.evmBuilder(MainnetEVMs::constantinople)
.gasCalculator(PetersburgGasCalculator::new)
.evmBuilder(MainnetEVMs::constantinople)
Expand All @@ -215,14 +238,16 @@ public static ProtocolSpecBuilder phoenixDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return aghartaDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.gasCalculator(IstanbulGasCalculator::new)
.evmBuilder(
(gasCalculator, evmConfig) ->
Expand All @@ -238,14 +263,16 @@ public static ProtocolSpecBuilder thanosDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return phoenixDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.blockHeaderValidatorBuilder(
feeMarket ->
MainnetBlockHeaderValidator.createPgaBlockHeaderValidator(
Expand Down Expand Up @@ -283,14 +310,16 @@ public static ProtocolSpecBuilder magnetoDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
return thanosDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.gasCalculator(BerlinGasCalculator::new)
.transactionValidatorFactoryBuilder(
(gasCalculator, gasLimitCalculator, feeMarket) ->
Expand All @@ -313,7 +342,8 @@ public static ProtocolSpecBuilder mystiqueDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
final int contractSizeLimit =
configContractSizeLimit.orElse(MainnetProtocolSpecs.SPURIOUS_DRAGON_CONTRACT_SIZE_LIMIT);
return magnetoDefinition(
Expand All @@ -322,7 +352,8 @@ public static ProtocolSpecBuilder mystiqueDefinition(
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
.gasCalculator(LondonGasCalculator::new)
.contractCreationProcessorBuilder(
(gasCalculator, evm) ->
Expand All @@ -341,15 +372,17 @@ public static ProtocolSpecBuilder spiralDefinition(
final OptionalInt configStackSizeLimit,
final boolean enableRevertReason,
final OptionalLong ecip1017EraRounds,
final EvmConfiguration evmConfiguration) {
final EvmConfiguration evmConfiguration,
final boolean incrementPrivateTransaction) {
final int stackSizeLimit = configStackSizeLimit.orElse(MessageFrame.DEFAULT_MAX_STACK_SIZE);
return mystiqueDefinition(
chainId,
configContractSizeLimit,
configStackSizeLimit,
enableRevertReason,
ecip1017EraRounds,
evmConfiguration)
evmConfiguration,
incrementPrivateTransaction)
// EIP-3860
.gasCalculator(ShanghaiGasCalculator::new)
// EIP-3855
Expand Down
Loading
Loading