[MINOR] Normalize references to Logger (#28)

* normalize references to Logger

* stanrdize on getLogger()
S. Matthew English 6 years ago committed by GitHub
parent 393ce95af4
commit 671adffac4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/CliqueVoteTallyUpdater.java
  2. 12
      consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java
  3. 4
      consensus/common/src/main/java/net/consensys/pantheon/consensus/common/headervalidationrules/VoteValidationRule.java
  4. 4
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftEventQueue.java
  5. 4
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftProcessor.java
  6. 7
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/VoteTallyUpdater.java
  7. 2
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java
  8. 4
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/ProposerSelector.java
  9. 14
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/headervalidationrules/IbftExtraDataValidationRule.java
  10. 2
      consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/protocol/IbftProtocolManager.java
  11. 4
      crypto/src/main/java/net/consensys/pantheon/crypto/PersonalisationString.java
  12. 11
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java
  13. 3
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/BlockTransactionSelector.java
  14. 4
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/BlockHeaderValidator.java
  15. 2
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/EthHashCacheFactory.java
  16. 22
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockBodyValidator.java
  17. 6
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockProcessor.java
  18. 16
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetContractCreationProcessor.java
  19. 17
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetMessageCallProcessor.java
  20. 18
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetTransactionProcessor.java
  21. 6
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/AncestryValidationRule.java
  22. 4
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java
  23. 4
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ExtraDataMaxLengthValidationRule.java
  24. 7
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasLimitRangeAndDeltaValidationRule.java
  25. 4
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasUsageValidationRule.java
  26. 8
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java
  27. 6
      ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/TimestampValidationRule.java
  28. 10
      ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java
  29. 4
      ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java
  30. 10
      ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketRequestHandler.java
  31. 14
      ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java
  32. 10
      ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java
  33. 16
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/NetworkRunner.java
  34. 2
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java
  35. 2
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java
  36. 14
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/ApiHandler.java
  37. 4
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/Callbacks.java
  38. 2
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/DeFramer.java
  39. 4
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/HandshakeHandlerOutbound.java
  40. 16
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java
  41. 8
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java
  42. 6
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/WireKeepAlive.java
  43. 4
      ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/wire/Capability.java
  44. 12
      pantheon/src/main/java/net/consensys/pantheon/Runner.java
  45. 4
      pantheon/src/main/java/net/consensys/pantheon/cli/ExportPublicKeySubCommand.java
  46. 4
      pantheon/src/main/java/net/consensys/pantheon/cli/ImportBlockchainSubCommand.java
  47. 4
      pantheon/src/main/java/net/consensys/pantheon/cli/ImportSubCommand.java
  48. 2
      pantheon/src/main/java/net/consensys/pantheon/cli/PantheonCommand.java
  49. 10
      pantheon/src/main/java/net/consensys/pantheon/controller/KeyPairUtil.java
  50. 6
      pantheon/src/test/java/net/consensys/pantheon/cli/CommandTestAbstract.java
  51. 6
      services/kvstore/src/main/java/net/consensys/pantheon/services/kvstore/RocksDbKeyValueStorage.java

@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger;
public class CliqueVoteTallyUpdater { public class CliqueVoteTallyUpdater {
private static final Logger LOGGER = getLogger(); private static final Logger LOG = getLogger();
public static final Address NO_VOTE_SUBJECT = Address.wrap(BytesValue.wrap(new byte[20])); public static final Address NO_VOTE_SUBJECT = Address.wrap(BytesValue.wrap(new byte[20]));
private final EpochManager epochManager; private final EpochManager epochManager;
@ -28,7 +28,7 @@ public class CliqueVoteTallyUpdater {
public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) { public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) {
final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber(); final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber();
final long epochBlockNumber = epochManager.getLastEpochBlock(chainHeadBlockNumber); final long epochBlockNumber = epochManager.getLastEpochBlock(chainHeadBlockNumber);
LOGGER.info("Loading validator voting state starting from block {}", epochBlockNumber); LOG.info("Loading validator voting state starting from block {}", epochBlockNumber);
final BlockHeader epochBlock = blockchain.getBlockHeader(epochBlockNumber).get(); final BlockHeader epochBlock = blockchain.getBlockHeader(epochBlockNumber).get();
final List<Address> initialValidators = final List<Address> initialValidators =
CliqueExtraData.decode(epochBlock.getExtraData()).getValidators(); CliqueExtraData.decode(epochBlock.getExtraData()).getValidators();

@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger;
public class CliqueExtraDataValidationRule public class CliqueExtraDataValidationRule
implements AttachedBlockHeaderValidationRule<CliqueContext> { implements AttachedBlockHeaderValidationRule<CliqueContext> {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
private final EpochManager epochManager; private final EpochManager epochManager;
@ -53,10 +53,10 @@ public class CliqueExtraDataValidationRule
return extraDataIsValid(storedValidators, header); return extraDataIsValid(storedValidators, header);
} catch (final RLPException ex) { } catch (final RLPException ex) {
LOGGER.trace("ExtraData field was unable to be deserialised into an Clique Struct.", ex); LOG.trace("ExtraData field was unable to be deserialised into an Clique Struct.", ex);
return false; return false;
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
LOGGER.trace("Failed to verify extra data", ex); LOG.trace("Failed to verify extra data", ex);
return false; return false;
} }
} }
@ -68,13 +68,13 @@ public class CliqueExtraDataValidationRule
final Address proposer = CliqueBlockHashing.recoverProposerAddress(header, cliqueExtraData); final Address proposer = CliqueBlockHashing.recoverProposerAddress(header, cliqueExtraData);
if (!expectedValidators.contains(proposer)) { if (!expectedValidators.contains(proposer)) {
LOGGER.trace("Proposer sealing block is not a member of the validators."); LOG.trace("Proposer sealing block is not a member of the validators.");
return false; return false;
} }
if (epochManager.isEpochBlock(header.getNumber())) { if (epochManager.isEpochBlock(header.getNumber())) {
if (!Iterables.elementsEqual(cliqueExtraData.getValidators(), expectedValidators)) { if (!Iterables.elementsEqual(cliqueExtraData.getValidators(), expectedValidators)) {
LOGGER.trace( LOG.trace(
"Incorrect validators. Expected {} but got {}.", "Incorrect validators. Expected {} but got {}.",
expectedValidators, expectedValidators,
cliqueExtraData.getValidators()); cliqueExtraData.getValidators());
@ -82,7 +82,7 @@ public class CliqueExtraDataValidationRule
} }
} else { } else {
if (!cliqueExtraData.getValidators().isEmpty()) { if (!cliqueExtraData.getValidators().isEmpty()) {
LOGGER.trace("Validator list on non-epoch blocks must be empty."); LOG.trace("Validator list on non-epoch blocks must be empty.");
return false; return false;
} }
} }

@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger;
public class VoteValidationRule implements DetachedBlockHeaderValidationRule { public class VoteValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(VoteValidationRule.class); private static final Logger LOG = LogManager.getLogger();
/** /**
* Responsible for ensuring the nonce is either auth or drop. * Responsible for ensuring the nonce is either auth or drop.
@ -22,7 +22,7 @@ public class VoteValidationRule implements DetachedBlockHeaderValidationRule {
public boolean validate(final BlockHeader header, final BlockHeader parent) { public boolean validate(final BlockHeader header, final BlockHeader parent) {
final long nonce = header.getNonce(); final long nonce = header.getNonce();
if (!VoteType.fromNonce(nonce).isPresent()) { if (!VoteType.fromNonce(nonce).isPresent()) {
LOGGER.trace("Nonce value ({}) is neither auth or drop.", nonce); LOG.trace("Nonce value ({}) is neither auth or drop.", nonce);
return false; return false;
} }
return true; return true;

@ -13,7 +13,7 @@ public class IbftEventQueue {
private final BlockingQueue<IbftEvent> queue = new LinkedBlockingQueue<>(); private final BlockingQueue<IbftEvent> queue = new LinkedBlockingQueue<>();
private static final int MAX_QUEUE_SIZE = 1000; private static final int MAX_QUEUE_SIZE = 1000;
private static final Logger LOGGER = LogManager.getLogger(IbftEventQueue.class); private static final Logger LOG = LogManager.getLogger();
/** /**
* Put an Ibft event onto the queue * Put an Ibft event onto the queue
@ -22,7 +22,7 @@ public class IbftEventQueue {
*/ */
public void add(final IbftEvent event) { public void add(final IbftEvent event) {
if (queue.size() > MAX_QUEUE_SIZE) { if (queue.size() > MAX_QUEUE_SIZE) {
LOGGER.warn("Queue size exceeded trying to add new ibft event {}", event.toString()); LOG.warn("Queue size exceeded trying to add new ibft event {}", event.toString());
} else { } else {
queue.add(event); queue.add(event);
} }

@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger;
/** Execution context for draining queued ibft events and applying them to a maintained state */ /** Execution context for draining queued ibft events and applying them to a maintained state */
public class IbftProcessor implements Runnable { public class IbftProcessor implements Runnable {
private static final Logger LOGGER = LogManager.getLogger(IbftEventQueue.class); private static final Logger LOG = LogManager.getLogger();
private final IbftEventQueue incomingQueue; private final IbftEventQueue incomingQueue;
private final ScheduledExecutorService roundTimerExecutor; private final ScheduledExecutorService roundTimerExecutor;
@ -73,7 +73,7 @@ public class IbftProcessor implements Runnable {
try { try {
stateMachine.processEvent(ibftEvent, roundTimer); stateMachine.processEvent(ibftEvent, roundTimer);
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.error( LOG.error(
"State machine threw exception while processing event {" + ibftEvent + "}", e); "State machine threw exception while processing event {" + ibftEvent + "}", e);
} }
}); });

@ -1,7 +1,5 @@
package net.consensys.pantheon.consensus.ibft; package net.consensys.pantheon.consensus.ibft;
import static org.apache.logging.log4j.LogManager.getLogger;
import net.consensys.pantheon.consensus.common.EpochManager; import net.consensys.pantheon.consensus.common.EpochManager;
import net.consensys.pantheon.consensus.common.VoteTally; import net.consensys.pantheon.consensus.common.VoteTally;
import net.consensys.pantheon.consensus.common.VoteType; import net.consensys.pantheon.consensus.common.VoteType;
@ -12,6 +10,7 @@ import net.consensys.pantheon.util.bytes.BytesValue;
import java.util.List; import java.util.List;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
/** /**
@ -20,7 +19,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class VoteTallyUpdater { public class VoteTallyUpdater {
private static final Logger LOGGER = getLogger(VoteTallyUpdater.class); private static final Logger LOG = LogManager.getLogger();
private static final Address NO_VOTE_SUBJECT = Address.wrap(BytesValue.wrap(new byte[20])); private static final Address NO_VOTE_SUBJECT = Address.wrap(BytesValue.wrap(new byte[20]));
private final EpochManager epochManager; private final EpochManager epochManager;
@ -38,7 +37,7 @@ public class VoteTallyUpdater {
public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) { public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) {
final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber(); final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber();
final long epochBlockNumber = epochManager.getLastEpochBlock(chainHeadBlockNumber); final long epochBlockNumber = epochManager.getLastEpochBlock(chainHeadBlockNumber);
LOGGER.info("Loading validator voting state starting from block {}", epochBlockNumber); LOG.info("Loading validator voting state starting from block {}", epochBlockNumber);
final BlockHeader epochBlock = blockchain.getBlockHeader(epochBlockNumber).get(); final BlockHeader epochBlock = blockchain.getBlockHeader(epochBlockNumber).get();
final List<Address> initialValidators = final List<Address> initialValidators =
IbftExtraData.decode(epochBlock.getExtraData()).getValidators(); IbftExtraData.decode(epochBlock.getExtraData()).getValidators();

@ -32,7 +32,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class IbftBlockCreator extends AbstractBlockCreator<IbftContext> { public class IbftBlockCreator extends AbstractBlockCreator<IbftContext> {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
private final KeyPair nodeKeys; private final KeyPair nodeKeys;
private final ProtocolSchedule<IbftContext> protocolSchedule; private final ProtocolSchedule<IbftContext> protocolSchedule;

@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class ProposerSelector { public class ProposerSelector {
private static final Logger LOGGER = LogManager.getLogger(ProposerSelector.class); private static final Logger LOG = LogManager.getLogger();
private final Blockchain blockchain; private final Blockchain blockchain;
@ -143,7 +143,7 @@ public class ProposerSelector {
final IbftExtraData extraData = IbftExtraData.decode(blockHeader.getExtraData()); final IbftExtraData extraData = IbftExtraData.decode(blockHeader.getExtraData());
return IbftBlockHashing.recoverProposerAddress(blockHeader, extraData); return IbftBlockHashing.recoverProposerAddress(blockHeader, extraData);
} else { } else {
LOGGER.trace("Unable to determine proposer for requested block"); LOG.trace("Unable to determine proposer for requested block");
throw new RuntimeException("Unable to determine past proposer"); throw new RuntimeException("Unable to determine past proposer");
} }
} }

@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidationRule<IbftContext> { public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidationRule<IbftContext> {
private static final Logger LOGGER = LogManager.getLogger(IbftExtraDataValidationRule.class); private static final Logger LOG = LogManager.getLogger();
private final boolean validateCommitSeals; private final boolean validateCommitSeals;
@ -66,7 +66,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio
final Collection<Address> storedValidators = validatorProvider.getCurrentValidators(); final Collection<Address> storedValidators = validatorProvider.getCurrentValidators();
if (!storedValidators.contains(proposer)) { if (!storedValidators.contains(proposer)) {
LOGGER.trace("Proposer sealing block is not a member of the validators."); LOG.trace("Proposer sealing block is not a member of the validators.");
return false; return false;
} }
@ -79,7 +79,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio
} }
if (!Iterables.elementsEqual(ibftExtraData.getValidators(), storedValidators)) { if (!Iterables.elementsEqual(ibftExtraData.getValidators(), storedValidators)) {
LOGGER.trace( LOG.trace(
"Incorrect validators. Expected {} but got {}.", "Incorrect validators. Expected {} but got {}.",
storedValidators, storedValidators,
ibftExtraData.getValidators()); ibftExtraData.getValidators());
@ -87,10 +87,10 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio
} }
} catch (final RLPException ex) { } catch (final RLPException ex) {
LOGGER.trace("ExtraData field was unable to be deserialised into an IBFT Struct.", ex); LOG.trace("ExtraData field was unable to be deserialised into an IBFT Struct.", ex);
return false; return false;
} catch (final IllegalArgumentException ex) { } catch (final IllegalArgumentException ex) {
LOGGER.trace("Failed to verify extra data", ex); LOG.trace("Failed to verify extra data", ex);
return false; return false;
} }
@ -102,7 +102,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio
final int minimumSealsRequired = calculateRequiredValidatorQuorum(storedValidators.size()); final int minimumSealsRequired = calculateRequiredValidatorQuorum(storedValidators.size());
if (committers.size() < minimumSealsRequired) { if (committers.size() < minimumSealsRequired) {
LOGGER.trace( LOG.trace(
"Insufficient committers to seal block. (Required {}, received {})", "Insufficient committers to seal block. (Required {}, received {})",
minimumSealsRequired, minimumSealsRequired,
committers.size()); committers.size());
@ -110,7 +110,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio
} }
if (!storedValidators.containsAll(committers)) { if (!storedValidators.containsAll(committers)) {
LOGGER.trace("Not all committers are in the locally maintained validator list."); LOG.trace("Not all committers are in the locally maintained validator list.");
return false; return false;
} }

@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger;
public class IbftProtocolManager implements ProtocolManager { public class IbftProtocolManager implements ProtocolManager {
private final IbftEventQueue ibftEventQueue; private final IbftEventQueue ibftEventQueue;
private final Logger LOGGER = LogManager.getLogger(IbftProtocolManager.class); private final Logger LOG = LogManager.getLogger();
/** /**
* Constructor for the ibft protocol manager * Constructor for the ibft protocol manager

@ -14,7 +14,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class PersonalisationString { public class PersonalisationString {
private static final Logger LOGGER = LogManager.getLogger(PersonalisationString.class); private static final Logger LOG = LogManager.getLogger(PersonalisationString.class);
private static final byte[] NETWORK_MACS = networkHardwareAddresses(); private static final byte[] NETWORK_MACS = networkHardwareAddresses();
public static byte[] getPersonalizationString() { public static byte[] getPersonalizationString() {
@ -42,7 +42,7 @@ public class PersonalisationString {
} }
} }
} catch (SocketException | BufferOverflowException e) { } catch (SocketException | BufferOverflowException e) {
LOGGER.warn( LOG.warn(
"Failed to obtain network hardware address for use in random number personalisation string, " "Failed to obtain network hardware address for use in random number personalisation string, "
+ "continuing without this piece of random information", + "continuing without this piece of random information",
e); e);

@ -39,7 +39,7 @@ public abstract class AbstractBlockCreator<C> implements AsyncBlockCreator {
BytesValue get(final BlockHeader parent); BytesValue get(final BlockHeader parent);
} }
private static final Logger LOGGER = LogManager.getLogger(AbstractBlockCreator.class); private static final Logger LOG = LogManager.getLogger();
protected final Address coinbase; protected final Address coinbase;
@ -117,7 +117,7 @@ public abstract class AbstractBlockCreator<C> implements AsyncBlockCreator {
protocolSchedule.getByBlockNumber(processableBlockHeader.getNumber()).getBlockReward(); protocolSchedule.getByBlockNumber(processableBlockHeader.getNumber()).getBlockReward();
if (!rewardBeneficiary(disposableWorldState, processableBlockHeader, ommers, blockReward)) { if (!rewardBeneficiary(disposableWorldState, processableBlockHeader, ommers, blockReward)) {
LOGGER.trace("Failed to apply mining reward, exiting."); LOG.trace("Failed to apply mining reward, exiting.");
throw new RuntimeException("Failed to apply mining reward."); throw new RuntimeException("Failed to apply mining reward.");
} }
@ -147,12 +147,11 @@ public abstract class AbstractBlockCreator<C> implements AsyncBlockCreator {
return new Block(blockHeader, new BlockBody(transactionResults.getTransactions(), ommers)); return new Block(blockHeader, new BlockBody(transactionResults.getTransactions(), ommers));
} catch (final CancellationException ex) { } catch (final CancellationException ex) {
LOGGER.trace("Attempt to create block was interrupted."); LOG.trace("Attempt to create block was interrupted.");
throw ex; throw ex;
} catch (final Exception ex) { } catch (final Exception ex) {
// TODO(tmm): How are we going to know this has exploded, and thus restart it? // TODO(tmm): How are we going to know this has exploded, and thus restart it?
LOGGER.trace( LOG.trace("Block creation failed unexpectedly. Will restart on next block added to chain.");
"Block creation failed unexpectedly. Will restart on next block added to chain.");
throw ex; throw ex;
} }
} }
@ -245,7 +244,7 @@ public abstract class AbstractBlockCreator<C> implements AsyncBlockCreator {
beneficiary.incrementBalance(coinbaseReward); beneficiary.incrementBalance(coinbaseReward);
for (final BlockHeader ommerHeader : ommers) { for (final BlockHeader ommerHeader : ommers) {
if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) { if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) {
LOGGER.trace( LOG.trace(
"Block processing error: ommer block number {} more than {} generations current block number {}", "Block processing error: ommer block number {} more than {} generations current block number {}",
ommerHeader.getNumber(), ommerHeader.getNumber(),
MAX_GENERATION, MAX_GENERATION,

@ -10,7 +10,6 @@ import net.consensys.pantheon.ethereum.core.Transaction;
import net.consensys.pantheon.ethereum.core.TransactionReceipt; import net.consensys.pantheon.ethereum.core.TransactionReceipt;
import net.consensys.pantheon.ethereum.core.Wei; import net.consensys.pantheon.ethereum.core.Wei;
import net.consensys.pantheon.ethereum.core.WorldUpdater; import net.consensys.pantheon.ethereum.core.WorldUpdater;
import net.consensys.pantheon.ethereum.mainnet.MainnetBlockProcessor;
import net.consensys.pantheon.ethereum.mainnet.MainnetBlockProcessor.TransactionReceiptFactory; import net.consensys.pantheon.ethereum.mainnet.MainnetBlockProcessor.TransactionReceiptFactory;
import net.consensys.pantheon.ethereum.mainnet.TransactionProcessor; import net.consensys.pantheon.ethereum.mainnet.TransactionProcessor;
@ -44,7 +43,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class BlockTransactionSelector { public class BlockTransactionSelector {
private static final Logger LOGGER = LogManager.getLogger(MainnetBlockProcessor.class); private static final Logger LOG = LogManager.getLogger();
private final Wei minTransactionGasPrice; private final Wei minTransactionGasPrice;
private static final double MIN_BLOCK_OCCUPANCY_RATIO = 0.8; private static final double MIN_BLOCK_OCCUPANCY_RATIO = 0.8;

@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger;
public class BlockHeaderValidator<C> { public class BlockHeaderValidator<C> {
private static final Logger LOGGER = LogManager.getLogger(BlockHeaderValidator.class); private static final Logger LOG = LogManager.getLogger();
private final List<Rule<C>> rules; private final List<Rule<C>> rules;
@ -69,7 +69,7 @@ public class BlockHeaderValidator<C> {
final Optional<BlockHeader> parent = final Optional<BlockHeader> parent =
context.getBlockchain().getBlockHeader(header.getParentHash()); context.getBlockchain().getBlockHeader(header.getParentHash());
if (!parent.isPresent()) { if (!parent.isPresent()) {
LOGGER.trace("Invalid block header: cannot determine parent header"); LOG.trace("Invalid block header: cannot determine parent header");
} }
return parent; return parent;
} }

@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger;
public class EthHashCacheFactory { public class EthHashCacheFactory {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
public static class EthHashDescriptor { public static class EthHashDescriptor {
private final long datasetSize; private final long datasetSize;

@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger;
public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> { public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static final Logger LOGGER = LogManager.getLogger(MainnetBlockBodyValidator.class); private static final Logger LOG = LogManager.getLogger();
private static final int MAX_OMMERS = 2; private static final int MAX_OMMERS = 2;
@ -84,7 +84,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateTransactionsRoot(final Bytes32 expected, final Bytes32 actual) { private static boolean validateTransactionsRoot(final Bytes32 expected, final Bytes32 actual) {
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
LOGGER.warn( LOG.warn(
"Invalid block: transaction root mismatch (expected={}, actual={})", expected, actual); "Invalid block: transaction root mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -95,7 +95,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateLogsBloom( private static boolean validateLogsBloom(
final LogsBloomFilter expected, final LogsBloomFilter actual) { final LogsBloomFilter expected, final LogsBloomFilter actual) {
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
LOGGER.warn( LOG.warn(
"Invalid block: logs bloom filter mismatch (expected={}, actual={})", expected, actual); "Invalid block: logs bloom filter mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -105,7 +105,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateGasUsed(final long expected, final long actual) { private static boolean validateGasUsed(final long expected, final long actual) {
if (expected != actual) { if (expected != actual) {
LOGGER.warn("Invalid block: gas used mismatch (expected={}, actual={})", expected, actual); LOG.warn("Invalid block: gas used mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -114,8 +114,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateReceiptsRoot(final Bytes32 expected, final Bytes32 actual) { private static boolean validateReceiptsRoot(final Bytes32 expected, final Bytes32 actual) {
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
LOGGER.warn( LOG.warn("Invalid block: receipts root mismatch (expected={}, actual={})", expected, actual);
"Invalid block: receipts root mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -124,7 +123,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateStateRoot(final Bytes32 expected, final Bytes32 actual) { private static boolean validateStateRoot(final Bytes32 expected, final Bytes32 actual) {
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
LOGGER.warn("Invalid block: state root mismatch (expected={}, actual={})", expected, actual); LOG.warn("Invalid block: state root mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -149,7 +148,7 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private static boolean validateOmmersHash(final Bytes32 expected, final Bytes32 actual) { private static boolean validateOmmersHash(final Bytes32 expected, final Bytes32 actual) {
if (!expected.equals(actual)) { if (!expected.equals(actual)) {
LOGGER.warn("Invalid block: ommers hash mismatch (expected={}, actual={})", expected, actual); LOG.warn("Invalid block: ommers hash mismatch (expected={}, actual={})", expected, actual);
return false; return false;
} }
@ -159,19 +158,18 @@ public class MainnetBlockBodyValidator<C> implements BlockBodyValidator<C> {
private boolean validateOmmers( private boolean validateOmmers(
final ProtocolContext<C> context, final BlockHeader header, final List<BlockHeader> ommers) { final ProtocolContext<C> context, final BlockHeader header, final List<BlockHeader> ommers) {
if (ommers.size() > MAX_OMMERS) { if (ommers.size() > MAX_OMMERS) {
LOGGER.warn( LOG.warn("Invalid block: ommer count {} exceeds ommer limit {}", ommers.size(), MAX_OMMERS);
"Invalid block: ommer count {} exceeds ommer limit {}", ommers.size(), MAX_OMMERS);
return false; return false;
} }
if (!areOmmersUnique(ommers)) { if (!areOmmersUnique(ommers)) {
LOGGER.warn("Invalid block: ommers are not unique"); LOG.warn("Invalid block: ommers are not unique");
return false; return false;
} }
for (final BlockHeader ommer : ommers) { for (final BlockHeader ommer : ommers) {
if (!isOmmerValid(context, header, ommer)) { if (!isOmmerValid(context, header, ommer)) {
LOGGER.warn("Invalid block: ommer is invalid"); LOG.warn("Invalid block: ommer is invalid");
return false; return false;
} }
} }

@ -28,7 +28,7 @@ public class MainnetBlockProcessor implements BlockProcessor {
TransactionProcessor.Result result, WorldState worldState, long gasUsed); TransactionProcessor.Result result, WorldState worldState, long gasUsed);
} }
private static final Logger LOGGER = LogManager.getLogger(MainnetBlockProcessor.class); private static final Logger LOG = LogManager.getLogger();
private static final int MAX_GENERATION = 6; private static final int MAX_GENERATION = 6;
@ -99,7 +99,7 @@ public class MainnetBlockProcessor implements BlockProcessor {
final long remainingGasBudget = blockHeader.getGasLimit() - gasUsed; final long remainingGasBudget = blockHeader.getGasLimit() - gasUsed;
if (Long.compareUnsigned(transaction.getGasLimit(), remainingGasBudget) > 0) { if (Long.compareUnsigned(transaction.getGasLimit(), remainingGasBudget) > 0) {
LOGGER.warn( LOG.warn(
"Transaction processing error: transaction gas limit {} exceeds available block budget remaining {}", "Transaction processing error: transaction gas limit {} exceeds available block budget remaining {}",
transaction.getGasLimit(), transaction.getGasLimit(),
remainingGasBudget); remainingGasBudget);
@ -149,7 +149,7 @@ public class MainnetBlockProcessor implements BlockProcessor {
coinbase.incrementBalance(coinbaseReward); coinbase.incrementBalance(coinbaseReward);
for (final BlockHeader ommerHeader : ommers) { for (final BlockHeader ommerHeader : ommers) {
if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) { if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) {
LOGGER.warn( LOG.warn(
"Block processing error: ommer block number {} more than {} generations current block number {}", "Block processing error: ommer block number {} more than {} generations current block number {}",
ommerHeader.getNumber(), ommerHeader.getNumber(),
MAX_GENERATION, MAX_GENERATION,

@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger;
/** A contract creation message processor. */ /** A contract creation message processor. */
public class MainnetContractCreationProcessor extends AbstractMessageProcessor { public class MainnetContractCreationProcessor extends AbstractMessageProcessor {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
private final boolean requireCodeDepositToSucceed; private final boolean requireCodeDepositToSucceed;
@ -69,8 +69,8 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor {
@Override @Override
public void start(final MessageFrame frame) { public void start(final MessageFrame frame) {
if (LOGGER.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOGGER.trace("Executing contract-creation"); LOG.trace("Executing contract-creation");
} }
final MutableAccount sender = frame.getWorldState().getMutable(frame.getSenderAddress()); final MutableAccount sender = frame.getWorldState().getMutable(frame.getSenderAddress());
@ -82,7 +82,7 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor {
// incorrectly include this even in early hard forks. // incorrectly include this even in early hard forks.
final MutableAccount contract = frame.getWorldState().getOrCreate(frame.getContractAddress()); final MutableAccount contract = frame.getWorldState().getOrCreate(frame.getContractAddress());
if (accountExists(contract)) { if (accountExists(contract)) {
LOGGER.trace( LOG.trace(
"Contract creation error: account as already been created for address {}", "Contract creation error: account as already been created for address {}",
frame.getContractAddress()); frame.getContractAddress());
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT); frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
@ -100,21 +100,21 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor {
final Gas depositFee = gasCalculator.codeDepositGasCost(contractCode.size()); final Gas depositFee = gasCalculator.codeDepositGasCost(contractCode.size());
if (frame.getRemainingGas().compareTo(depositFee) < 0) { if (frame.getRemainingGas().compareTo(depositFee) < 0) {
LOGGER.trace( LOG.trace(
"Not enough gas to pay the code deposit fee for {}: " "Not enough gas to pay the code deposit fee for {}: "
+ "remaining gas = {} < {} = deposit fee", + "remaining gas = {} < {} = deposit fee",
frame.getContractAddress(), frame.getContractAddress(),
frame.getRemainingGas(), frame.getRemainingGas(),
depositFee); depositFee);
if (requireCodeDepositToSucceed) { if (requireCodeDepositToSucceed) {
LOGGER.trace("Contract creation error: insufficient funds for code deposit"); LOG.trace("Contract creation error: insufficient funds for code deposit");
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT); frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
} else { } else {
frame.setState(MessageFrame.State.COMPLETED_SUCCESS); frame.setState(MessageFrame.State.COMPLETED_SUCCESS);
} }
} else { } else {
if (contractCode.size() > codeSizeLimit) { if (contractCode.size() > codeSizeLimit) {
LOGGER.trace( LOG.trace(
"Contract creation error: code size {} exceeds code size limit {}", "Contract creation error: code size {} exceeds code size limit {}",
contractCode.size(), contractCode.size(),
codeSizeLimit); codeSizeLimit);
@ -126,7 +126,7 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor {
final MutableAccount contract = final MutableAccount contract =
frame.getWorldState().getOrCreate(frame.getContractAddress()); frame.getWorldState().getOrCreate(frame.getContractAddress());
contract.setCode(contractCode); contract.setCode(contractCode);
LOGGER.trace( LOG.trace(
"Successful creation of contract {} with code of size {} (Gas remaining: {})", "Successful creation of contract {} with code of size {} (Gas remaining: {})",
frame.getContractAddress(), frame.getContractAddress(),
contractCode.size(), contractCode.size(),

@ -15,7 +15,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class MainnetMessageCallProcessor extends AbstractMessageProcessor { public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
private final PrecompileContractRegistry precompiles; private final PrecompileContractRegistry precompiles;
@ -34,7 +34,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
@Override @Override
public void start(final MessageFrame frame) { public void start(final MessageFrame frame) {
LOGGER.trace("Executing message-call"); LOG.trace("Executing message-call");
transferValue(frame); transferValue(frame);
@ -49,7 +49,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
@Override @Override
protected void codeSuccess(final MessageFrame frame) { protected void codeSuccess(final MessageFrame frame) {
LOGGER.trace( LOG.trace(
"Successful message call of {} to {} (Gas remaining: {})", "Successful message call of {} to {} (Gas remaining: {})",
frame.getSenderAddress(), frame.getSenderAddress(),
frame.getRecipientAddress(), frame.getRecipientAddress(),
@ -71,12 +71,12 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
frame.getWorldState().getOrCreate(frame.getRecipientAddress()); frame.getWorldState().getOrCreate(frame.getRecipientAddress());
if (frame.getRecipientAddress().equals(frame.getSenderAddress())) { if (frame.getRecipientAddress().equals(frame.getSenderAddress())) {
LOGGER.trace("Message call of {} to itself: no fund transferred", frame.getSenderAddress()); LOG.trace("Message call of {} to itself: no fund transferred", frame.getSenderAddress());
} else { } else {
final Wei prevSenderBalance = senderAccount.decrementBalance(frame.getValue()); final Wei prevSenderBalance = senderAccount.decrementBalance(frame.getValue());
final Wei prevRecipientBalance = recipientAccount.incrementBalance(frame.getValue()); final Wei prevRecipientBalance = recipientAccount.incrementBalance(frame.getValue());
LOGGER.trace( LOG.trace(
"Transferred value {} for message call from {} ({} -> {}) to {} ({} -> {})", "Transferred value {} for message call from {} ({} -> {}) to {} ({} -> {})",
frame.getValue(), frame.getValue(),
frame.getSenderAddress(), frame.getSenderAddress(),
@ -96,7 +96,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame) { private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame) {
final Gas gasRequirement = contract.gasRequirement(frame.getInputData()); final Gas gasRequirement = contract.gasRequirement(frame.getInputData());
if (frame.getRemainingGas().compareTo(gasRequirement) < 0) { if (frame.getRemainingGas().compareTo(gasRequirement) < 0) {
LOGGER.trace( LOG.trace(
"Not enough gas available for pre-compiled contract code {}: requiring " "Not enough gas available for pre-compiled contract code {}: requiring "
+ "{} but only {} gas available", + "{} but only {} gas available",
contract, contract,
@ -108,14 +108,13 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor {
final BytesValue output = contract.compute(frame.getInputData()); final BytesValue output = contract.compute(frame.getInputData());
if (output != null) { if (output != null) {
frame.setOutputData(output); frame.setOutputData(output);
LOGGER.trace( LOG.trace(
"Precompiled contract {} successfully executed (gas consumed: {})", "Precompiled contract {} successfully executed (gas consumed: {})",
contract, contract,
gasRequirement); gasRequirement);
frame.setState(MessageFrame.State.COMPLETED_SUCCESS); frame.setState(MessageFrame.State.COMPLETED_SUCCESS);
} else { } else {
LOGGER.trace( LOG.trace("Precompiled contract {} failed (gas consumed: {})", contract, gasRequirement);
"Precompiled contract {} failed (gas consumed: {})", contract, gasRequirement);
frame.setState(MessageFrame.State.EXCEPTIONAL_HALT); frame.setState(MessageFrame.State.EXCEPTIONAL_HALT);
} }
} }

@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger;
public class MainnetTransactionProcessor implements TransactionProcessor { public class MainnetTransactionProcessor implements TransactionProcessor {
private static final Logger LOGGER = LogManager.getLogger(MainnetTransactionProcessor.class); private static final Logger LOG = LogManager.getLogger();
private final GasCalculator gasCalculator; private final GasCalculator gasCalculator;
@ -130,7 +130,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor {
final Transaction transaction, final Transaction transaction,
final Address miningBenficiary, final Address miningBenficiary,
final OperationTracer operationTracer) { final OperationTracer operationTracer) {
LOGGER.trace("Starting execution of {}", transaction); LOG.trace("Starting execution of {}", transaction);
ValidationResult<TransactionInvalidReason> validationResult = ValidationResult<TransactionInvalidReason> validationResult =
transactionValidator.validate(transaction); transactionValidator.validate(transaction);
@ -138,7 +138,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor {
// compare against a sender account (because the transaction may not // compare against a sender account (because the transaction may not
// be signed correctly to extract the sender). // be signed correctly to extract the sender).
if (!validationResult.isValid()) { if (!validationResult.isValid()) {
LOGGER.warn("Invalid transaction: {}", validationResult.getErrorMessage()); LOG.warn("Invalid transaction: {}", validationResult.getErrorMessage());
return Result.invalid(validationResult); return Result.invalid(validationResult);
} }
@ -147,17 +147,17 @@ public class MainnetTransactionProcessor implements TransactionProcessor {
validationResult = validationResult =
transactionValidator.validateForSender(transaction, sender, OptionalLong.empty()); transactionValidator.validateForSender(transaction, sender, OptionalLong.empty());
if (!validationResult.isValid()) { if (!validationResult.isValid()) {
LOGGER.warn("Invalid transaction: {}", validationResult.getErrorMessage()); LOG.warn("Invalid transaction: {}", validationResult.getErrorMessage());
return Result.invalid(validationResult); return Result.invalid(validationResult);
} }
final long previousNonce = sender.incrementNonce(); final long previousNonce = sender.incrementNonce();
LOGGER.trace( LOG.trace(
"Incremented sender {} nonce ({} -> {})", senderAddress, previousNonce, sender.getNonce()); "Incremented sender {} nonce ({} -> {})", senderAddress, previousNonce, sender.getNonce());
final Wei upfrontGasCost = transaction.getUpfrontGasCost(); final Wei upfrontGasCost = transaction.getUpfrontGasCost();
final Wei previousBalance = sender.decrementBalance(upfrontGasCost); final Wei previousBalance = sender.decrementBalance(upfrontGasCost);
LOGGER.trace( LOG.trace(
"Deducted sender {} upfront gas cost {} ({} -> {})", "Deducted sender {} upfront gas cost {} ({} -> {})",
senderAddress, senderAddress,
upfrontGasCost, upfrontGasCost,
@ -166,7 +166,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor {
final Gas intrinsicGas = gasCalculator.transactionIntrinsicGasCost(transaction); final Gas intrinsicGas = gasCalculator.transactionIntrinsicGasCost(transaction);
final Gas gasAvailable = Gas.of(transaction.getGasLimit()).minus(intrinsicGas); final Gas gasAvailable = Gas.of(transaction.getGasLimit()).minus(intrinsicGas);
LOGGER.trace( LOG.trace(
"Gas available for execution {} = {} - {} (limit - intrinsic)", "Gas available for execution {} = {} - {} (limit - intrinsic)",
gasAvailable, gasAvailable,
transaction.getGasLimit(), transaction.getGasLimit(),
@ -236,8 +236,8 @@ public class MainnetTransactionProcessor implements TransactionProcessor {
worldUpdater.commit(); worldUpdater.commit();
} }
if (LOGGER.isTraceEnabled()) { if (LOG.isTraceEnabled()) {
LOGGER.trace( LOG.trace(
"Gas used by transaction: {}, by message call/contract creation: {}", "Gas used by transaction: {}, by message call/contract creation: {}",
() -> Gas.of(transaction.getGasLimit()).minus(initialFrame.getRemainingGas()), () -> Gas.of(transaction.getGasLimit()).minus(initialFrame.getRemainingGas()),
() -> gasAvailable.minus(initialFrame.getRemainingGas())); () -> gasAvailable.minus(initialFrame.getRemainingGas()));

@ -11,12 +11,12 @@ import org.apache.logging.log4j.Logger;
* header. * header.
*/ */
public class AncestryValidationRule implements DetachedBlockHeaderValidationRule { public class AncestryValidationRule implements DetachedBlockHeaderValidationRule {
private final Logger LOGGER = LogManager.getLogger(AncestryValidationRule.class); private final Logger LOG = LogManager.getLogger(AncestryValidationRule.class);
@Override @Override
public boolean validate(final BlockHeader header, final BlockHeader parent) { public boolean validate(final BlockHeader header, final BlockHeader parent) {
if (!header.getParentHash().equals(parent.getHash())) { if (!header.getParentHash().equals(parent.getHash())) {
LOGGER.trace( LOG.trace(
"Invalid parent block header. Parent hash {} does not match " "Invalid parent block header. Parent hash {} does not match "
+ "supplied parent header {}.", + "supplied parent header {}.",
header.getParentHash(), header.getParentHash(),
@ -25,7 +25,7 @@ public class AncestryValidationRule implements DetachedBlockHeaderValidationRule
} }
if (header.getNumber() != (parent.getNumber() + 1)) { if (header.getNumber() != (parent.getNumber() + 1)) {
LOGGER.trace( LOG.trace(
"Invalid block header: number {} is not one more than parent number {}", "Invalid block header: number {} is not one more than parent number {}",
header.getNumber(), header.getNumber(),
parent.getNumber()); parent.getNumber());

@ -11,7 +11,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class CalculatedDifficultyValidationRule<C> implements AttachedBlockHeaderValidationRule<C> { public class CalculatedDifficultyValidationRule<C> implements AttachedBlockHeaderValidationRule<C> {
private final Logger LOGGER = LogManager.getLogger(CalculatedDifficultyValidationRule.class); private final Logger LOG = LogManager.getLogger(CalculatedDifficultyValidationRule.class);
private final DifficultyCalculator<C> difficultyCalculator; private final DifficultyCalculator<C> difficultyCalculator;
public CalculatedDifficultyValidationRule(final DifficultyCalculator<C> difficultyCalculator) { public CalculatedDifficultyValidationRule(final DifficultyCalculator<C> difficultyCalculator) {
@ -27,7 +27,7 @@ public class CalculatedDifficultyValidationRule<C> implements AttachedBlockHeade
difficultyCalculator.nextDifficulty(header.getTimestamp(), parent, context); difficultyCalculator.nextDifficulty(header.getTimestamp(), parent, context);
if (actualDifficulty.compareTo(expectedDifficulty) != 0) { if (actualDifficulty.compareTo(expectedDifficulty) != 0) {
LOGGER.trace( LOG.trace(
"Invalid block header: difficulty {} does not equal expected difficulty {}", "Invalid block header: difficulty {} does not equal expected difficulty {}",
actualDifficulty, actualDifficulty,
expectedDifficulty); expectedDifficulty);

@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class ExtraDataMaxLengthValidationRule implements DetachedBlockHeaderValidationRule { public class ExtraDataMaxLengthValidationRule implements DetachedBlockHeaderValidationRule {
private final Logger LOGGER = LogManager.getLogger(ExtraDataMaxLengthValidationRule.class); private final Logger LOG = LogManager.getLogger(ExtraDataMaxLengthValidationRule.class);
private final long maxExtraDataBytes; private final long maxExtraDataBytes;
public ExtraDataMaxLengthValidationRule(final long maxExtraDataBytes) { public ExtraDataMaxLengthValidationRule(final long maxExtraDataBytes) {
@ -27,7 +27,7 @@ public class ExtraDataMaxLengthValidationRule implements DetachedBlockHeaderVali
private boolean validateExtraData(final BytesValue extraData) { private boolean validateExtraData(final BytesValue extraData) {
if (extraData.size() > maxExtraDataBytes) { if (extraData.size() > maxExtraDataBytes) {
LOGGER.trace( LOG.trace(
"Invalid block header: extra data field length {} is greater {}", "Invalid block header: extra data field length {} is greater {}",
extraData.size(), extraData.size(),
maxExtraDataBytes); maxExtraDataBytes);

@ -15,8 +15,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderValidationRule { public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOGGER = private static final Logger LOG = LogManager.getLogger(GasLimitRangeAndDeltaValidationRule.class);
LogManager.getLogger(GasLimitRangeAndDeltaValidationRule.class);
private static final int GASLIMIT_BOUND_DIVISOR = 1024; private static final int GASLIMIT_BOUND_DIVISOR = 1024;
private final long minGasLimit; private final long minGasLimit;
private final long maxGasLimit; private final long maxGasLimit;
@ -37,7 +36,7 @@ public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderV
final long gasLimit = header.getGasLimit(); final long gasLimit = header.getGasLimit();
if ((gasLimit < minGasLimit) || (gasLimit > maxGasLimit)) { if ((gasLimit < minGasLimit) || (gasLimit > maxGasLimit)) {
LOGGER.trace( LOG.trace(
"Header gasLimit = {}, outside range {} --> {}", gasLimit, minGasLimit, maxGasLimit); "Header gasLimit = {}, outside range {} --> {}", gasLimit, minGasLimit, maxGasLimit);
return false; return false;
} }
@ -46,7 +45,7 @@ public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderV
final long difference = Math.abs(parentGasLimit - gasLimit); final long difference = Math.abs(parentGasLimit - gasLimit);
final long bounds = Long.divideUnsigned(parentGasLimit, GASLIMIT_BOUND_DIVISOR); final long bounds = Long.divideUnsigned(parentGasLimit, GASLIMIT_BOUND_DIVISOR);
if (Long.compareUnsigned(difference, bounds) >= 0) { if (Long.compareUnsigned(difference, bounds) >= 0) {
LOGGER.trace( LOG.trace(
"Invalid block header: gas limit delta {} is out of bounds of {}", gasLimit, bounds); "Invalid block header: gas limit delta {} is out of bounds of {}", gasLimit, bounds);
return false; return false;
} }

@ -12,12 +12,12 @@ import org.apache.logging.log4j.Logger;
*/ */
public class GasUsageValidationRule implements DetachedBlockHeaderValidationRule { public class GasUsageValidationRule implements DetachedBlockHeaderValidationRule {
private final Logger LOGGER = LogManager.getLogger(GasUsageValidationRule.class); private final Logger LOG = LogManager.getLogger(GasUsageValidationRule.class);
@Override @Override
public boolean validate(final BlockHeader header, final BlockHeader parent) { public boolean validate(final BlockHeader header, final BlockHeader parent) {
if (header.getGasUsed() > header.getGasLimit()) { if (header.getGasUsed() > header.getGasLimit()) {
LOGGER.trace( LOG.trace(
"Invalid block header: gas used {} exceeds gas limit {}", "Invalid block header: gas used {} exceeds gas limit {}",
header.getGasUsed(), header.getGasUsed(),
header.getGasLimit()); header.getGasLimit());

@ -21,7 +21,7 @@ import org.apache.logging.log4j.Logger;
public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValidationRule { public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValidationRule {
private static final Logger LOGGER = LogManager.getLogger(ProofOfWorkValidationRule.class); private static final Logger LOG = LogManager.getLogger(ProofOfWorkValidationRule.class);
private static final int SERIALIZED_HASH_SIZE = 33; private static final int SERIALIZED_HASH_SIZE = 33;
@ -60,7 +60,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid
HASHER.hash(hashBuffer, header.getNonce(), header.getNumber(), keccak256.digest()); HASHER.hash(hashBuffer, header.getNonce(), header.getNumber(), keccak256.digest());
if (header.getDifficulty().isZero()) { if (header.getDifficulty().isZero()) {
LOGGER.trace("Rejecting header because difficulty is 0"); LOG.trace("Rejecting header because difficulty is 0");
return false; return false;
} }
final BigInteger difficulty = final BigInteger difficulty =
@ -69,7 +69,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid
final UInt256 result = UInt256.wrap(Bytes32.wrap(hashBuffer, 32)); final UInt256 result = UInt256.wrap(Bytes32.wrap(hashBuffer, 32));
if (result.compareTo(target) > 0) { if (result.compareTo(target) > 0) {
LOGGER.warn( LOG.warn(
"Invalid block header: the EthHash result {} was greater than the target {}.\n" "Invalid block header: the EthHash result {} was greater than the target {}.\n"
+ "Failing header:\n{}", + "Failing header:\n{}",
result, result,
@ -81,7 +81,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid
final Hash mixedHash = final Hash mixedHash =
Hash.wrap(Bytes32.leftPad(BytesValue.wrap(hashBuffer).slice(0, Bytes32.SIZE))); Hash.wrap(Bytes32.leftPad(BytesValue.wrap(hashBuffer).slice(0, Bytes32.SIZE)));
if (!header.getMixHash().equals(mixedHash)) { if (!header.getMixHash().equals(mixedHash)) {
LOGGER.warn( LOG.warn(
"Invalid block header: header mixed hash {} does not equal calculated mixed hash {}.\n" "Invalid block header: header mixed hash {} does not equal calculated mixed hash {}.\n"
+ "Failing header:\n{}", + "Failing header:\n{}",
header.getMixHash(), header.getMixHash(),

@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class TimestampValidationRule implements DetachedBlockHeaderValidationRule { public class TimestampValidationRule implements DetachedBlockHeaderValidationRule {
private final Logger LOGGER = LogManager.getLogger(TimestampValidationRule.class); private final Logger LOG = LogManager.getLogger(TimestampValidationRule.class);
private final long acceptableClockDriftSeconds; private final long acceptableClockDriftSeconds;
private final long minimumSecondsSinceParent; private final long minimumSecondsSinceParent;
@ -42,7 +42,7 @@ public class TimestampValidationRule implements DetachedBlockHeaderValidationRul
private boolean validateHeaderSufficientlyAheadOfParent( private boolean validateHeaderSufficientlyAheadOfParent(
final long timestamp, final long parentTimestamp) { final long timestamp, final long parentTimestamp) {
if ((timestamp - minimumSecondsSinceParent) < parentTimestamp) { if ((timestamp - minimumSecondsSinceParent) < parentTimestamp) {
LOGGER.trace( LOG.trace(
"Invalid block header: timestamp {} is not sufficiently newer than parent timestamp {}", "Invalid block header: timestamp {} is not sufficiently newer than parent timestamp {}",
timestamp, timestamp,
parentTimestamp); parentTimestamp);
@ -57,7 +57,7 @@ public class TimestampValidationRule implements DetachedBlockHeaderValidationRul
TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS) TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS)
+ acceptableClockDriftSeconds; + acceptableClockDriftSeconds;
if (Long.compareUnsigned(timestamp, timestampMargin) > 0) { if (Long.compareUnsigned(timestamp, timestampMargin) > 0) {
LOGGER.trace( LOG.trace(
"Invalid block header: timestamp {} is greater than the timestamp margin {}", "Invalid block header: timestamp {} is greater than the timestamp margin {}",
timestamp, timestamp,
timestampMargin); timestampMargin);

@ -45,7 +45,7 @@ import org.apache.logging.log4j.Logger;
public class JsonRpcHttpService { public class JsonRpcHttpService {
private static final Logger LOGGER = LogManager.getLogger(JsonRpcHttpService.class); private static final Logger LOG = LogManager.getLogger();
private static final InetSocketAddress EMPTY_SOCKET_ADDRESS = new InetSocketAddress("0.0.0.0", 0); private static final InetSocketAddress EMPTY_SOCKET_ADDRESS = new InetSocketAddress("0.0.0.0", 0);
private static final String APPLICATION_JSON = "application/json"; private static final String APPLICATION_JSON = "application/json";
@ -76,7 +76,7 @@ public class JsonRpcHttpService {
} }
public CompletableFuture<?> start() { public CompletableFuture<?> start() {
LOGGER.info("Starting JsonRPC service on {}:{}", config.getHost(), config.getPort()); LOG.info("Starting JsonRPC service on {}:{}", config.getHost(), config.getPort());
// Create the HTTP server and a router object. // Create the HTTP server and a router object.
httpServer = httpServer =
vertx.createHttpServer( vertx.createHttpServer(
@ -105,7 +105,7 @@ public class JsonRpcHttpService {
res -> { res -> {
if (!res.failed()) { if (!res.failed()) {
resultFuture.complete(null); resultFuture.complete(null);
LOGGER.info( LOG.info(
"JsonRPC service started and listening on {}:{}", "JsonRPC service started and listening on {}:{}",
config.getHost(), config.getHost(),
httpServer.actualPort()); httpServer.actualPort());
@ -298,7 +298,7 @@ public class JsonRpcHttpService {
return NO_RESPONSE; return NO_RESPONSE;
} }
LOGGER.info("JSON-RPC request -> {}", request.getMethod()); LOG.info("JSON-RPC request -> {}", request.getMethod());
// Find method handler // Find method handler
final JsonRpcMethod method = jsonRpcMethods.get(request.getMethod()); final JsonRpcMethod method = jsonRpcMethods.get(request.getMethod());
if (method == null) { if (method == null) {
@ -309,7 +309,7 @@ public class JsonRpcHttpService {
try { try {
return method.response(request); return method.response(request);
} catch (final InvalidJsonRpcParameters e) { } catch (final InvalidJsonRpcParameters e) {
LOGGER.debug(e); LOG.debug(e);
return errorResponse(id, JsonRpcError.INVALID_PARAMS); return errorResponse(id, JsonRpcError.INVALID_PARAMS);
} }
} }

@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger;
public class EthSendRawTransaction implements JsonRpcMethod { public class EthSendRawTransaction implements JsonRpcMethod {
private static final Logger LOGGER = LogManager.getLogger(EthSendRawTransaction.class); private static final Logger LOG = LogManager.getLogger();
private final TransactionPool transactionPool; private final TransactionPool transactionPool;
private final JsonRpcParameter parameters; private final JsonRpcParameter parameters;
@ -66,7 +66,7 @@ public class EthSendRawTransaction implements JsonRpcMethod {
try { try {
return Transaction.readFrom(RLP.input(BytesValue.fromHexString(hash))); return Transaction.readFrom(RLP.input(BytesValue.fromHexString(hash)));
} catch (IllegalArgumentException | RLPException e) { } catch (IllegalArgumentException | RLPException e) {
LOGGER.debug(e); LOG.debug(e);
throw new InvalidJsonRpcRequestException("Invalid raw transaction hex", e); throw new InvalidJsonRpcRequestException("Invalid raw transaction hex", e);
} }
} }

@ -15,7 +15,7 @@ import org.apache.logging.log4j.Logger;
public class WebSocketRequestHandler { public class WebSocketRequestHandler {
private static final Logger LOGGER = LogManager.getLogger(WebSocketRequestHandler.class); private static final Logger LOG = LogManager.getLogger();
private final Vertx vertx; private final Vertx vertx;
private final Map<String, JsonRpcMethod> methods; private final Map<String, JsonRpcMethod> methods;
@ -32,23 +32,23 @@ public class WebSocketRequestHandler {
try { try {
request = buffer.toJsonObject().mapTo(WebSocketRpcRequest.class); request = buffer.toJsonObject().mapTo(WebSocketRpcRequest.class);
} catch (IllegalArgumentException | DecodeException e) { } catch (IllegalArgumentException | DecodeException e) {
LOGGER.debug("Error mapping json to WebSocketRpcRequest", e); LOG.debug("Error mapping json to WebSocketRpcRequest", e);
future.complete(JsonRpcError.INVALID_REQUEST); future.complete(JsonRpcError.INVALID_REQUEST);
return; return;
} }
if (!methods.containsKey(request.getMethod())) { if (!methods.containsKey(request.getMethod())) {
future.complete(JsonRpcError.METHOD_NOT_FOUND); future.complete(JsonRpcError.METHOD_NOT_FOUND);
LOGGER.debug("Can't find method {}", request.getMethod()); LOG.debug("Can't find method {}", request.getMethod());
return; return;
} }
final JsonRpcMethod method = methods.get(request.getMethod()); final JsonRpcMethod method = methods.get(request.getMethod());
try { try {
LOGGER.info("WS-RPC request -> {}", request.getMethod()); LOG.info("WS-RPC request -> {}", request.getMethod());
request.setConnectionId(id); request.setConnectionId(id);
future.complete(method.response(request)); future.complete(method.response(request));
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.error(JsonRpcError.INTERNAL_ERROR.getMessage(), e); LOG.error(JsonRpcError.INTERNAL_ERROR.getMessage(), e);
future.complete(JsonRpcError.INTERNAL_ERROR); future.complete(JsonRpcError.INTERNAL_ERROR);
} }
}, },

@ -17,7 +17,7 @@ import org.apache.logging.log4j.Logger;
public class WebSocketService { public class WebSocketService {
private static final Logger LOGGER = LogManager.getLogger(WebSocketService.class); private static final Logger LOG = LogManager.getLogger();
private static final InetSocketAddress EMPTY_SOCKET_ADDRESS = new InetSocketAddress("0.0.0.0", 0); private static final InetSocketAddress EMPTY_SOCKET_ADDRESS = new InetSocketAddress("0.0.0.0", 0);
@ -37,7 +37,7 @@ public class WebSocketService {
} }
public CompletableFuture<?> start() { public CompletableFuture<?> start() {
LOGGER.info( LOG.info(
"Starting Websocket service on {}:{}", configuration.getHost(), configuration.getPort()); "Starting Websocket service on {}:{}", configuration.getHost(), configuration.getPort());
final CompletableFuture<?> resultFuture = new CompletableFuture<>(); final CompletableFuture<?> resultFuture = new CompletableFuture<>();
@ -60,11 +60,11 @@ public class WebSocketService {
final SocketAddress socketAddress = websocket.remoteAddress(); final SocketAddress socketAddress = websocket.remoteAddress();
final String connectionId = websocket.textHandlerID(); final String connectionId = websocket.textHandlerID();
LOGGER.debug("Websocket Connected ({})", socketAddressAsString(socketAddress)); LOG.debug("Websocket Connected ({})", socketAddressAsString(socketAddress));
websocket.handler( websocket.handler(
buffer -> { buffer -> {
LOGGER.debug( LOG.debug(
"Received Websocket request {} ({})", "Received Websocket request {} ({})",
buffer.toString(), buffer.toString(),
socketAddressAsString(socketAddress)); socketAddressAsString(socketAddress));
@ -74,7 +74,7 @@ public class WebSocketService {
websocket.closeHandler( websocket.closeHandler(
v -> { v -> {
LOGGER.debug("Websocket Disconnected ({})", socketAddressAsString(socketAddress)); LOG.debug("Websocket Disconnected ({})", socketAddressAsString(socketAddress));
vertx vertx
.eventBus() .eventBus()
.publish(SubscriptionManager.EVENTBUS_REMOVE_SUBSCRIPTIONS_ADDRESS, connectionId); .publish(SubscriptionManager.EVENTBUS_REMOVE_SUBSCRIPTIONS_ADDRESS, connectionId);
@ -82,7 +82,7 @@ public class WebSocketService {
websocket.exceptionHandler( websocket.exceptionHandler(
t -> { t -> {
LOGGER.debug( LOG.debug(
"Unrecoverable error on Websocket: {} ({})", "Unrecoverable error on Websocket: {} ({})",
t.getMessage(), t.getMessage(),
socketAddressAsString(socketAddress)); socketAddressAsString(socketAddress));
@ -95,7 +95,7 @@ public class WebSocketService {
return res -> { return res -> {
if (res.succeeded()) { if (res.succeeded()) {
LOGGER.info( LOG.info(
"Websocket service started and listening on {}:{}", "Websocket service started and listening on {}:{}",
configuration.getHost(), configuration.getHost(),
httpServer.actualPort()); httpServer.actualPort());

@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class SubscriptionManager extends AbstractVerticle { public class SubscriptionManager extends AbstractVerticle {
private static final Logger LOGGER = LogManager.getLogger(SubscriptionManager.class); private static final Logger LOG = LogManager.getLogger();
public static final String EVENTBUS_REMOVE_SUBSCRIPTIONS_ADDRESS = public static final String EVENTBUS_REMOVE_SUBSCRIPTIONS_ADDRESS =
"SubscriptionManager::removeSubscriptions"; "SubscriptionManager::removeSubscriptions";
@ -47,7 +47,7 @@ public class SubscriptionManager extends AbstractVerticle {
} }
public Long subscribe(final SubscribeRequest request) { public Long subscribe(final SubscribeRequest request) {
LOGGER.info("Subscribe request {}", request); LOG.info("Subscribe request {}", request);
final long subscriptionId = subscriptionCounter.incrementAndGet(); final long subscriptionId = subscriptionCounter.incrementAndGet();
final Subscription subscription = subscriptionBuilder.build(subscriptionId, request); final Subscription subscription = subscriptionBuilder.build(subscriptionId, request);
@ -70,7 +70,7 @@ public class SubscriptionManager extends AbstractVerticle {
} }
public boolean unsubscribe(final UnsubscribeRequest request) { public boolean unsubscribe(final UnsubscribeRequest request) {
LOGGER.debug("Unsubscribe request subscriptionId = {}", request.getSubscriptionId()); LOG.debug("Unsubscribe request subscriptionId = {}", request.getSubscriptionId());
if (!subscriptions.containsKey(request.getSubscriptionId())) { if (!subscriptions.containsKey(request.getSubscriptionId())) {
throw new SubscriptionNotFoundException(request.getSubscriptionId()); throw new SubscriptionNotFoundException(request.getSubscriptionId());
@ -102,10 +102,10 @@ public class SubscriptionManager extends AbstractVerticle {
void removeSubscriptions(final Message<String> message) { void removeSubscriptions(final Message<String> message) {
final String connectionId = message.body(); final String connectionId = message.body();
if (connectionId == null || "".equals(connectionId)) { if (connectionId == null || "".equals(connectionId)) {
LOGGER.warn("Received invalid connectionId ({}). No subscriptions removed."); LOG.warn("Received invalid connectionId ({}). No subscriptions removed.");
} }
LOGGER.debug("Removing subscription for connectionId = {}", connectionId); LOG.debug("Removing subscription for connectionId = {}", connectionId);
final List<Long> subscriptionIds = final List<Long> subscriptionIds =
Lists.newArrayList( Lists.newArrayList(

@ -26,7 +26,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class NetworkRunner implements AutoCloseable { public class NetworkRunner implements AutoCloseable {
private static final Logger LOGGER = LogManager.getLogger(NetworkRunner.class); private static final Logger LOG = LogManager.getLogger();
private final CountDownLatch shutdown = new CountDownLatch(1);; private final CountDownLatch shutdown = new CountDownLatch(1);;
private final AtomicBoolean started = new AtomicBoolean(false); private final AtomicBoolean started = new AtomicBoolean(false);
@ -59,17 +59,17 @@ public class NetworkRunner implements AutoCloseable {
public void start() { public void start() {
if (started.compareAndSet(false, true)) { if (started.compareAndSet(false, true)) {
LOGGER.info("Starting Network."); LOG.info("Starting Network.");
setupHandlers(); setupHandlers();
networkExecutor.submit(network); networkExecutor.submit(network);
} else { } else {
LOGGER.error("Attempted to start already running network."); LOG.error("Attempted to start already running network.");
} }
} }
public void stop() { public void stop() {
if (stopped.compareAndSet(false, true)) { if (stopped.compareAndSet(false, true)) {
LOGGER.info("Stopping Network."); LOG.info("Stopping Network.");
network.stop(); network.stop();
for (final ProtocolManager protocolManager : protocolManagers) { for (final ProtocolManager protocolManager : protocolManagers) {
protocolManager.stop(); protocolManager.stop();
@ -77,7 +77,7 @@ public class NetworkRunner implements AutoCloseable {
networkExecutor.shutdown(); networkExecutor.shutdown();
shutdown.countDown(); shutdown.countDown();
} else { } else {
LOGGER.error("Attempted to stop already stopped network."); LOG.error("Attempted to stop already stopped network.");
} }
} }
@ -88,11 +88,11 @@ public class NetworkRunner implements AutoCloseable {
protocolManager.awaitStop(); protocolManager.awaitStop();
} }
if (!networkExecutor.awaitTermination(2L, TimeUnit.MINUTES)) { if (!networkExecutor.awaitTermination(2L, TimeUnit.MINUTES)) {
LOGGER.error("Network executor did not shutdown cleanly."); LOG.error("Network executor did not shutdown cleanly.");
networkExecutor.shutdownNow(); networkExecutor.shutdownNow();
networkExecutor.awaitTermination(2L, TimeUnit.MINUTES); networkExecutor.awaitTermination(2L, TimeUnit.MINUTES);
} }
LOGGER.info("Network stopped."); LOG.info("Network stopped.");
} }
private void setupHandlers() { private void setupHandlers() {
@ -108,7 +108,7 @@ public class NetworkRunner implements AutoCloseable {
final int code = message.getData().getCode(); final int code = message.getData().getCode();
if (!protocol.isValidMessageCode(cap.getVersion(), code)) { if (!protocol.isValidMessageCode(cap.getVersion(), code)) {
// Handle invalid messsages by disconnecting // Handle invalid messsages by disconnecting
LOGGER.info( LOG.info(
"Invalid message code ({}-{}, {}) received from peer, disconnecting from:", "Invalid message code ({}-{}, {}) received from peer, disconnecting from:",
cap.getName(), cap.getName(),
cap.getVersion(), cap.getVersion(),

@ -78,7 +78,7 @@ import org.apache.logging.log4j.Logger;
* </ol> * </ol>
*/ */
public class PeerDiscoveryAgent implements DisconnectCallback { public class PeerDiscoveryAgent implements DisconnectCallback {
private static final Logger LOG = LogManager.getLogger(PeerDiscoveryAgent.class); private static final Logger LOG = LogManager.getLogger();
// The devp2p specification says only accept packets up to 1280, but some // The devp2p specification says only accept packets up to 1280, but some
// clients ignore that, so we add in a little extra padding. // clients ignore that, so we add in a little extra padding.

@ -79,7 +79,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public class PeerDiscoveryController { public class PeerDiscoveryController {
private static final Logger LOG = LogManager.getLogger(PeerDiscoveryController.class); private static final Logger LOG = LogManager.getLogger();
private static final long REFRESH_CHECK_INTERVAL_MILLIS = MILLISECONDS.convert(30, SECONDS); private static final long REFRESH_CHECK_INTERVAL_MILLIS = MILLISECONDS.convert(30, SECONDS);
private final Vertx vertx; private final Vertx vertx;
private final PeerTable peerTable; private final PeerTable peerTable;

@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger;
final class ApiHandler extends SimpleChannelInboundHandler<MessageData> { final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
private static final Logger LOGGER = LogManager.getLogger(ApiHandler.class); private static final Logger LOG = LogManager.getLogger();
private final CapabilityMultiplexer multiplexer; private final CapabilityMultiplexer multiplexer;
private final AtomicBoolean waitingForPong; private final AtomicBoolean waitingForPong;
@ -49,7 +49,7 @@ final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
if (demultiplexed.getCapability() == null) { if (demultiplexed.getCapability() == null) {
switch (message.getCode()) { switch (message.getCode()) {
case WireMessageCodes.PING: case WireMessageCodes.PING:
LOGGER.debug("Received Wire PING"); LOG.debug("Received Wire PING");
try { try {
connection.send(null, PongMessage.get()); connection.send(null, PongMessage.get());
} catch (final PeerNotConnected peerNotConnected) { } catch (final PeerNotConnected peerNotConnected) {
@ -57,7 +57,7 @@ final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
} }
break; break;
case WireMessageCodes.PONG: case WireMessageCodes.PONG:
LOGGER.debug("Received Wire PONG"); LOG.debug("Received Wire PONG");
waitingForPong.set(false); waitingForPong.set(false);
break; break;
case WireMessageCodes.DISCONNECT: case WireMessageCodes.DISCONNECT:
@ -65,18 +65,18 @@ final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
DisconnectReason reason = null; DisconnectReason reason = null;
try { try {
reason = disconnect.getReason(); reason = disconnect.getReason();
LOGGER.info( LOG.info(
"Received Wire DISCONNECT ({}) from peer: {}", "Received Wire DISCONNECT ({}) from peer: {}",
reason.name(), reason.name(),
connection.getPeer().getClientId()); connection.getPeer().getClientId());
} catch (final RLPException e) { } catch (final RLPException e) {
// It seems pretty common to get disconnect messages with no reason, which results in an // It seems pretty common to get disconnect messages with no reason, which results in an
// rlp parsing error // rlp parsing error
LOGGER.warn( LOG.warn(
"Received Wire DISCONNECT, but unable to parse reason. Peer: {}", "Received Wire DISCONNECT, but unable to parse reason. Peer: {}",
connection.getPeer().getClientId()); connection.getPeer().getClientId());
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.error( LOG.error(
"Received Wire DISCONNECT, but unable to parse reason. Peer: {}", "Received Wire DISCONNECT, but unable to parse reason. Peer: {}",
connection.getPeer().getClientId(), connection.getPeer().getClientId(),
e); e);
@ -91,7 +91,7 @@ final class ApiHandler extends SimpleChannelInboundHandler<MessageData> {
@Override @Override
public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable throwable) { public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable throwable) {
LOGGER.error("Error:", throwable); LOG.error("Error:", throwable);
callbacks.invokeDisconnect(connection, DisconnectReason.TCP_SUBSYSTEM_ERROR, false); callbacks.invokeDisconnect(connection, DisconnectReason.TCP_SUBSYSTEM_ERROR, false);
ctx.close(); ctx.close();
} }

@ -16,7 +16,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class Callbacks { public class Callbacks {
private static final Logger LOGGER = LogManager.getLogger(Callbacks.class); private static final Logger LOG = LogManager.getLogger();
private static final Subscribers<Consumer<Message>> NO_SUBSCRIBERS = new Subscribers<>(); private static final Subscribers<Consumer<Message>> NO_SUBSCRIBERS = new Subscribers<>();
private final Map<Capability, Subscribers<Consumer<Message>>> callbacks; private final Map<Capability, Subscribers<Consumer<Message>>> callbacks;
@ -48,7 +48,7 @@ public class Callbacks {
try { try {
consumer.accept(fullMessage); consumer.accept(fullMessage);
} catch (final Throwable t) { } catch (final Throwable t) {
LOGGER.error("Error in callback:", t); LOG.error("Error in callback:", t);
} }
}); });
} }

@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger;
final class DeFramer extends ByteToMessageDecoder { final class DeFramer extends ByteToMessageDecoder {
private static final Logger LOG = LogManager.getLogger(DeFramer.class); private static final Logger LOG = LogManager.getLogger();
private final CompletableFuture<PeerConnection> connectFuture; private final CompletableFuture<PeerConnection> connectFuture;

@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger;
public final class HandshakeHandlerOutbound extends AbstractHandshakeHandler { public final class HandshakeHandlerOutbound extends AbstractHandshakeHandler {
private static final Logger LOGGER = LogManager.getLogger(HandshakeHandlerOutbound.class); private static final Logger LOG = LogManager.getLogger();
private final ByteBuf first; private final ByteBuf first;
@ -53,7 +53,7 @@ public final class HandshakeHandlerOutbound extends AbstractHandshakeHandler {
.addListener( .addListener(
f -> { f -> {
if (f.isSuccess()) { if (f.isSuccess()) {
LOGGER.debug( LOG.debug(
"Wrote initial crypto handshake message to {}.", ctx.channel().remoteAddress()); "Wrote initial crypto handshake message to {}.", ctx.channel().remoteAddress());
} }
}); });

@ -87,7 +87,7 @@ import org.apache.logging.log4j.Logger;
*/ */
public final class NettyP2PNetwork implements P2PNetwork { public final class NettyP2PNetwork implements P2PNetwork {
private static final Logger LOGGER = LogManager.getLogger(NettyP2PNetwork.class); private static final Logger LOG = LogManager.getLogger();
private static final int TIMEOUT_SECONDS = 30; private static final int TIMEOUT_SECONDS = 30;
final Map<Capability, Subscribers<Consumer<Message>>> protocolCallbacks = final Map<Capability, Subscribers<Consumer<Message>>> protocolCallbacks =
@ -173,7 +173,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
supportedCapabilities, supportedCapabilities,
socketAddress.getPort(), socketAddress.getPort(),
this.keyPair.getPublicKey().getEncodedBytes()); this.keyPair.getPublicKey().getEncodedBytes());
LOGGER.info("P2PNetwork started and listening on {}", socketAddress); LOG.info("P2PNetwork started and listening on {}", socketAddress);
latch.countDown(); latch.countDown();
}); });
@ -209,7 +209,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
connection -> { connection -> {
// Reject incoming connections if we've reached our limit // Reject incoming connections if we've reached our limit
if (connections.size() >= maxPeers) { if (connections.size() >= maxPeers) {
LOGGER.info( LOG.info(
"Disconnecting incoming connection because connection limit of {} has been reached: {}", "Disconnecting incoming connection because connection limit of {} has been reached: {}",
maxPeers, maxPeers,
connection.getPeer().getNodeId()); connection.getPeer().getNodeId());
@ -223,7 +223,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
} }
onConnectionEstablished(connection); onConnectionEstablished(connection);
LOGGER.info( LOG.info(
"Successfully accepted connection from {}", connection.getPeer().getNodeId()); "Successfully accepted connection from {}", connection.getPeer().getNodeId());
logConnections(); logConnections();
}); });
@ -242,7 +242,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
@Override @Override
public CompletableFuture<PeerConnection> connect(final Peer peer) { public CompletableFuture<PeerConnection> connect(final Peer peer) {
LOGGER.trace("Initiating connection to peer: {}", peer.getId()); LOG.trace("Initiating connection to peer: {}", peer.getId());
final CompletableFuture<PeerConnection> connectionFuture = new CompletableFuture<>(); final CompletableFuture<PeerConnection> connectionFuture = new CompletableFuture<>();
final Endpoint endpoint = peer.getEndpoint(); final Endpoint endpoint = peer.getEndpoint();
pendingConnections.incrementAndGet(); pendingConnections.incrementAndGet();
@ -290,9 +290,9 @@ public final class NettyP2PNetwork implements P2PNetwork {
pendingConnections.decrementAndGet(); pendingConnections.decrementAndGet();
if (t == null) { if (t == null) {
onConnectionEstablished(connection); onConnectionEstablished(connection);
LOGGER.info("Connection established to peer: {}", peer.getId()); LOG.info("Connection established to peer: {}", peer.getId());
} else { } else {
LOGGER.warn("Failed to connect to peer {}: {}", peer.getId(), t); LOG.warn("Failed to connect to peer {}: {}", peer.getId(), t);
} }
logConnections(); logConnections();
}); });
@ -300,7 +300,7 @@ public final class NettyP2PNetwork implements P2PNetwork {
} }
private void logConnections() { private void logConnections() {
LOGGER.info( LOG.info(
"Connections: {} pending, {} active connections.", "Connections: {} pending, {} active connections.",
pendingConnections.get(), pendingConnections.get(),
connections.size()); connections.size());

@ -27,7 +27,7 @@ import org.apache.logging.log4j.Logger;
final class NettyPeerConnection implements PeerConnection { final class NettyPeerConnection implements PeerConnection {
private static final Logger LOGGER = LogManager.getLogger(NettyPeerConnection.class); private static final Logger LOG = LogManager.getLogger();
private final ChannelHandlerContext ctx; private final ChannelHandlerContext ctx;
private final PeerInfo peerInfo; private final PeerInfo peerInfo;
@ -74,7 +74,7 @@ final class NettyPeerConnection implements PeerConnection {
} }
} }
LOGGER.debug("Writing {} to {} via protocol {}", message, peerInfo, capability); LOG.debug("Writing {} to {} via protocol {}", message, peerInfo, capability);
ctx.channel().writeAndFlush(new OutboundMessage(capability, message)); ctx.channel().writeAndFlush(new OutboundMessage(capability, message));
} }
@ -96,7 +96,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override @Override
public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) { public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) {
if (disconnectDispatched.compareAndSet(false, true)) { if (disconnectDispatched.compareAndSet(false, true)) {
LOGGER.info("Disconnected ({}) from {}", reason, peerInfo); LOG.info("Disconnected ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, peerInitiated); callbacks.invokeDisconnect(this, reason, peerInitiated);
disconnected.set(true); disconnected.set(true);
} }
@ -108,7 +108,7 @@ final class NettyPeerConnection implements PeerConnection {
@Override @Override
public void disconnect(final DisconnectReason reason) { public void disconnect(final DisconnectReason reason) {
if (disconnectDispatched.compareAndSet(false, true)) { if (disconnectDispatched.compareAndSet(false, true)) {
LOGGER.info("Disconnecting ({}) from {}", reason, peerInfo); LOG.info("Disconnecting ({}) from {}", reason, peerInfo);
callbacks.invokeDisconnect(this, reason, false); callbacks.invokeDisconnect(this, reason, false);
try { try {
send(null, DisconnectMessage.create(reason)); send(null, DisconnectMessage.create(reason));

@ -15,7 +15,7 @@ import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
final class WireKeepAlive extends ChannelDuplexHandler { final class WireKeepAlive extends ChannelDuplexHandler {
private static final Logger LOGGER = LogManager.getLogger(WireKeepAlive.class); private static final Logger LOG = LogManager.getLogger();
private final AtomicBoolean waitingForPong; private final AtomicBoolean waitingForPong;
@ -37,12 +37,12 @@ final class WireKeepAlive extends ChannelDuplexHandler {
if (waitingForPong.get()) { if (waitingForPong.get()) {
// We are still waiting for a response from our last pong, disconnect with timeout error // We are still waiting for a response from our last pong, disconnect with timeout error
LOGGER.info("Wire PONG never received, disconnecting from peer."); LOG.info("Wire PONG never received, disconnecting from peer.");
connection.disconnect(DisconnectReason.TIMEOUT); connection.disconnect(DisconnectReason.TIMEOUT);
return; return;
} }
LOGGER.debug("Idle connection detected, sending Wire PING to peer."); LOG.debug("Idle connection detected, sending Wire PING to peer.");
connection.send(null, PingMessage.get()); connection.send(null, PingMessage.get());
waitingForPong.set(true); waitingForPong.set(true);
} }

@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger;
* format</a> * format</a>
*/ */
public class Capability { public class Capability {
private static final Logger LOGGER = LogManager.getLogger(Capability.class); private static final Logger LOG = LogManager.getLogger();
private final String name; private final String name;
private final int version; private final int version;
@ -28,7 +28,7 @@ public class Capability {
// Quorum reports IBFT as "istanbul", breaking wire protocol conventions. // Quorum reports IBFT as "istanbul", breaking wire protocol conventions.
// As such, this check cannot prevent connection. // As such, this check cannot prevent connection.
if (name.length() != 3) { if (name.length() != 3) {
LOGGER.warn("Capability name '{}' is too long", name); LOG.warn("Capability name '{}' is too long", name);
} }
this.name = name; this.name = name;
this.version = version; this.version = version;

@ -22,7 +22,7 @@ public class Runner implements AutoCloseable {
static final String KEY_PATH = "key"; static final String KEY_PATH = "key";
private static final Logger LOGGER = LogManager.getLogger(Runner.class); private static final Logger LOG = LogManager.getLogger();
private final Vertx vertx; private final Vertx vertx;
@ -53,19 +53,19 @@ public class Runner implements AutoCloseable {
public void execute() { public void execute() {
try { try {
LOGGER.info("Starting Ethereum main loop ... "); LOG.info("Starting Ethereum main loop ... ");
networkRunner.start(); networkRunner.start();
pantheonController.getSynchronizer().start(); pantheonController.getSynchronizer().start();
jsonRpc.ifPresent(service -> service.start().join()); jsonRpc.ifPresent(service -> service.start().join());
websocketRpc.ifPresent(service -> service.start().join()); websocketRpc.ifPresent(service -> service.start().join());
LOGGER.info("Ethereum main loop is up."); LOG.info("Ethereum main loop is up.");
writePantheonPortsToFile(); writePantheonPortsToFile();
networkRunner.awaitStop(); networkRunner.awaitStop();
} catch (final InterruptedException e) { } catch (final InterruptedException e) {
LOGGER.debug("Interrupted, exiting", e); LOG.debug("Interrupted, exiting", e);
Thread.currentThread().interrupt(); Thread.currentThread().interrupt();
} catch (final Exception ex) { } catch (final Exception ex) {
LOGGER.error("Exception in main loop:", ex); LOG.error("Exception in main loop:", ex);
throw new IllegalStateException(ex); throw new IllegalStateException(ex);
} }
} }
@ -111,7 +111,7 @@ public class Runner implements AutoCloseable {
fileOutputStream, fileOutputStream,
"This file contains the ports used by the running instance of Pantheon. This file will be deleted after the node is shutdown."); "This file contains the ports used by the running instance of Pantheon. This file will be deleted after the node is shutdown.");
} catch (final Exception e) { } catch (final Exception e) {
LOGGER.warn("Error writing ports file", e); LOG.warn("Error writing ports file", e);
} }
} }

@ -27,7 +27,7 @@ import picocli.CommandLine.ParentCommand;
) )
class ExportPublicKeySubCommand implements Runnable { class ExportPublicKeySubCommand implements Runnable {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
@Parameters(arity = "1..1", paramLabel = "PATH", description = "File to write public key to") @Parameters(arity = "1..1", paramLabel = "PATH", description = "File to write public key to")
private final File publicKeyExportFile = null; private final File publicKeyExportFile = null;
@ -49,7 +49,7 @@ class ExportPublicKeySubCommand implements Runnable {
try (BufferedWriter fileWriter = Files.newBufferedWriter(path, UTF_8)) { try (BufferedWriter fileWriter = Files.newBufferedWriter(path, UTF_8)) {
fileWriter.write(keyPair.getPublicKey().toString()); fileWriter.write(keyPair.getPublicKey().toString());
} catch (final IOException e) { } catch (final IOException e) {
LOGGER.error("An error occurred while trying to write the public key", e); LOG.error("An error occurred while trying to write the public key", e);
} }
} }
} }

@ -23,7 +23,7 @@ import picocli.CommandLine.ParentCommand;
) )
class ImportBlockchainSubCommand implements Runnable { class ImportBlockchainSubCommand implements Runnable {
private static final Logger LOGGER = LogManager.getLogger(ImportBlockchainSubCommand.class); private static final Logger LOG = LogManager.getLogger();
@ParentCommand @ParentCommand
private PantheonCommand parentCommand; // Picocli injects reference to parent command private PantheonCommand parentCommand; // Picocli injects reference to parent command
@ -76,7 +76,7 @@ class ImportBlockchainSubCommand implements Runnable {
@Override @Override
public void run() { public void run() {
LOGGER.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); LOG.info("Runs import sub command with blocksImportPath : {}", blocksImportPath);
checkNotNull(parentCommand); checkNotNull(parentCommand);

@ -22,7 +22,7 @@ import picocli.CommandLine.ParentCommand;
mixinStandardHelpOptions = true mixinStandardHelpOptions = true
) )
class ImportSubCommand implements Runnable { class ImportSubCommand implements Runnable {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
@ParentCommand @ParentCommand
private PantheonCommand parentCommand; // Picocli injects reference to parent command private PantheonCommand parentCommand; // Picocli injects reference to parent command
@ -38,7 +38,7 @@ class ImportSubCommand implements Runnable {
@Override @Override
public void run() { public void run() {
LOGGER.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); LOG.info("Runs import sub command with blocksImportPath : {}", blocksImportPath);
checkNotNull(parentCommand); checkNotNull(parentCommand);
checkNotNull(blockImporter); checkNotNull(blockImporter);

@ -61,7 +61,7 @@ import picocli.CommandLine.ParameterException;
footer = "Pantheon is licensed under the Apache License 2.0" footer = "Pantheon is licensed under the Apache License 2.0"
) )
public class PantheonCommand implements Runnable { public class PantheonCommand implements Runnable {
private static final Logger LOGGER = LogManager.getLogger(); private static final Logger LOG = LogManager.getLogger();
private static final int DEFAULT_MAX_PEERS = 25; private static final int DEFAULT_MAX_PEERS = 25;

@ -1,29 +1,27 @@
package net.consensys.pantheon.controller; package net.consensys.pantheon.controller;
import static org.apache.logging.log4j.LogManager.getLogger;
import net.consensys.pantheon.crypto.SECP256K1; import net.consensys.pantheon.crypto.SECP256K1;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Path; import java.nio.file.Path;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
public class KeyPairUtil { public class KeyPairUtil {
private static final Logger LOGGER = getLogger(); private static final Logger LOG = LogManager.getLogger();
public static SECP256K1.KeyPair loadKeyPair(final Path home) throws IOException { public static SECP256K1.KeyPair loadKeyPair(final Path home) throws IOException {
final File keyFile = home.resolve("key").toFile(); final File keyFile = home.resolve("key").toFile();
final SECP256K1.KeyPair key; final SECP256K1.KeyPair key;
if (keyFile.exists()) { if (keyFile.exists()) {
key = SECP256K1.KeyPair.load(keyFile); key = SECP256K1.KeyPair.load(keyFile);
LOGGER.info( LOG.info("Loaded key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath());
"Loaded key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath());
} else { } else {
key = SECP256K1.KeyPair.generate(); key = SECP256K1.KeyPair.generate();
key.getPrivateKey().store(keyFile); key.getPrivateKey().store(keyFile);
LOGGER.info( LOG.info(
"Generated new key key {} and stored it to {}", "Generated new key key {} and stored it to {}",
key.getPublicKey().toString(), key.getPublicKey().toString(),
keyFile.getAbsolutePath()); keyFile.getAbsolutePath());

@ -37,7 +37,7 @@ import picocli.CommandLine.RunLast;
@RunWith(MockitoJUnitRunner.class) @RunWith(MockitoJUnitRunner.class)
public abstract class CommandTestAbstract { public abstract class CommandTestAbstract {
private final Logger LOGGER = LogManager.getLogger(); private final Logger LOG = LogManager.getLogger();
final ByteArrayOutputStream commandOutput = new ByteArrayOutputStream(); final ByteArrayOutputStream commandOutput = new ByteArrayOutputStream();
private final PrintStream outPrintStream = new PrintStream(commandOutput); private final PrintStream outPrintStream = new PrintStream(commandOutput);
@ -74,8 +74,8 @@ public abstract class CommandTestAbstract {
// Display outputs for debug purpose // Display outputs for debug purpose
@After @After
public void displayOutput() { public void displayOutput() {
LOGGER.info("Standard output {}", commandOutput.toString()); LOG.info("Standard output {}", commandOutput.toString());
LOGGER.info("Standard error {}", commandErrorOutput.toString()); LOG.info("Standard error {}", commandErrorOutput.toString());
} }
void parseCommand(final String... args) { void parseCommand(final String... args) {

@ -25,7 +25,7 @@ import org.rocksdb.WriteOptions;
public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable {
private static final Logger logger = LogManager.getLogger(RocksDbKeyValueStorage.class); private static final Logger LOG = LogManager.getLogger();
private final Options options; private final Options options;
private final TransactionDBOptions txOptions; private final TransactionDBOptions txOptions;
@ -106,7 +106,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable {
private void throwIfClosed() { private void throwIfClosed() {
if (closed.get()) { if (closed.get()) {
logger.error("Attempting to use a closed RocksDbKeyValueStorage"); LOG.error("Attempting to use a closed RocksDbKeyValueStorage");
throw new IllegalStateException("Storage has been closed"); throw new IllegalStateException("Storage has been closed");
} }
} }
@ -140,7 +140,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable {
try { try {
rocksIt.status(); rocksIt.status();
} catch (final RocksDBException e) { } catch (final RocksDBException e) {
logger.error("RocksDbEntryIterator encountered a problem while iterating.", e); LOG.error("RocksDbEntryIterator encountered a problem while iterating.", e);
} }
if (!hasNext()) { if (!hasNext()) {
throw new NoSuchElementException(); throw new NoSuchElementException();

Loading…
Cancel
Save