From f4af8ffae514c68414251915135003e8a2081211 Mon Sep 17 00:00:00 2001 From: Cem Ozer Date: Wed, 8 May 2019 15:36:27 -0400 Subject: [PATCH] Remove unnecessary argument (#644) --- .../pegasys/artemis/statetransition/StateProcessor.java | 7 ++++--- .../pegasys/artemis/statetransition/StateTransition.java | 2 +- .../validator/coordinator/ValidatorCoordinator.java | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateProcessor.java b/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateProcessor.java index eea7381e021..a68ad213457 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateProcessor.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateProcessor.java @@ -89,6 +89,7 @@ public void onEth2GenesisEvent(Eth2GenesisEvent event) { DataStructureUtil.createInitialBeaconState(config.getNumValidators()); Bytes32 initial_state_root = initial_state.hash_tree_root(); BeaconBlock genesis_block = BeaconBlockUtil.get_empty_block(); + genesis_block.setState_root(initial_state_root); Bytes32 genesis_block_root = genesis_block.hash_tree_root(); LOG.log(Level.INFO, "Initial state root is " + initial_state_root.toHexString()); this.store.addState(initial_state_root, initial_state); @@ -182,7 +183,7 @@ public void onNewSlot(Date date) throws StateTransitionException, InterruptedExc "Transitioning state from slot: " + newHeadState.getSlot() + " to slot: " + nodeSlot); firstLoop = false; } - stateTransition.initiate((BeaconStateWithCache) newHeadState, null, previousBlockRoot); + stateTransition.initiate((BeaconStateWithCache) newHeadState, null); } this.store.addState(newHeadState.hash_tree_root(), newHeadState); this.headState = newHeadState; @@ -245,12 +246,12 @@ protected void processBlock(Optional unprocessedBlock) { firstLoop = false; } - stateTransition.initiate((BeaconStateWithCache) currentState, null, parentBlockRoot); + stateTransition.initiate((BeaconStateWithCache) currentState, null); } // Run state transition with the block LOG.log(Level.INFO, ANSI_PURPLE + "Running state transition with block." + ANSI_RESET); - stateTransition.initiate((BeaconStateWithCache) currentState, block, parentBlockRoot); + stateTransition.initiate((BeaconStateWithCache) currentState, block); Bytes32 newStateRoot = currentState.hash_tree_root(); diff --git a/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateTransition.java b/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateTransition.java index 6452493606b..6d135cd426a 100644 --- a/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateTransition.java +++ b/ethereum/statetransition/src/main/java/tech/pegasys/artemis/statetransition/StateTransition.java @@ -44,7 +44,7 @@ public StateTransition(boolean printEnabled) { this.printEnabled = printEnabled; } - public void initiate(BeaconStateWithCache state, BeaconBlock block, Bytes32 previous_block_root) + public void initiate(BeaconStateWithCache state, BeaconBlock block) throws StateTransitionException { // Client specific optimization preProcessor(state); diff --git a/validator/coordinator/src/main/java/tech/pegasys/artemis/validator/coordinator/ValidatorCoordinator.java b/validator/coordinator/src/main/java/tech/pegasys/artemis/validator/coordinator/ValidatorCoordinator.java index a2c948e9a17..41bf4f8ad47 100644 --- a/validator/coordinator/src/main/java/tech/pegasys/artemis/validator/coordinator/ValidatorCoordinator.java +++ b/validator/coordinator/src/main/java/tech/pegasys/artemis/validator/coordinator/ValidatorCoordinator.java @@ -177,7 +177,7 @@ private void createNewBlock( BLSSignature epoch_signature = setEpochSignature(headState, keypair); block.getBody().setRandao_reveal(epoch_signature); - stateTransition.initiate(headState, block, blockRoot); + stateTransition.initiate(headState, block); Bytes32 stateRoot = headState.hash_tree_root(); block.setState_root(stateRoot); BLSSignature signed_proposal = signProposalData(headState, block, keypair);