diff --git a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/CliqueVoteTallyUpdater.java b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/CliqueVoteTallyUpdater.java index 7e8af54d71..c088a51e5a 100644 --- a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/CliqueVoteTallyUpdater.java +++ b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/CliqueVoteTallyUpdater.java @@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger; 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])); private final EpochManager epochManager; @@ -28,7 +28,7 @@ public class CliqueVoteTallyUpdater { public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) { final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber(); 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 List
initialValidators = CliqueExtraData.decode(epochBlock.getExtraData()).getValidators(); diff --git a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java index f71e6c8ddd..98842cd795 100644 --- a/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java +++ b/consensus/clique/src/main/java/net/consensys/pantheon/consensus/clique/headervalidationrules/CliqueExtraDataValidationRule.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger; public class CliqueExtraDataValidationRule implements AttachedBlockHeaderValidationRule { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); private final EpochManager epochManager; @@ -53,10 +53,10 @@ public class CliqueExtraDataValidationRule return extraDataIsValid(storedValidators, header); } 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; } catch (final IllegalArgumentException ex) { - LOGGER.trace("Failed to verify extra data", ex); + LOG.trace("Failed to verify extra data", ex); return false; } } @@ -68,13 +68,13 @@ public class CliqueExtraDataValidationRule final Address proposer = CliqueBlockHashing.recoverProposerAddress(header, cliqueExtraData); 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; } if (epochManager.isEpochBlock(header.getNumber())) { if (!Iterables.elementsEqual(cliqueExtraData.getValidators(), expectedValidators)) { - LOGGER.trace( + LOG.trace( "Incorrect validators. Expected {} but got {}.", expectedValidators, cliqueExtraData.getValidators()); @@ -82,7 +82,7 @@ public class CliqueExtraDataValidationRule } } else { 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; } } diff --git a/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/headervalidationrules/VoteValidationRule.java b/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/headervalidationrules/VoteValidationRule.java index f91c519f32..e9423db517 100644 --- a/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/headervalidationrules/VoteValidationRule.java +++ b/consensus/common/src/main/java/net/consensys/pantheon/consensus/common/headervalidationrules/VoteValidationRule.java @@ -9,7 +9,7 @@ import org.apache.logging.log4j.Logger; 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. @@ -22,7 +22,7 @@ public class VoteValidationRule implements DetachedBlockHeaderValidationRule { public boolean validate(final BlockHeader header, final BlockHeader parent) { final long nonce = header.getNonce(); 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 true; diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftEventQueue.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftEventQueue.java index 900ae79480..5a6b633181 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftEventQueue.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftEventQueue.java @@ -13,7 +13,7 @@ public class IbftEventQueue { private final BlockingQueue queue = new LinkedBlockingQueue<>(); 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 @@ -22,7 +22,7 @@ public class IbftEventQueue { */ public void add(final IbftEvent event) { 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 { queue.add(event); } diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftProcessor.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftProcessor.java index 1619872f6c..c400ce9111 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftProcessor.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/IbftProcessor.java @@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger; /** Execution context for draining queued ibft events and applying them to a maintained state */ 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 ScheduledExecutorService roundTimerExecutor; @@ -73,7 +73,7 @@ public class IbftProcessor implements Runnable { try { stateMachine.processEvent(ibftEvent, roundTimer); } catch (final Exception e) { - LOGGER.error( + LOG.error( "State machine threw exception while processing event {" + ibftEvent + "}", e); } }); diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/VoteTallyUpdater.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/VoteTallyUpdater.java index 036f49f823..da0919a281 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/VoteTallyUpdater.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/VoteTallyUpdater.java @@ -1,7 +1,5 @@ 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.VoteTally; import net.consensys.pantheon.consensus.common.VoteType; @@ -12,6 +10,7 @@ import net.consensys.pantheon.util.bytes.BytesValue; import java.util.List; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; /** @@ -20,7 +19,7 @@ import org.apache.logging.log4j.Logger; */ 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 final EpochManager epochManager; @@ -38,7 +37,7 @@ public class VoteTallyUpdater { public VoteTally buildVoteTallyFromBlockchain(final Blockchain blockchain) { final long chainHeadBlockNumber = blockchain.getChainHeadBlockNumber(); 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 List
initialValidators = IbftExtraData.decode(epochBlock.getExtraData()).getValidators(); diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java index 35a13235f1..45ea61d7fd 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/IbftBlockCreator.java @@ -32,7 +32,7 @@ import org.apache.logging.log4j.Logger; */ public class IbftBlockCreator extends AbstractBlockCreator { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); private final KeyPair nodeKeys; private final ProtocolSchedule protocolSchedule; diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/ProposerSelector.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/ProposerSelector.java index e3b757f91c..145203e69b 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/ProposerSelector.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/blockcreation/ProposerSelector.java @@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger; */ public class ProposerSelector { - private static final Logger LOGGER = LogManager.getLogger(ProposerSelector.class); + private static final Logger LOG = LogManager.getLogger(); private final Blockchain blockchain; @@ -143,7 +143,7 @@ public class ProposerSelector { final IbftExtraData extraData = IbftExtraData.decode(blockHeader.getExtraData()); return IbftBlockHashing.recoverProposerAddress(blockHeader, extraData); } 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"); } } diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/headervalidationrules/IbftExtraDataValidationRule.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/headervalidationrules/IbftExtraDataValidationRule.java index f41fac2f16..901b6543d7 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/headervalidationrules/IbftExtraDataValidationRule.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/headervalidationrules/IbftExtraDataValidationRule.java @@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger; */ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidationRule { - private static final Logger LOGGER = LogManager.getLogger(IbftExtraDataValidationRule.class); + private static final Logger LOG = LogManager.getLogger(); private final boolean validateCommitSeals; @@ -66,7 +66,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio final Collection
storedValidators = validatorProvider.getCurrentValidators(); 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; } @@ -79,7 +79,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio } if (!Iterables.elementsEqual(ibftExtraData.getValidators(), storedValidators)) { - LOGGER.trace( + LOG.trace( "Incorrect validators. Expected {} but got {}.", storedValidators, ibftExtraData.getValidators()); @@ -87,10 +87,10 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio } } 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; } catch (final IllegalArgumentException ex) { - LOGGER.trace("Failed to verify extra data", ex); + LOG.trace("Failed to verify extra data", ex); return false; } @@ -102,7 +102,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio final int minimumSealsRequired = calculateRequiredValidatorQuorum(storedValidators.size()); if (committers.size() < minimumSealsRequired) { - LOGGER.trace( + LOG.trace( "Insufficient committers to seal block. (Required {}, received {})", minimumSealsRequired, committers.size()); @@ -110,7 +110,7 @@ public class IbftExtraDataValidationRule implements AttachedBlockHeaderValidatio } 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; } diff --git a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/protocol/IbftProtocolManager.java b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/protocol/IbftProtocolManager.java index c2ff9703f1..9ec3a46c9a 100644 --- a/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/protocol/IbftProtocolManager.java +++ b/consensus/ibft/src/main/java/net/consensys/pantheon/consensus/ibft/protocol/IbftProtocolManager.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger; public class IbftProtocolManager implements ProtocolManager { private final IbftEventQueue ibftEventQueue; - private final Logger LOGGER = LogManager.getLogger(IbftProtocolManager.class); + private final Logger LOG = LogManager.getLogger(); /** * Constructor for the ibft protocol manager diff --git a/crypto/src/main/java/net/consensys/pantheon/crypto/PersonalisationString.java b/crypto/src/main/java/net/consensys/pantheon/crypto/PersonalisationString.java index a7906c67ce..daf6107c10 100644 --- a/crypto/src/main/java/net/consensys/pantheon/crypto/PersonalisationString.java +++ b/crypto/src/main/java/net/consensys/pantheon/crypto/PersonalisationString.java @@ -14,7 +14,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; 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(); public static byte[] getPersonalizationString() { @@ -42,7 +42,7 @@ public class PersonalisationString { } } } catch (SocketException | BufferOverflowException e) { - LOGGER.warn( + LOG.warn( "Failed to obtain network hardware address for use in random number personalisation string, " + "continuing without this piece of random information", e); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java index 29893629ae..c748de91a3 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/AbstractBlockCreator.java @@ -39,7 +39,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { 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; @@ -117,7 +117,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { protocolSchedule.getByBlockNumber(processableBlockHeader.getNumber()).getBlockReward(); 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."); } @@ -147,12 +147,11 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { return new Block(blockHeader, new BlockBody(transactionResults.getTransactions(), ommers)); } catch (final CancellationException ex) { - LOGGER.trace("Attempt to create block was interrupted."); + LOG.trace("Attempt to create block was interrupted."); throw ex; } catch (final Exception ex) { // TODO(tmm): How are we going to know this has exploded, and thus restart it? - LOGGER.trace( - "Block creation failed unexpectedly. Will restart on next block added to chain."); + LOG.trace("Block creation failed unexpectedly. Will restart on next block added to chain."); throw ex; } } @@ -245,7 +244,7 @@ public abstract class AbstractBlockCreator implements AsyncBlockCreator { beneficiary.incrementBalance(coinbaseReward); for (final BlockHeader ommerHeader : ommers) { if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) { - LOGGER.trace( + LOG.trace( "Block processing error: ommer block number {} more than {} generations current block number {}", ommerHeader.getNumber(), MAX_GENERATION, diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/BlockTransactionSelector.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/BlockTransactionSelector.java index 0529ceca8f..df22dd0bd4 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/BlockTransactionSelector.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/blockcreation/BlockTransactionSelector.java @@ -10,7 +10,6 @@ import net.consensys.pantheon.ethereum.core.Transaction; import net.consensys.pantheon.ethereum.core.TransactionReceipt; import net.consensys.pantheon.ethereum.core.Wei; 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.TransactionProcessor; @@ -44,7 +43,7 @@ import org.apache.logging.log4j.Logger; */ public class BlockTransactionSelector { - private static final Logger LOGGER = LogManager.getLogger(MainnetBlockProcessor.class); + private static final Logger LOG = LogManager.getLogger(); private final Wei minTransactionGasPrice; private static final double MIN_BLOCK_OCCUPANCY_RATIO = 0.8; diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/BlockHeaderValidator.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/BlockHeaderValidator.java index 70326b3e37..784731ea9c 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/BlockHeaderValidator.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/BlockHeaderValidator.java @@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger; public class BlockHeaderValidator { - private static final Logger LOGGER = LogManager.getLogger(BlockHeaderValidator.class); + private static final Logger LOG = LogManager.getLogger(); private final List> rules; @@ -69,7 +69,7 @@ public class BlockHeaderValidator { final Optional parent = context.getBlockchain().getBlockHeader(header.getParentHash()); if (!parent.isPresent()) { - LOGGER.trace("Invalid block header: cannot determine parent header"); + LOG.trace("Invalid block header: cannot determine parent header"); } return parent; } diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/EthHashCacheFactory.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/EthHashCacheFactory.java index 3d7bbe3d8e..246acce791 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/EthHashCacheFactory.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/EthHashCacheFactory.java @@ -10,7 +10,7 @@ import org.apache.logging.log4j.Logger; public class EthHashCacheFactory { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); public static class EthHashDescriptor { private final long datasetSize; diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockBodyValidator.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockBodyValidator.java index 7ab4ab9911..d1760463f1 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockBodyValidator.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockBodyValidator.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger; public class MainnetBlockBodyValidator implements BlockBodyValidator { - private static final Logger LOGGER = LogManager.getLogger(MainnetBlockBodyValidator.class); + private static final Logger LOG = LogManager.getLogger(); private static final int MAX_OMMERS = 2; @@ -84,7 +84,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateTransactionsRoot(final Bytes32 expected, final Bytes32 actual) { if (!expected.equals(actual)) { - LOGGER.warn( + LOG.warn( "Invalid block: transaction root mismatch (expected={}, actual={})", expected, actual); return false; } @@ -95,7 +95,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateLogsBloom( final LogsBloomFilter expected, final LogsBloomFilter actual) { if (!expected.equals(actual)) { - LOGGER.warn( + LOG.warn( "Invalid block: logs bloom filter mismatch (expected={}, actual={})", expected, actual); return false; } @@ -105,7 +105,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateGasUsed(final long expected, final long 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; } @@ -114,8 +114,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateReceiptsRoot(final Bytes32 expected, final Bytes32 actual) { if (!expected.equals(actual)) { - LOGGER.warn( - "Invalid block: receipts root mismatch (expected={}, actual={})", expected, actual); + LOG.warn("Invalid block: receipts root mismatch (expected={}, actual={})", expected, actual); return false; } @@ -124,7 +123,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateStateRoot(final Bytes32 expected, final Bytes32 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; } @@ -149,7 +148,7 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private static boolean validateOmmersHash(final Bytes32 expected, final Bytes32 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; } @@ -159,19 +158,18 @@ public class MainnetBlockBodyValidator implements BlockBodyValidator { private boolean validateOmmers( final ProtocolContext context, final BlockHeader header, final List ommers) { if (ommers.size() > MAX_OMMERS) { - LOGGER.warn( - "Invalid block: ommer count {} exceeds ommer limit {}", ommers.size(), MAX_OMMERS); + LOG.warn("Invalid block: ommer count {} exceeds ommer limit {}", ommers.size(), MAX_OMMERS); return false; } if (!areOmmersUnique(ommers)) { - LOGGER.warn("Invalid block: ommers are not unique"); + LOG.warn("Invalid block: ommers are not unique"); return false; } for (final BlockHeader ommer : ommers) { if (!isOmmerValid(context, header, ommer)) { - LOGGER.warn("Invalid block: ommer is invalid"); + LOG.warn("Invalid block: ommer is invalid"); return false; } } diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockProcessor.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockProcessor.java index 8de8e61708..897f4d17d8 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockProcessor.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetBlockProcessor.java @@ -28,7 +28,7 @@ public class MainnetBlockProcessor implements BlockProcessor { 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; @@ -99,7 +99,7 @@ public class MainnetBlockProcessor implements BlockProcessor { final long remainingGasBudget = blockHeader.getGasLimit() - gasUsed; if (Long.compareUnsigned(transaction.getGasLimit(), remainingGasBudget) > 0) { - LOGGER.warn( + LOG.warn( "Transaction processing error: transaction gas limit {} exceeds available block budget remaining {}", transaction.getGasLimit(), remainingGasBudget); @@ -149,7 +149,7 @@ public class MainnetBlockProcessor implements BlockProcessor { coinbase.incrementBalance(coinbaseReward); for (final BlockHeader ommerHeader : ommers) { if (ommerHeader.getNumber() - header.getNumber() > MAX_GENERATION) { - LOGGER.warn( + LOG.warn( "Block processing error: ommer block number {} more than {} generations current block number {}", ommerHeader.getNumber(), MAX_GENERATION, diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetContractCreationProcessor.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetContractCreationProcessor.java index 57db9b7a12..645e465a3b 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetContractCreationProcessor.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetContractCreationProcessor.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger; /** A contract creation message processor. */ public class MainnetContractCreationProcessor extends AbstractMessageProcessor { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); private final boolean requireCodeDepositToSucceed; @@ -69,8 +69,8 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor { @Override public void start(final MessageFrame frame) { - if (LOGGER.isTraceEnabled()) { - LOGGER.trace("Executing contract-creation"); + if (LOG.isTraceEnabled()) { + LOG.trace("Executing contract-creation"); } 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. final MutableAccount contract = frame.getWorldState().getOrCreate(frame.getContractAddress()); if (accountExists(contract)) { - LOGGER.trace( + LOG.trace( "Contract creation error: account as already been created for address {}", frame.getContractAddress()); frame.setState(MessageFrame.State.EXCEPTIONAL_HALT); @@ -100,21 +100,21 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor { final Gas depositFee = gasCalculator.codeDepositGasCost(contractCode.size()); if (frame.getRemainingGas().compareTo(depositFee) < 0) { - LOGGER.trace( + LOG.trace( "Not enough gas to pay the code deposit fee for {}: " + "remaining gas = {} < {} = deposit fee", frame.getContractAddress(), frame.getRemainingGas(), depositFee); 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); } else { frame.setState(MessageFrame.State.COMPLETED_SUCCESS); } } else { if (contractCode.size() > codeSizeLimit) { - LOGGER.trace( + LOG.trace( "Contract creation error: code size {} exceeds code size limit {}", contractCode.size(), codeSizeLimit); @@ -126,7 +126,7 @@ public class MainnetContractCreationProcessor extends AbstractMessageProcessor { final MutableAccount contract = frame.getWorldState().getOrCreate(frame.getContractAddress()); contract.setCode(contractCode); - LOGGER.trace( + LOG.trace( "Successful creation of contract {} with code of size {} (Gas remaining: {})", frame.getContractAddress(), contractCode.size(), diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetMessageCallProcessor.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetMessageCallProcessor.java index 1442cb9c96..626e6d0108 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetMessageCallProcessor.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetMessageCallProcessor.java @@ -15,7 +15,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class MainnetMessageCallProcessor extends AbstractMessageProcessor { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); private final PrecompileContractRegistry precompiles; @@ -34,7 +34,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor { @Override public void start(final MessageFrame frame) { - LOGGER.trace("Executing message-call"); + LOG.trace("Executing message-call"); transferValue(frame); @@ -49,7 +49,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor { @Override protected void codeSuccess(final MessageFrame frame) { - LOGGER.trace( + LOG.trace( "Successful message call of {} to {} (Gas remaining: {})", frame.getSenderAddress(), frame.getRecipientAddress(), @@ -71,12 +71,12 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor { frame.getWorldState().getOrCreate(frame.getRecipientAddress()); 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 { final Wei prevSenderBalance = senderAccount.decrementBalance(frame.getValue()); final Wei prevRecipientBalance = recipientAccount.incrementBalance(frame.getValue()); - LOGGER.trace( + LOG.trace( "Transferred value {} for message call from {} ({} -> {}) to {} ({} -> {})", frame.getValue(), frame.getSenderAddress(), @@ -96,7 +96,7 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor { private void executePrecompile(final PrecompiledContract contract, final MessageFrame frame) { final Gas gasRequirement = contract.gasRequirement(frame.getInputData()); if (frame.getRemainingGas().compareTo(gasRequirement) < 0) { - LOGGER.trace( + LOG.trace( "Not enough gas available for pre-compiled contract code {}: requiring " + "{} but only {} gas available", contract, @@ -108,14 +108,13 @@ public class MainnetMessageCallProcessor extends AbstractMessageProcessor { final BytesValue output = contract.compute(frame.getInputData()); if (output != null) { frame.setOutputData(output); - LOGGER.trace( + LOG.trace( "Precompiled contract {} successfully executed (gas consumed: {})", contract, gasRequirement); frame.setState(MessageFrame.State.COMPLETED_SUCCESS); } else { - LOGGER.trace( - "Precompiled contract {} failed (gas consumed: {})", contract, gasRequirement); + LOG.trace("Precompiled contract {} failed (gas consumed: {})", contract, gasRequirement); frame.setState(MessageFrame.State.EXCEPTIONAL_HALT); } } diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetTransactionProcessor.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetTransactionProcessor.java index d161b4116e..7d8a2ab4f2 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetTransactionProcessor.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/MainnetTransactionProcessor.java @@ -26,7 +26,7 @@ import org.apache.logging.log4j.Logger; 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; @@ -130,7 +130,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor { final Transaction transaction, final Address miningBenficiary, final OperationTracer operationTracer) { - LOGGER.trace("Starting execution of {}", transaction); + LOG.trace("Starting execution of {}", transaction); ValidationResult validationResult = transactionValidator.validate(transaction); @@ -138,7 +138,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor { // compare against a sender account (because the transaction may not // be signed correctly to extract the sender). if (!validationResult.isValid()) { - LOGGER.warn("Invalid transaction: {}", validationResult.getErrorMessage()); + LOG.warn("Invalid transaction: {}", validationResult.getErrorMessage()); return Result.invalid(validationResult); } @@ -147,17 +147,17 @@ public class MainnetTransactionProcessor implements TransactionProcessor { validationResult = transactionValidator.validateForSender(transaction, sender, OptionalLong.empty()); if (!validationResult.isValid()) { - LOGGER.warn("Invalid transaction: {}", validationResult.getErrorMessage()); + LOG.warn("Invalid transaction: {}", validationResult.getErrorMessage()); return Result.invalid(validationResult); } final long previousNonce = sender.incrementNonce(); - LOGGER.trace( + LOG.trace( "Incremented sender {} nonce ({} -> {})", senderAddress, previousNonce, sender.getNonce()); final Wei upfrontGasCost = transaction.getUpfrontGasCost(); final Wei previousBalance = sender.decrementBalance(upfrontGasCost); - LOGGER.trace( + LOG.trace( "Deducted sender {} upfront gas cost {} ({} -> {})", senderAddress, upfrontGasCost, @@ -166,7 +166,7 @@ public class MainnetTransactionProcessor implements TransactionProcessor { final Gas intrinsicGas = gasCalculator.transactionIntrinsicGasCost(transaction); final Gas gasAvailable = Gas.of(transaction.getGasLimit()).minus(intrinsicGas); - LOGGER.trace( + LOG.trace( "Gas available for execution {} = {} - {} (limit - intrinsic)", gasAvailable, transaction.getGasLimit(), @@ -236,8 +236,8 @@ public class MainnetTransactionProcessor implements TransactionProcessor { worldUpdater.commit(); } - if (LOGGER.isTraceEnabled()) { - LOGGER.trace( + if (LOG.isTraceEnabled()) { + LOG.trace( "Gas used by transaction: {}, by message call/contract creation: {}", () -> Gas.of(transaction.getGasLimit()).minus(initialFrame.getRemainingGas()), () -> gasAvailable.minus(initialFrame.getRemainingGas())); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/AncestryValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/AncestryValidationRule.java index 443a055a36..3b77347932 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/AncestryValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/AncestryValidationRule.java @@ -11,12 +11,12 @@ import org.apache.logging.log4j.Logger; * header. */ public class AncestryValidationRule implements DetachedBlockHeaderValidationRule { - private final Logger LOGGER = LogManager.getLogger(AncestryValidationRule.class); + private final Logger LOG = LogManager.getLogger(AncestryValidationRule.class); @Override public boolean validate(final BlockHeader header, final BlockHeader parent) { if (!header.getParentHash().equals(parent.getHash())) { - LOGGER.trace( + LOG.trace( "Invalid parent block header. Parent hash {} does not match " + "supplied parent header {}.", header.getParentHash(), @@ -25,7 +25,7 @@ public class AncestryValidationRule implements DetachedBlockHeaderValidationRule } if (header.getNumber() != (parent.getNumber() + 1)) { - LOGGER.trace( + LOG.trace( "Invalid block header: number {} is not one more than parent number {}", header.getNumber(), parent.getNumber()); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java index e8088195da..d027bf7e5b 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/CalculatedDifficultyValidationRule.java @@ -11,7 +11,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class CalculatedDifficultyValidationRule implements AttachedBlockHeaderValidationRule { - private final Logger LOGGER = LogManager.getLogger(CalculatedDifficultyValidationRule.class); + private final Logger LOG = LogManager.getLogger(CalculatedDifficultyValidationRule.class); private final DifficultyCalculator difficultyCalculator; public CalculatedDifficultyValidationRule(final DifficultyCalculator difficultyCalculator) { @@ -27,7 +27,7 @@ public class CalculatedDifficultyValidationRule implements AttachedBlockHeade difficultyCalculator.nextDifficulty(header.getTimestamp(), parent, context); if (actualDifficulty.compareTo(expectedDifficulty) != 0) { - LOGGER.trace( + LOG.trace( "Invalid block header: difficulty {} does not equal expected difficulty {}", actualDifficulty, expectedDifficulty); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ExtraDataMaxLengthValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ExtraDataMaxLengthValidationRule.java index 6d4c84b410..9a005517cf 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ExtraDataMaxLengthValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ExtraDataMaxLengthValidationRule.java @@ -13,7 +13,7 @@ import org.apache.logging.log4j.Logger; */ 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; public ExtraDataMaxLengthValidationRule(final long maxExtraDataBytes) { @@ -27,7 +27,7 @@ public class ExtraDataMaxLengthValidationRule implements DetachedBlockHeaderVali private boolean validateExtraData(final BytesValue extraData) { if (extraData.size() > maxExtraDataBytes) { - LOGGER.trace( + LOG.trace( "Invalid block header: extra data field length {} is greater {}", extraData.size(), maxExtraDataBytes); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasLimitRangeAndDeltaValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasLimitRangeAndDeltaValidationRule.java index 2f37aab98d..8c01fdc429 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasLimitRangeAndDeltaValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasLimitRangeAndDeltaValidationRule.java @@ -15,8 +15,7 @@ import org.apache.logging.log4j.Logger; */ public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderValidationRule { - private static final Logger LOGGER = - LogManager.getLogger(GasLimitRangeAndDeltaValidationRule.class); + private static final Logger LOG = LogManager.getLogger(GasLimitRangeAndDeltaValidationRule.class); private static final int GASLIMIT_BOUND_DIVISOR = 1024; private final long minGasLimit; private final long maxGasLimit; @@ -37,7 +36,7 @@ public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderV final long gasLimit = header.getGasLimit(); if ((gasLimit < minGasLimit) || (gasLimit > maxGasLimit)) { - LOGGER.trace( + LOG.trace( "Header gasLimit = {}, outside range {} --> {}", gasLimit, minGasLimit, maxGasLimit); return false; } @@ -46,7 +45,7 @@ public class GasLimitRangeAndDeltaValidationRule implements DetachedBlockHeaderV final long difference = Math.abs(parentGasLimit - gasLimit); final long bounds = Long.divideUnsigned(parentGasLimit, GASLIMIT_BOUND_DIVISOR); if (Long.compareUnsigned(difference, bounds) >= 0) { - LOGGER.trace( + LOG.trace( "Invalid block header: gas limit delta {} is out of bounds of {}", gasLimit, bounds); return false; } diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasUsageValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasUsageValidationRule.java index 30de661b20..2edbbae2a4 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasUsageValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/GasUsageValidationRule.java @@ -12,12 +12,12 @@ import org.apache.logging.log4j.Logger; */ public class GasUsageValidationRule implements DetachedBlockHeaderValidationRule { - private final Logger LOGGER = LogManager.getLogger(GasUsageValidationRule.class); + private final Logger LOG = LogManager.getLogger(GasUsageValidationRule.class); @Override public boolean validate(final BlockHeader header, final BlockHeader parent) { if (header.getGasUsed() > header.getGasLimit()) { - LOGGER.trace( + LOG.trace( "Invalid block header: gas used {} exceeds gas limit {}", header.getGasUsed(), header.getGasLimit()); diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java index ea8756d571..a7ee575b4d 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/ProofOfWorkValidationRule.java @@ -21,7 +21,7 @@ import org.apache.logging.log4j.Logger; 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; @@ -60,7 +60,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid HASHER.hash(hashBuffer, header.getNonce(), header.getNumber(), keccak256.digest()); if (header.getDifficulty().isZero()) { - LOGGER.trace("Rejecting header because difficulty is 0"); + LOG.trace("Rejecting header because difficulty is 0"); return false; } final BigInteger difficulty = @@ -69,7 +69,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid final UInt256 result = UInt256.wrap(Bytes32.wrap(hashBuffer, 32)); if (result.compareTo(target) > 0) { - LOGGER.warn( + LOG.warn( "Invalid block header: the EthHash result {} was greater than the target {}.\n" + "Failing header:\n{}", result, @@ -81,7 +81,7 @@ public final class ProofOfWorkValidationRule implements DetachedBlockHeaderValid final Hash mixedHash = Hash.wrap(Bytes32.leftPad(BytesValue.wrap(hashBuffer).slice(0, Bytes32.SIZE))); if (!header.getMixHash().equals(mixedHash)) { - LOGGER.warn( + LOG.warn( "Invalid block header: header mixed hash {} does not equal calculated mixed hash {}.\n" + "Failing header:\n{}", header.getMixHash(), diff --git a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/TimestampValidationRule.java b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/TimestampValidationRule.java index 55fdfb725c..aaff1a0d6d 100644 --- a/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/TimestampValidationRule.java +++ b/ethereum/core/src/main/java/net/consensys/pantheon/ethereum/mainnet/headervalidationrules/TimestampValidationRule.java @@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger; */ 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 minimumSecondsSinceParent; @@ -42,7 +42,7 @@ public class TimestampValidationRule implements DetachedBlockHeaderValidationRul private boolean validateHeaderSufficientlyAheadOfParent( final long timestamp, final long parentTimestamp) { if ((timestamp - minimumSecondsSinceParent) < parentTimestamp) { - LOGGER.trace( + LOG.trace( "Invalid block header: timestamp {} is not sufficiently newer than parent timestamp {}", timestamp, parentTimestamp); @@ -57,7 +57,7 @@ public class TimestampValidationRule implements DetachedBlockHeaderValidationRul TimeUnit.SECONDS.convert(System.currentTimeMillis(), TimeUnit.MILLISECONDS) + acceptableClockDriftSeconds; if (Long.compareUnsigned(timestamp, timestampMargin) > 0) { - LOGGER.trace( + LOG.trace( "Invalid block header: timestamp {} is greater than the timestamp margin {}", timestamp, timestampMargin); diff --git a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java index 902d442f0f..f11fb02548 100644 --- a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java +++ b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java @@ -45,7 +45,7 @@ import org.apache.logging.log4j.Logger; 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 String APPLICATION_JSON = "application/json"; @@ -76,7 +76,7 @@ public class JsonRpcHttpService { } 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. httpServer = vertx.createHttpServer( @@ -105,7 +105,7 @@ public class JsonRpcHttpService { res -> { if (!res.failed()) { resultFuture.complete(null); - LOGGER.info( + LOG.info( "JsonRPC service started and listening on {}:{}", config.getHost(), httpServer.actualPort()); @@ -298,7 +298,7 @@ public class JsonRpcHttpService { return NO_RESPONSE; } - LOGGER.info("JSON-RPC request -> {}", request.getMethod()); + LOG.info("JSON-RPC request -> {}", request.getMethod()); // Find method handler final JsonRpcMethod method = jsonRpcMethods.get(request.getMethod()); if (method == null) { @@ -309,7 +309,7 @@ public class JsonRpcHttpService { try { return method.response(request); } catch (final InvalidJsonRpcParameters e) { - LOGGER.debug(e); + LOG.debug(e); return errorResponse(id, JsonRpcError.INVALID_PARAMS); } } diff --git a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java index 66a2bd4354..fb6e9a9ad4 100644 --- a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java +++ b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java @@ -22,7 +22,7 @@ import org.apache.logging.log4j.Logger; 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 JsonRpcParameter parameters; @@ -66,7 +66,7 @@ public class EthSendRawTransaction implements JsonRpcMethod { try { return Transaction.readFrom(RLP.input(BytesValue.fromHexString(hash))); } catch (IllegalArgumentException | RLPException e) { - LOGGER.debug(e); + LOG.debug(e); throw new InvalidJsonRpcRequestException("Invalid raw transaction hex", e); } } diff --git a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketRequestHandler.java b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketRequestHandler.java index 9b8038c121..7d6eb212aa 100644 --- a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketRequestHandler.java +++ b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketRequestHandler.java @@ -15,7 +15,7 @@ import org.apache.logging.log4j.Logger; 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 Map methods; @@ -32,23 +32,23 @@ public class WebSocketRequestHandler { try { request = buffer.toJsonObject().mapTo(WebSocketRpcRequest.class); } 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); return; } if (!methods.containsKey(request.getMethod())) { future.complete(JsonRpcError.METHOD_NOT_FOUND); - LOGGER.debug("Can't find method {}", request.getMethod()); + LOG.debug("Can't find method {}", request.getMethod()); return; } final JsonRpcMethod method = methods.get(request.getMethod()); try { - LOGGER.info("WS-RPC request -> {}", request.getMethod()); + LOG.info("WS-RPC request -> {}", request.getMethod()); request.setConnectionId(id); future.complete(method.response(request)); } catch (final Exception e) { - LOGGER.error(JsonRpcError.INTERNAL_ERROR.getMessage(), e); + LOG.error(JsonRpcError.INTERNAL_ERROR.getMessage(), e); future.complete(JsonRpcError.INTERNAL_ERROR); } }, diff --git a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java index fcf2c883b0..56ce0e56d2 100644 --- a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java +++ b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/WebSocketService.java @@ -17,7 +17,7 @@ import org.apache.logging.log4j.Logger; 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); @@ -37,7 +37,7 @@ public class WebSocketService { } public CompletableFuture start() { - LOGGER.info( + LOG.info( "Starting Websocket service on {}:{}", configuration.getHost(), configuration.getPort()); final CompletableFuture resultFuture = new CompletableFuture<>(); @@ -60,11 +60,11 @@ public class WebSocketService { final SocketAddress socketAddress = websocket.remoteAddress(); final String connectionId = websocket.textHandlerID(); - LOGGER.debug("Websocket Connected ({})", socketAddressAsString(socketAddress)); + LOG.debug("Websocket Connected ({})", socketAddressAsString(socketAddress)); websocket.handler( buffer -> { - LOGGER.debug( + LOG.debug( "Received Websocket request {} ({})", buffer.toString(), socketAddressAsString(socketAddress)); @@ -74,7 +74,7 @@ public class WebSocketService { websocket.closeHandler( v -> { - LOGGER.debug("Websocket Disconnected ({})", socketAddressAsString(socketAddress)); + LOG.debug("Websocket Disconnected ({})", socketAddressAsString(socketAddress)); vertx .eventBus() .publish(SubscriptionManager.EVENTBUS_REMOVE_SUBSCRIPTIONS_ADDRESS, connectionId); @@ -82,7 +82,7 @@ public class WebSocketService { websocket.exceptionHandler( t -> { - LOGGER.debug( + LOG.debug( "Unrecoverable error on Websocket: {} ({})", t.getMessage(), socketAddressAsString(socketAddress)); @@ -95,7 +95,7 @@ public class WebSocketService { return res -> { if (res.succeeded()) { - LOGGER.info( + LOG.info( "Websocket service started and listening on {}:{}", configuration.getHost(), httpServer.actualPort()); diff --git a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java index 886aa53277..ee595901f9 100644 --- a/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java +++ b/ethereum/jsonrpc/src/main/java/net/consensys/pantheon/ethereum/jsonrpc/websocket/subscription/SubscriptionManager.java @@ -31,7 +31,7 @@ import org.apache.logging.log4j.Logger; */ 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 = "SubscriptionManager::removeSubscriptions"; @@ -47,7 +47,7 @@ public class SubscriptionManager extends AbstractVerticle { } public Long subscribe(final SubscribeRequest request) { - LOGGER.info("Subscribe request {}", request); + LOG.info("Subscribe request {}", request); final long subscriptionId = subscriptionCounter.incrementAndGet(); final Subscription subscription = subscriptionBuilder.build(subscriptionId, request); @@ -70,7 +70,7 @@ public class SubscriptionManager extends AbstractVerticle { } 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())) { throw new SubscriptionNotFoundException(request.getSubscriptionId()); @@ -102,10 +102,10 @@ public class SubscriptionManager extends AbstractVerticle { void removeSubscriptions(final Message message) { final String connectionId = message.body(); 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 subscriptionIds = Lists.newArrayList( diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/NetworkRunner.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/NetworkRunner.java index 526be17b9d..2e2a55fc44 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/NetworkRunner.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/NetworkRunner.java @@ -26,7 +26,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; 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 AtomicBoolean started = new AtomicBoolean(false); @@ -59,17 +59,17 @@ public class NetworkRunner implements AutoCloseable { public void start() { if (started.compareAndSet(false, true)) { - LOGGER.info("Starting Network."); + LOG.info("Starting Network."); setupHandlers(); networkExecutor.submit(network); } else { - LOGGER.error("Attempted to start already running network."); + LOG.error("Attempted to start already running network."); } } public void stop() { if (stopped.compareAndSet(false, true)) { - LOGGER.info("Stopping Network."); + LOG.info("Stopping Network."); network.stop(); for (final ProtocolManager protocolManager : protocolManagers) { protocolManager.stop(); @@ -77,7 +77,7 @@ public class NetworkRunner implements AutoCloseable { networkExecutor.shutdown(); shutdown.countDown(); } 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(); } 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.awaitTermination(2L, TimeUnit.MINUTES); } - LOGGER.info("Network stopped."); + LOG.info("Network stopped."); } private void setupHandlers() { @@ -108,7 +108,7 @@ public class NetworkRunner implements AutoCloseable { final int code = message.getData().getCode(); if (!protocol.isValidMessageCode(cap.getVersion(), code)) { // Handle invalid messsages by disconnecting - LOGGER.info( + LOG.info( "Invalid message code ({}-{}, {}) received from peer, disconnecting from:", cap.getName(), cap.getVersion(), diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java index 0950f36639..0c5b3b8749 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/PeerDiscoveryAgent.java @@ -78,7 +78,7 @@ import org.apache.logging.log4j.Logger; * */ 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 // clients ignore that, so we add in a little extra padding. diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java index 1914d902cc..ff19ee5363 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/discovery/internal/PeerDiscoveryController.java @@ -79,7 +79,7 @@ import org.apache.logging.log4j.Logger; */ 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 final Vertx vertx; private final PeerTable peerTable; diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/ApiHandler.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/ApiHandler.java index 71d6dedb34..5af7098ad3 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/ApiHandler.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/ApiHandler.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger; final class ApiHandler extends SimpleChannelInboundHandler { - private static final Logger LOGGER = LogManager.getLogger(ApiHandler.class); + private static final Logger LOG = LogManager.getLogger(); private final CapabilityMultiplexer multiplexer; private final AtomicBoolean waitingForPong; @@ -49,7 +49,7 @@ final class ApiHandler extends SimpleChannelInboundHandler { if (demultiplexed.getCapability() == null) { switch (message.getCode()) { case WireMessageCodes.PING: - LOGGER.debug("Received Wire PING"); + LOG.debug("Received Wire PING"); try { connection.send(null, PongMessage.get()); } catch (final PeerNotConnected peerNotConnected) { @@ -57,7 +57,7 @@ final class ApiHandler extends SimpleChannelInboundHandler { } break; case WireMessageCodes.PONG: - LOGGER.debug("Received Wire PONG"); + LOG.debug("Received Wire PONG"); waitingForPong.set(false); break; case WireMessageCodes.DISCONNECT: @@ -65,18 +65,18 @@ final class ApiHandler extends SimpleChannelInboundHandler { DisconnectReason reason = null; try { reason = disconnect.getReason(); - LOGGER.info( + LOG.info( "Received Wire DISCONNECT ({}) from peer: {}", reason.name(), connection.getPeer().getClientId()); } catch (final RLPException e) { // It seems pretty common to get disconnect messages with no reason, which results in an // rlp parsing error - LOGGER.warn( + LOG.warn( "Received Wire DISCONNECT, but unable to parse reason. Peer: {}", connection.getPeer().getClientId()); } catch (final Exception e) { - LOGGER.error( + LOG.error( "Received Wire DISCONNECT, but unable to parse reason. Peer: {}", connection.getPeer().getClientId(), e); @@ -91,7 +91,7 @@ final class ApiHandler extends SimpleChannelInboundHandler { @Override 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); ctx.close(); } diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/Callbacks.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/Callbacks.java index 1c15a077cd..aed89bc8fa 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/Callbacks.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/Callbacks.java @@ -16,7 +16,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; public class Callbacks { - private static final Logger LOGGER = LogManager.getLogger(Callbacks.class); + private static final Logger LOG = LogManager.getLogger(); private static final Subscribers> NO_SUBSCRIBERS = new Subscribers<>(); private final Map>> callbacks; @@ -48,7 +48,7 @@ public class Callbacks { try { consumer.accept(fullMessage); } catch (final Throwable t) { - LOGGER.error("Error in callback:", t); + LOG.error("Error in callback:", t); } }); } diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/DeFramer.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/DeFramer.java index d2eb4b3ffb..4a2071ae86 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/DeFramer.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/DeFramer.java @@ -23,7 +23,7 @@ import org.apache.logging.log4j.Logger; final class DeFramer extends ByteToMessageDecoder { - private static final Logger LOG = LogManager.getLogger(DeFramer.class); + private static final Logger LOG = LogManager.getLogger(); private final CompletableFuture connectFuture; diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/HandshakeHandlerOutbound.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/HandshakeHandlerOutbound.java index 7bf1ecdae7..3f93998d1c 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/HandshakeHandlerOutbound.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/HandshakeHandlerOutbound.java @@ -18,7 +18,7 @@ import org.apache.logging.log4j.Logger; 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; @@ -53,7 +53,7 @@ public final class HandshakeHandlerOutbound extends AbstractHandshakeHandler { .addListener( f -> { if (f.isSuccess()) { - LOGGER.debug( + LOG.debug( "Wrote initial crypto handshake message to {}.", ctx.channel().remoteAddress()); } }); diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java index 83372ad48f..5338fe414f 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyP2PNetwork.java @@ -87,7 +87,7 @@ import org.apache.logging.log4j.Logger; */ 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; final Map>> protocolCallbacks = @@ -173,7 +173,7 @@ public final class NettyP2PNetwork implements P2PNetwork { supportedCapabilities, socketAddress.getPort(), this.keyPair.getPublicKey().getEncodedBytes()); - LOGGER.info("P2PNetwork started and listening on {}", socketAddress); + LOG.info("P2PNetwork started and listening on {}", socketAddress); latch.countDown(); }); @@ -209,7 +209,7 @@ public final class NettyP2PNetwork implements P2PNetwork { connection -> { // Reject incoming connections if we've reached our limit if (connections.size() >= maxPeers) { - LOGGER.info( + LOG.info( "Disconnecting incoming connection because connection limit of {} has been reached: {}", maxPeers, connection.getPeer().getNodeId()); @@ -223,7 +223,7 @@ public final class NettyP2PNetwork implements P2PNetwork { } onConnectionEstablished(connection); - LOGGER.info( + LOG.info( "Successfully accepted connection from {}", connection.getPeer().getNodeId()); logConnections(); }); @@ -242,7 +242,7 @@ public final class NettyP2PNetwork implements P2PNetwork { @Override public CompletableFuture connect(final Peer peer) { - LOGGER.trace("Initiating connection to peer: {}", peer.getId()); + LOG.trace("Initiating connection to peer: {}", peer.getId()); final CompletableFuture connectionFuture = new CompletableFuture<>(); final Endpoint endpoint = peer.getEndpoint(); pendingConnections.incrementAndGet(); @@ -290,9 +290,9 @@ public final class NettyP2PNetwork implements P2PNetwork { pendingConnections.decrementAndGet(); if (t == null) { onConnectionEstablished(connection); - LOGGER.info("Connection established to peer: {}", peer.getId()); + LOG.info("Connection established to peer: {}", peer.getId()); } else { - LOGGER.warn("Failed to connect to peer {}: {}", peer.getId(), t); + LOG.warn("Failed to connect to peer {}: {}", peer.getId(), t); } logConnections(); }); @@ -300,7 +300,7 @@ public final class NettyP2PNetwork implements P2PNetwork { } private void logConnections() { - LOGGER.info( + LOG.info( "Connections: {} pending, {} active connections.", pendingConnections.get(), connections.size()); diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java index 40da085d2c..58e20943ca 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/NettyPeerConnection.java @@ -27,7 +27,7 @@ import org.apache.logging.log4j.Logger; 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 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)); } @@ -96,7 +96,7 @@ final class NettyPeerConnection implements PeerConnection { @Override public void terminateConnection(final DisconnectReason reason, final boolean peerInitiated) { if (disconnectDispatched.compareAndSet(false, true)) { - LOGGER.info("Disconnected ({}) from {}", reason, peerInfo); + LOG.info("Disconnected ({}) from {}", reason, peerInfo); callbacks.invokeDisconnect(this, reason, peerInitiated); disconnected.set(true); } @@ -108,7 +108,7 @@ final class NettyPeerConnection implements PeerConnection { @Override public void disconnect(final DisconnectReason reason) { if (disconnectDispatched.compareAndSet(false, true)) { - LOGGER.info("Disconnecting ({}) from {}", reason, peerInfo); + LOG.info("Disconnecting ({}) from {}", reason, peerInfo); callbacks.invokeDisconnect(this, reason, false); try { send(null, DisconnectMessage.create(reason)); diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/WireKeepAlive.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/WireKeepAlive.java index d5975bbaaf..b922cc9387 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/WireKeepAlive.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/netty/WireKeepAlive.java @@ -15,7 +15,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; 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; @@ -37,12 +37,12 @@ final class WireKeepAlive extends ChannelDuplexHandler { if (waitingForPong.get()) { // 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); 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()); waitingForPong.set(true); } diff --git a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/wire/Capability.java b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/wire/Capability.java index 7ccde0633b..30e43bce99 100644 --- a/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/wire/Capability.java +++ b/ethereum/p2p/src/main/java/net/consensys/pantheon/ethereum/p2p/wire/Capability.java @@ -20,7 +20,7 @@ import org.apache.logging.log4j.Logger; * format */ 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 int version; @@ -28,7 +28,7 @@ public class Capability { // Quorum reports IBFT as "istanbul", breaking wire protocol conventions. // As such, this check cannot prevent connection. if (name.length() != 3) { - LOGGER.warn("Capability name '{}' is too long", name); + LOG.warn("Capability name '{}' is too long", name); } this.name = name; this.version = version; diff --git a/pantheon/src/main/java/net/consensys/pantheon/Runner.java b/pantheon/src/main/java/net/consensys/pantheon/Runner.java index bb114cc84f..e61424a54b 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/Runner.java +++ b/pantheon/src/main/java/net/consensys/pantheon/Runner.java @@ -22,7 +22,7 @@ public class Runner implements AutoCloseable { 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; @@ -53,19 +53,19 @@ public class Runner implements AutoCloseable { public void execute() { try { - LOGGER.info("Starting Ethereum main loop ... "); + LOG.info("Starting Ethereum main loop ... "); networkRunner.start(); pantheonController.getSynchronizer().start(); jsonRpc.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(); networkRunner.awaitStop(); } catch (final InterruptedException e) { - LOGGER.debug("Interrupted, exiting", e); + LOG.debug("Interrupted, exiting", e); Thread.currentThread().interrupt(); } catch (final Exception ex) { - LOGGER.error("Exception in main loop:", ex); + LOG.error("Exception in main loop:", ex); throw new IllegalStateException(ex); } } @@ -111,7 +111,7 @@ public class Runner implements AutoCloseable { fileOutputStream, "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) { - LOGGER.warn("Error writing ports file", e); + LOG.warn("Error writing ports file", e); } } diff --git a/pantheon/src/main/java/net/consensys/pantheon/cli/ExportPublicKeySubCommand.java b/pantheon/src/main/java/net/consensys/pantheon/cli/ExportPublicKeySubCommand.java index 1bd7e87ef7..a464c6f325 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/cli/ExportPublicKeySubCommand.java +++ b/pantheon/src/main/java/net/consensys/pantheon/cli/ExportPublicKeySubCommand.java @@ -27,7 +27,7 @@ import picocli.CommandLine.ParentCommand; ) 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") private final File publicKeyExportFile = null; @@ -49,7 +49,7 @@ class ExportPublicKeySubCommand implements Runnable { try (BufferedWriter fileWriter = Files.newBufferedWriter(path, UTF_8)) { fileWriter.write(keyPair.getPublicKey().toString()); } 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); } } } diff --git a/pantheon/src/main/java/net/consensys/pantheon/cli/ImportBlockchainSubCommand.java b/pantheon/src/main/java/net/consensys/pantheon/cli/ImportBlockchainSubCommand.java index af0d19cb5c..efecc6f6d7 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/cli/ImportBlockchainSubCommand.java +++ b/pantheon/src/main/java/net/consensys/pantheon/cli/ImportBlockchainSubCommand.java @@ -23,7 +23,7 @@ import picocli.CommandLine.ParentCommand; ) class ImportBlockchainSubCommand implements Runnable { - private static final Logger LOGGER = LogManager.getLogger(ImportBlockchainSubCommand.class); + private static final Logger LOG = LogManager.getLogger(); @ParentCommand private PantheonCommand parentCommand; // Picocli injects reference to parent command @@ -76,7 +76,7 @@ class ImportBlockchainSubCommand implements Runnable { @Override public void run() { - LOGGER.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); + LOG.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); checkNotNull(parentCommand); diff --git a/pantheon/src/main/java/net/consensys/pantheon/cli/ImportSubCommand.java b/pantheon/src/main/java/net/consensys/pantheon/cli/ImportSubCommand.java index 4fc1476eea..087bfaf03e 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/cli/ImportSubCommand.java +++ b/pantheon/src/main/java/net/consensys/pantheon/cli/ImportSubCommand.java @@ -22,7 +22,7 @@ import picocli.CommandLine.ParentCommand; mixinStandardHelpOptions = true ) class ImportSubCommand implements Runnable { - private static final Logger LOGGER = LogManager.getLogger(); + private static final Logger LOG = LogManager.getLogger(); @ParentCommand private PantheonCommand parentCommand; // Picocli injects reference to parent command @@ -38,7 +38,7 @@ class ImportSubCommand implements Runnable { @Override public void run() { - LOGGER.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); + LOG.info("Runs import sub command with blocksImportPath : {}", blocksImportPath); checkNotNull(parentCommand); checkNotNull(blockImporter); diff --git a/pantheon/src/main/java/net/consensys/pantheon/cli/PantheonCommand.java b/pantheon/src/main/java/net/consensys/pantheon/cli/PantheonCommand.java index 86ab9f54df..8bf2cc04df 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/cli/PantheonCommand.java +++ b/pantheon/src/main/java/net/consensys/pantheon/cli/PantheonCommand.java @@ -61,7 +61,7 @@ import picocli.CommandLine.ParameterException; footer = "Pantheon is licensed under the Apache License 2.0" ) 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; diff --git a/pantheon/src/main/java/net/consensys/pantheon/controller/KeyPairUtil.java b/pantheon/src/main/java/net/consensys/pantheon/controller/KeyPairUtil.java index 91bf1a0f6c..b7adc846bb 100644 --- a/pantheon/src/main/java/net/consensys/pantheon/controller/KeyPairUtil.java +++ b/pantheon/src/main/java/net/consensys/pantheon/controller/KeyPairUtil.java @@ -1,29 +1,27 @@ package net.consensys.pantheon.controller; -import static org.apache.logging.log4j.LogManager.getLogger; - import net.consensys.pantheon.crypto.SECP256K1; import java.io.File; import java.io.IOException; import java.nio.file.Path; +import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; 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 { final File keyFile = home.resolve("key").toFile(); final SECP256K1.KeyPair key; if (keyFile.exists()) { key = SECP256K1.KeyPair.load(keyFile); - LOGGER.info( - "Loaded key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); + LOG.info("Loaded key {} from {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); } else { key = SECP256K1.KeyPair.generate(); key.getPrivateKey().store(keyFile); - LOGGER.info( + LOG.info( "Generated new key key {} and stored it to {}", key.getPublicKey().toString(), keyFile.getAbsolutePath()); diff --git a/pantheon/src/test/java/net/consensys/pantheon/cli/CommandTestAbstract.java b/pantheon/src/test/java/net/consensys/pantheon/cli/CommandTestAbstract.java index a6661ca9f8..0acb787522 100644 --- a/pantheon/src/test/java/net/consensys/pantheon/cli/CommandTestAbstract.java +++ b/pantheon/src/test/java/net/consensys/pantheon/cli/CommandTestAbstract.java @@ -37,7 +37,7 @@ import picocli.CommandLine.RunLast; @RunWith(MockitoJUnitRunner.class) public abstract class CommandTestAbstract { - private final Logger LOGGER = LogManager.getLogger(); + private final Logger LOG = LogManager.getLogger(); final ByteArrayOutputStream commandOutput = new ByteArrayOutputStream(); private final PrintStream outPrintStream = new PrintStream(commandOutput); @@ -74,8 +74,8 @@ public abstract class CommandTestAbstract { // Display outputs for debug purpose @After public void displayOutput() { - LOGGER.info("Standard output {}", commandOutput.toString()); - LOGGER.info("Standard error {}", commandErrorOutput.toString()); + LOG.info("Standard output {}", commandOutput.toString()); + LOG.info("Standard error {}", commandErrorOutput.toString()); } void parseCommand(final String... args) { diff --git a/services/kvstore/src/main/java/net/consensys/pantheon/services/kvstore/RocksDbKeyValueStorage.java b/services/kvstore/src/main/java/net/consensys/pantheon/services/kvstore/RocksDbKeyValueStorage.java index d47f8035a7..e2953e89b0 100644 --- a/services/kvstore/src/main/java/net/consensys/pantheon/services/kvstore/RocksDbKeyValueStorage.java +++ b/services/kvstore/src/main/java/net/consensys/pantheon/services/kvstore/RocksDbKeyValueStorage.java @@ -25,7 +25,7 @@ import org.rocksdb.WriteOptions; 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 TransactionDBOptions txOptions; @@ -106,7 +106,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { private void throwIfClosed() { 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"); } } @@ -140,7 +140,7 @@ public class RocksDbKeyValueStorage implements KeyValueStorage, Closeable { try { rocksIt.status(); } catch (final RocksDBException e) { - logger.error("RocksDbEntryIterator encountered a problem while iterating.", e); + LOG.error("RocksDbEntryIterator encountered a problem while iterating.", e); } if (!hasNext()) { throw new NoSuchElementException();