Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

RevertReason changed to BytesValue #1746

Merged
merged 37 commits into from
Jul 30, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
639b410
RevertReason changed to BytesValue
Jul 24, 2019
8bd82ae
post review
Jul 25, 2019
20f4316
Added static nodes acceptance test (#1745)
lucassaldanha Jul 24, 2019
a85980a
update vertx to 2.8.0 (#1748)
Jul 24, 2019
5b78518
Reduce number of builds retained for master (#1751)
ajsutton Jul 24, 2019
5c67f04
PIE-1792: Added chainId validation to PrivateTransactionValidator (#1…
lucassaldanha Jul 24, 2019
2f9818a
Added note about private transaction nonce (#1740)
MadelineMurray Jul 25, 2019
c3bf607
[PAN-2950] Use java.time.Clock instead of System.currentTimeMillis() …
Jul 25, 2019
09fb64c
Report node local address as the coinbase in Clique and IBFT. (#1758)
ajsutton Jul 25, 2019
fbb8736
Renamed HA section to make clearer what it is (#1750)
MadelineMurray Jul 25, 2019
e88de17
[PAN-2845] Added eea_getPrivateTransaction (#1729)
MadelineMurray Jul 25, 2019
8e6364d
Fixes PIE-1669 typo (#1763)
sgregglives Jul 25, 2019
6c07566
[PAN-2943] Renames various eea methods to priv methods, with associat…
josh-richardson Jul 25, 2019
ec7cfa0
[PAN-2727] Permissioning Acceptance Test - Verify OnChain Nodes Out o…
usmansaleem Jul 26, 2019
825242a
PAN-2723: Testing permissioning with static nodes behaviour (#1764)
lucassaldanha Jul 26, 2019
e38bec0
trying to fix stuff
Jul 26, 2019
a118716
Fixed RevertReasonAT
Jul 26, 2019
66d2b2d
Cleanup
Jul 26, 2019
d7af3d4
not sure what this one is about
Jul 26, 2019
ae80d96
repair empty revert reason
Jul 26, 2019
6bf9ff5
fixes PAN-2958 list typo (missing new line) (#1742)
NicolasMassart Jul 26, 2019
35278e7
Revert "[PAN-2950] Use java.time.Clock instead of System.currentTimeM…
Jul 26, 2019
168dcf4
[PAN-2444] Add CLI flag for setting WorldStateDownloader task cache …
Jul 26, 2019
b439d7f
Moved priv methods into priv section (#1770)
MadelineMurray Jul 27, 2019
7082eb4
[PAN-2881] [PAN-2885] Updated onchain permissioning to include accoun…
MadelineMurray Jul 27, 2019
c5f6a0a
Added privacy group methods for web3.js-eea (#1761)
MadelineMurray Jul 27, 2019
89a39a2
[PAN-2957] Add Java 11+ as a prerequisite for installing Pantheon usi…
bgravenorst Jul 27, 2019
6412d95
Updated revert reason example (#1754)
MadelineMurray Jul 27, 2019
5f4b5be
Typo doc in word "exceptoinal" (#1767)
helderjnpinto Jul 29, 2019
4c7b677
Added content on deploying for production (#1774)
MadelineMurray Jul 29, 2019
8e9bd85
Repaired empty revert reason output
Jul 29, 2019
4ed31e8
Merge remote-tracking branch 'upstream/master' into revert
Jul 29, 2019
ec7b1bf
Transaction receipt inserts 0x for empty revert reason
Jul 29, 2019
58b75cc
Merge remote-tracking branch 'upstream/master' into revert
Jul 29, 2019
e64e574
Repair failing AT
Jul 29, 2019
98fe982
Merge branch 'master' into revert
rain-on Jul 30, 2019
0ae3d4c
Merge branch 'master' into revert
rain-on Jul 30, 2019
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
Prev Previous commit
Next Next commit
Revert "[PAN-2950] Use java.time.Clock instead of System.currentTimeM…
…illis()" (#1768)

This reverts commit 814b36e
The needed chantes to get rid of Instant.now (which is also needed to get rid
of the wall clock dependency) are too deep and intrusive into IBFT to try and
speed patch them in that some APIs require re-work, so in the interst of test
stability this gets sheleved until it is all ready.
  • Loading branch information
Danno Ferrin authored and tmohay committed Jul 29, 2019
commit 35278e73ce5f3c96e83c45db32f95b8e0e7adc6f
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,14 @@ public class ThreadPantheonNodeRunner implements PantheonNodeRunner {

private final Map<Node, PantheonPluginContextImpl> pantheonPluginContextMap = new HashMap<>();

private PantheonPluginContextImpl buildPluginContext(
final PantheonNode node, final CommandLine commandLine) {
final PantheonPluginContextImpl pantheonPluginContext = new PantheonPluginContextImpl();
private PantheonPluginContextImpl buildPluginContext(final PantheonNode node) {
PantheonPluginContextImpl pantheonPluginContext = new PantheonPluginContextImpl();
final Path pluginsPath = node.homeDirectory().resolve("plugins");
final File pluginsDirFile = pluginsPath.toFile();
if (!pluginsDirFile.isDirectory()) {
pluginsDirFile.mkdirs();
pluginsDirFile.deleteOnExit();
}
pantheonPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));
System.setProperty("pantheon.plugins.dir", pluginsPath.toString());
pantheonPluginContext.registerPlugins(pluginsPath);
return pantheonPluginContext;
Expand All @@ -87,7 +85,8 @@ public void startNode(final PantheonNode node) {

final CommandLine commandLine = new CommandLine(CommandSpec.create());
final PantheonPluginContextImpl pantheonPluginContext =
pantheonPluginContextMap.computeIfAbsent(node, n -> buildPluginContext(node, commandLine));
pantheonPluginContextMap.computeIfAbsent(node, n -> buildPluginContext(node));
pantheonPluginContext.addService(PicoCLIOptions.class, new PicoCLIOptionsImpl(commandLine));

commandLine.parseArgs(node.getConfiguration().getExtraCLIOptions().toArray(new String[0]));

Expand Down Expand Up @@ -127,7 +126,7 @@ public void startNode(final PantheonNode node) {

final RunnerBuilder runnerBuilder = new RunnerBuilder();
if (node.getPermissioningConfiguration().isPresent()) {
final PermissioningConfiguration permissioningConfiguration =
PermissioningConfiguration permissioningConfiguration =
node.getPermissioningConfiguration().get();

runnerBuilder.permissioningConfiguration(permissioningConfiguration);
Expand All @@ -152,7 +151,6 @@ public void startNode(final PantheonNode node) {
.webSocketConfiguration(node.webSocketConfiguration())
.dataDir(node.homeDirectory())
.metricsSystem(noOpMetricsSystem)
.clock(Clock.systemUTC())
.metricsConfiguration(node.metricsConfiguration())
.p2pEnabled(node.isP2pEnabled())
.graphQLConfiguration(GraphQLConfiguration.createDefault())
Expand All @@ -169,7 +167,7 @@ public void startNode(final PantheonNode node) {

@Override
public void stopNode(final PantheonNode node) {
final PantheonPluginContextImpl pluginContext = pantheonPluginContextMap.remove(node);
PantheonPluginContextImpl pluginContext = pantheonPluginContextMap.remove(node);
if (pluginContext != null) {
pluginContext.stopPlugins();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
import tech.pegasys.pantheon.ethereum.mainnet.headervalidationrules.TimestampBoundedByFutureParameter;
import tech.pegasys.pantheon.ethereum.mainnet.headervalidationrules.TimestampMoreRecentThanParent;

import java.time.Clock;

public class BlockHeaderValidationRulesetFactory {

/**
Expand All @@ -40,17 +38,16 @@ public class BlockHeaderValidationRulesetFactory {
*
* @param secondsBetweenBlocks the minimum number of seconds which must elapse between blocks.
* @param epochManager an object which determines if a given block is an epoch block.
* @param clock System clock
* @return the header validator.
*/
public static BlockHeaderValidator<CliqueContext> cliqueBlockHeaderValidator(
final long secondsBetweenBlocks, final EpochManager epochManager, final Clock clock) {
final long secondsBetweenBlocks, final EpochManager epochManager) {

return new BlockHeaderValidator.Builder<CliqueContext>()
.addRule(new AncestryValidationRule())
.addRule(new GasUsageValidationRule())
.addRule(new GasLimitRangeAndDeltaValidationRule(5000, 0x7fffffffffffffffL))
.addRule(new TimestampBoundedByFutureParameter(10, clock))
.addRule(new TimestampBoundedByFutureParameter(10))
.addRule(new TimestampMoreRecentThanParent(secondsBetweenBlocks))
.addRule(new ConstantFieldValidationRule<>("MixHash", BlockHeader::getMixHash, Hash.ZERO))
.addRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSpecBuilder;

import java.math.BigInteger;
import java.time.Clock;

/** Defines the protocol behaviours for a blockchain using Clique. */
public class CliqueProtocolSchedule {
Expand All @@ -41,8 +40,7 @@ public static ProtocolSchedule<CliqueContext> create(
final GenesisConfigOptions config,
final KeyPair nodeKeys,
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final Clock clock) {
final boolean isRevertReasonEnabled) {

final CliqueConfigOptions cliqueConfig = config.getCliqueConfigOptions();

Expand All @@ -54,37 +52,28 @@ public static ProtocolSchedule<CliqueContext> create(
DEFAULT_CHAIN_ID,
builder ->
applyCliqueSpecificModifications(
epochManager,
cliqueConfig.getBlockPeriodSeconds(),
localNodeAddress,
builder,
clock),
epochManager, cliqueConfig.getBlockPeriodSeconds(), localNodeAddress, builder),
privacyParameters,
isRevertReasonEnabled,
clock)
isRevertReasonEnabled)
.createProtocolSchedule();
}

public static ProtocolSchedule<CliqueContext> create(
final GenesisConfigOptions config,
final KeyPair nodeKeys,
final boolean isRevertReasonEnabled,
final Clock clock) {
return create(config, nodeKeys, PrivacyParameters.DEFAULT, isRevertReasonEnabled, clock);
final boolean isRevertReasonEnabled) {
return create(config, nodeKeys, PrivacyParameters.DEFAULT, isRevertReasonEnabled);
}

private static ProtocolSpecBuilder<CliqueContext> applyCliqueSpecificModifications(
final EpochManager epochManager,
final long secondsBetweenBlocks,
final Address localNodeAddress,
final ProtocolSpecBuilder<Void> specBuilder,
final Clock clock) {
final ProtocolSpecBuilder<Void> specBuilder) {
return specBuilder
.changeConsensusContextType(
difficultyCalculator ->
cliqueBlockHeaderValidator(secondsBetweenBlocks, epochManager, clock),
difficultyCalculator ->
cliqueBlockHeaderValidator(secondsBetweenBlocks, epochManager, clock),
difficultyCalculator -> cliqueBlockHeaderValidator(secondsBetweenBlocks, epochManager),
difficultyCalculator -> cliqueBlockHeaderValidator(secondsBetweenBlocks, epochManager),
MainnetBlockBodyValidator::new,
MainnetBlockValidator::new,
MainnetBlockImporter::new,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import tech.pegasys.pantheon.ethereum.core.Wei;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSchedule;
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSpec;
import tech.pegasys.pantheon.testutil.TestClock;

import org.junit.Test;

Expand All @@ -42,7 +41,7 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {

final GenesisConfigOptions config = GenesisConfigFile.fromConfig(jsonInput).getConfigOptions();
final ProtocolSchedule<CliqueContext> protocolSchedule =
CliqueProtocolSchedule.create(config, NODE_KEYS, false, TestClock.fixed());
CliqueProtocolSchedule.create(config, NODE_KEYS, false);

final ProtocolSpec<CliqueContext> homesteadSpec = protocolSchedule.getByBlockNumber(1);
final ProtocolSpec<CliqueContext> tangerineWhistleSpec = protocolSchedule.getByBlockNumber(2);
Expand All @@ -58,7 +57,7 @@ public void protocolSpecsAreCreatedAtBlockDefinedInJson() {
public void parametersAlignWithMainnetWithAdjustments() {
final ProtocolSpec<CliqueContext> homestead =
CliqueProtocolSchedule.create(
GenesisConfigFile.DEFAULT.getConfigOptions(), NODE_KEYS, false, TestClock.fixed())
GenesisConfigFile.DEFAULT.getConfigOptions(), NODE_KEYS, false)
.getByBlockNumber(0);

assertThat(homestead.getName()).isEqualTo("Frontier");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,7 @@ public class CliqueBlockCreatorTest {
public void setup() {
protocolSchedule =
CliqueProtocolSchedule.create(
GenesisConfigFile.DEFAULT.getConfigOptions(),
proposerKeyPair,
false,
TestClock.fixed());
GenesisConfigFile.DEFAULT.getConfigOptions(), proposerKeyPair, false);

final Address otherAddress = Util.publicKeyToAddress(otherKeyPair.getPublicKey());
validatorList.add(otherAddress);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ public void extraDataCreatedOnEpochBlocksContainsValidators() {
new CliqueMinerExecutor(
cliqueProtocolContext,
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(
GENESIS_CONFIG_OPTIONS, proposerKeyPair, false, TestClock.fixed()),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair, false),
new PendingTransactions(
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
Expand Down Expand Up @@ -128,8 +127,7 @@ public void extraDataForNonEpochBlocksDoesNotContainValidaors() {
new CliqueMinerExecutor(
cliqueProtocolContext,
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(
GENESIS_CONFIG_OPTIONS, proposerKeyPair, false, TestClock.fixed()),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair, false),
new PendingTransactions(
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
Expand Down Expand Up @@ -166,8 +164,7 @@ public void shouldUseLatestVanityData() {
new CliqueMinerExecutor(
cliqueProtocolContext,
Executors.newSingleThreadExecutor(),
CliqueProtocolSchedule.create(
GENESIS_CONFIG_OPTIONS, proposerKeyPair, false, TestClock.fixed()),
CliqueProtocolSchedule.create(GENESIS_CONFIG_OPTIONS, proposerKeyPair, false),
new PendingTransactions(
TransactionPoolConfiguration.DEFAULT_TX_RETENTION_HOURS,
1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
*/
package tech.pegasys.pantheon.consensus.ibft.support;

import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;
import static org.mockito.Mockito.mock;
import static tech.pegasys.pantheon.ethereum.core.InMemoryStorageProvider.createInMemoryBlockchain;
Expand Down Expand Up @@ -160,8 +159,6 @@ public TestContextBuilder useGossip(final boolean useGossip) {
}

public TestContext build() {
checkNotNull(clock);

final NetworkLayout networkNodes =
NetworkLayout.createNetworkLayout(validatorCount, indexOfFirstLocallyProposedBlock);

Expand Down Expand Up @@ -266,7 +263,7 @@ private static ControllerAndState createControllerAndFinalState(
genesisConfigOptions.byzantiumBlock(0);

final ProtocolSchedule<IbftContext> protocolSchedule =
IbftProtocolSchedule.create(genesisConfigOptions, Clock.systemUTC());
IbftProtocolSchedule.create(genesisConfigOptions);

/////////////////////////////////////////////////////////////////////////////////////
// From here down is BASICALLY taken from IbftPantheonController
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@
import tech.pegasys.pantheon.ethereum.mainnet.headervalidationrules.TimestampMoreRecentThanParent;
import tech.pegasys.pantheon.util.uint.UInt256;

import java.time.Clock;

public class IbftBlockHeaderValidationRulesetFactory {

/**
* Produces a BlockHeaderValidator configured for assessing ibft block headers which are to form
* part of the BlockChain (i.e. not proposed blocks, which do not contain commit seals)
*
* @param secondsBetweenBlocks the minimum number of seconds which must elapse between blocks.
* @param clock System clock
* @return BlockHeaderValidator configured for assessing ibft block headers
*/
public static BlockHeaderValidator<IbftContext> ibftBlockHeaderValidator(
final long secondsBetweenBlocks, final Clock clock) {
final long secondsBetweenBlocks) {
return new BlockHeaderValidator.Builder<IbftContext>()
.addRule(new AncestryValidationRule())
.addRule(new GasUsageValidationRule())
.addRule(new GasLimitRangeAndDeltaValidationRule(5000, 0x7fffffffffffffffL))
.addRule(new TimestampBoundedByFutureParameter(1, clock))
.addRule(new TimestampBoundedByFutureParameter(1))
.addRule(new TimestampMoreRecentThanParent(secondsBetweenBlocks))
.addRule(
new ConstantFieldValidationRule<>(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import tech.pegasys.pantheon.ethereum.mainnet.ProtocolSpecBuilder;

import java.math.BigInteger;
import java.time.Clock;

/** Defines the protocol behaviours for a blockchain using IBFT. */
public class IbftProtocolSchedule {
Expand All @@ -36,37 +35,34 @@ public class IbftProtocolSchedule {
public static ProtocolSchedule<IbftContext> create(
final GenesisConfigOptions config,
final PrivacyParameters privacyParameters,
final boolean isRevertReasonEnabled,
final Clock clock) {
final boolean isRevertReasonEnabled) {
final IbftConfigOptions ibftConfig = config.getIbftLegacyConfigOptions();
final long blockPeriod = ibftConfig.getBlockPeriodSeconds();

return new ProtocolScheduleBuilder<>(
config,
DEFAULT_CHAIN_ID,
builder -> applyIbftChanges(blockPeriod, builder, clock),
builder -> applyIbftChanges(blockPeriod, builder),
privacyParameters,
isRevertReasonEnabled,
clock)
isRevertReasonEnabled)
.createProtocolSchedule();
}

public static ProtocolSchedule<IbftContext> create(
final GenesisConfigOptions config, final boolean isRevertReasonEnabled, final Clock clock) {
return create(config, PrivacyParameters.DEFAULT, isRevertReasonEnabled, clock);
final GenesisConfigOptions config, final boolean isRevertReasonEnabled) {
return create(config, PrivacyParameters.DEFAULT, isRevertReasonEnabled);
}

public static ProtocolSchedule<IbftContext> create(
final GenesisConfigOptions config, final Clock clock) {
return create(config, PrivacyParameters.DEFAULT, false, clock);
public static ProtocolSchedule<IbftContext> create(final GenesisConfigOptions config) {
return create(config, PrivacyParameters.DEFAULT, false);
}

private static ProtocolSpecBuilder<IbftContext> applyIbftChanges(
final long secondsBetweenBlocks, final ProtocolSpecBuilder<Void> builder, final Clock clock) {
final long secondsBetweenBlocks, final ProtocolSpecBuilder<Void> builder) {
return builder
.<IbftContext>changeConsensusContextType(
difficultyCalculator -> ibftBlockHeaderValidator(secondsBetweenBlocks, clock),
difficultyCalculator -> ibftBlockHeaderValidator(secondsBetweenBlocks, clock),
difficultyCalculator -> ibftBlockHeaderValidator(secondsBetweenBlocks),
difficultyCalculator -> ibftBlockHeaderValidator(secondsBetweenBlocks),
MainnetBlockBodyValidator::new,
MainnetBlockValidator::new,
MainnetBlockImporter::new,
Expand Down
Loading