diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSigners.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSigners.java index cb3bf21d77..783cc01ec6 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSigners.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSigners.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.VoteTallyCache; import tech.pegasys.pantheon.ethereum.core.BlockHeader; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; @@ -30,7 +31,6 @@ import java.util.stream.Collectors; public class CliqueGetSigners implements JsonRpcMethod { - public static final String CLIQUE_GET_SIGNERS = "clique_getSigners"; private final BlockchainQueries blockchainQueries; private final VoteTallyCache voteTallyCache; private final JsonRpcParameter parameters; @@ -46,7 +46,7 @@ public CliqueGetSigners( @Override public String getName() { - return CLIQUE_GET_SIGNERS; + return RpcMethod.CLIQUE_GET_SIGNERS.getMethodName(); } @Override diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSignersAtHash.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSignersAtHash.java index 40ab27b6cc..d859d504ce 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSignersAtHash.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueGetSignersAtHash.java @@ -15,6 +15,7 @@ import tech.pegasys.pantheon.consensus.common.VoteTallyCache; import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -30,7 +31,6 @@ import java.util.stream.Collectors; public class CliqueGetSignersAtHash implements JsonRpcMethod { - public static final String CLIQUE_GET_SIGNERS_AT_HASH = "clique_getSignersAtHash"; private final BlockchainQueries blockchainQueries; private final VoteTallyCache voteTallyCache; private final JsonRpcParameter parameters; @@ -46,7 +46,7 @@ public CliqueGetSignersAtHash( @Override public String getName() { - return CLIQUE_GET_SIGNERS_AT_HASH; + return RpcMethod.CLIQUE_GET_SIGNERS_AT_HASH.getMethodName(); } @Override diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueProposals.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueProposals.java index 026e1a5ffc..9b9a87a5f5 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueProposals.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/CliqueProposals.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.consensus.common.jsonrpc.AbstractVoteProposerMethod; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; public class CliqueProposals extends AbstractVoteProposerMethod implements JsonRpcMethod { @@ -24,6 +25,6 @@ public CliqueProposals(final VoteProposer voteProposer) { @Override public String getName() { - return "clique_proposals"; + return RpcMethod.CLIQUE_GET_PROPOSALS.getMethodName(); } } diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Discard.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Discard.java index c1979bfa93..937bb9b281 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Discard.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Discard.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -21,7 +22,6 @@ import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; public class Discard implements JsonRpcMethod { - private static final String CLIQUE_DISCARD = "clique_discard"; private final VoteProposer proposer; private final JsonRpcParameter parameters; @@ -32,7 +32,7 @@ public Discard(final VoteProposer proposer, final JsonRpcParameter parameters) { @Override public String getName() { - return CLIQUE_DISCARD; + return RpcMethod.CLIQUE_DISCARD.getMethodName(); } @Override diff --git a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Propose.java b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Propose.java index 9d043175d1..9aa11afb9e 100644 --- a/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Propose.java +++ b/consensus/clique/src/main/java/tech/pegasys/pantheon/consensus/clique/jsonrpc/methods/Propose.java @@ -16,6 +16,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -35,7 +36,7 @@ public Propose(final VoteProposer proposer, final JsonRpcParameter parameters) { @Override public String getName() { - return "clique_propose"; + return RpcMethod.CLIQUE_PROPOSE.getMethodName(); } @Override diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftDiscardValidatorVote.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftDiscardValidatorVote.java index b11ac0a0d4..29dc78faba 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftDiscardValidatorVote.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftDiscardValidatorVote.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -36,7 +37,7 @@ public IbftDiscardValidatorVote( @Override public String getName() { - return "ibft_discardValidatorVote"; + return RpcMethod.IBFT_DISCARD_VALIDATOR_VOTE.getMethodName(); } @Override diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetPendingVotes.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetPendingVotes.java index 2a71fbab16..02dbd204f0 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetPendingVotes.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetPendingVotes.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.consensus.common.jsonrpc.AbstractVoteProposerMethod; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; public class IbftGetPendingVotes extends AbstractVoteProposerMethod implements JsonRpcMethod { @@ -24,6 +25,6 @@ public IbftGetPendingVotes(final VoteProposer voteProposer) { @Override public String getName() { - return "ibft_getPendingVotes"; + return RpcMethod.IBFT_GET_PENDING_VOTES.getMethodName(); } } diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockHash.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockHash.java index 031d5ea8b9..c2fe632a95 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockHash.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockHash.java @@ -16,6 +16,7 @@ import tech.pegasys.pantheon.ethereum.chain.Blockchain; import tech.pegasys.pantheon.ethereum.core.BlockHeader; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -46,7 +47,7 @@ public IbftGetValidatorsByBlockHash( @Override public String getName() { - return "ibft_getValidatorsByBlockHash"; + return RpcMethod.IBFT_GET_VALIDATORS_BY_BLOCK_HASH.getMethodName(); } @Override diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockNumber.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockNumber.java index c922593f09..192faba3fc 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockNumber.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftGetValidatorsByBlockNumber.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.consensus.common.BlockInterface; import tech.pegasys.pantheon.ethereum.core.BlockHeader; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.AbstractBlockParameterMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; @@ -62,6 +63,6 @@ protected Object resultByBlockNumber(final JsonRpcRequest request, final long bl @Override public String getName() { - return "ibft_getValidatorsByBlockNumber"; + return RpcMethod.IBFT_GET_VALIDATORS_BY_BLOCK_NUMBER.getMethodName(); } } diff --git a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftProposeValidatorVote.java b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftProposeValidatorVote.java index 0862b40aac..a1364bce2f 100644 --- a/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftProposeValidatorVote.java +++ b/consensus/ibft/src/main/java/tech/pegasys/pantheon/consensus/ibft/jsonrpc/methods/IbftProposeValidatorVote.java @@ -15,6 +15,7 @@ import tech.pegasys.pantheon.consensus.common.VoteProposer; import tech.pegasys.pantheon.consensus.common.VoteType; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -37,7 +38,7 @@ public IbftProposeValidatorVote( @Override public String getName() { - return "ibft_proposeValidatorVote"; + return RpcMethod.IBFT_PROPOSE_VALIDATOR_VOTE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java index 29528c4c35..c05c091373 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpService.java @@ -80,7 +80,7 @@ public class JsonRpcHttpService { private final Vertx vertx; private final JsonRpcConfiguration config; - private final Map jsonRpcMethods; + private final RpcMethods rpcMethods; private final Path dataDir; private final LabelledMetric requestTimer; @@ -129,7 +129,7 @@ private JsonRpcHttpService( validateConfig(config); this.config = config; this.vertx = vertx; - this.jsonRpcMethods = methods; + this.rpcMethods = new RpcMethods(methods); this.authenticationService = authenticationService; } @@ -442,9 +442,14 @@ private JsonRpcResponse process(final JsonObject requestJson, final Optional {}", request.getMethod()); // Find method handler - final JsonRpcMethod method = jsonRpcMethods.get(request.getMethod()); + final JsonRpcMethod method = rpcMethods.getMethod(request.getMethod()); if (method == null) { - return errorResponse(id, JsonRpcError.METHOD_NOT_FOUND); + if (!rpcMethods.isDefined(request.getMethod())) { + return errorResponse(id, JsonRpcError.METHOD_NOT_FOUND); + } + if (!rpcMethods.isEnabled(request.getMethod())) { + return errorResponse(id, JsonRpcError.METHOD_NOT_ENABLED); + } } if (AuthenticationUtils.isPermitted(authenticationService, user, method)) { diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethod.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethod.java new file mode 100644 index 0000000000..2709f4b436 --- /dev/null +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethod.java @@ -0,0 +1,124 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.jsonrpc; + +import java.util.ArrayList; +import java.util.Collection; + +public enum RpcMethod { + ADMIN_ADD_PEER("admin_addPeer"), + ADMIN_NODE_INFO("admin_nodeInfo"), + ADMIN_PEERS("admin_peers"), + ADMIN_REMOVE_PEER("admin_removePeer"), + CLIQUE_DISCARD("clique_discard"), + CLIQUE_GET_SIGNERS("clique_getSigners"), + CLIQUE_GET_SIGNERS_AT_HASH("clique_getSignersAtHash"), + CLIQUE_GET_PROPOSALS("clique_proposals"), + CLIQUE_PROPOSE("clique_propose"), + DEBUG_METRICS("debug_metrics"), + DEBUG_STORAGE_RANGE_AT("debug_storageRangeAt"), + DEBUG_TRACE_BLOCK("debug_traceBlock"), + DEBUG_TRACE_BLOCK_BY_HASH("debug_traceBlockByHash"), + DEBUG_TRACE_BLOCK_BY_NUMBER("debug_traceBlockByNumber"), + DEBUG_TRACE_TRANSACTION("debug_traceTransaction"), + EEA_GET_TRANSACTION_COUNT("eea_getTransactionCount"), + EEA_GET_TRANSACTION_RECEIPT("eea_getTransactionReceipt"), + EEA_SEND_RAW_TRANSACTION("eea_sendRawTransaction"), + ETH_ACCOUNTS("eth_accounts"), + ETH_BLOCK_NUMBER("eth_blockNumber"), + ETH_CALL("eth_call"), + ETH_CHAIN_ID("eth_chainId"), + ETH_COINBASE("eth_coinbase"), + ETH_ESTIMATE_GAS("eth_estimateGas"), + ETH_GAS_PRICE("eth_gasPrice"), + ETH_GET_BALANCE("eth_getBalance"), + ETH_GET_BLOCK_BY_HASH("eth_getBlockByHash"), + ETH_GET_BLOCK_BY_NUMBER("eth_getBlockByNumber"), + ETH_GET_BLOCK_TRANSACTION_COUNT_BY_HASH("eth_getBlockTransactionCountByHash"), + ETH_GET_BLOCK_TRANSACTION_COUNT_BY_NUMBER("eth_getBlockTransactionCountByNumber"), + ETH_GET_CODE("eth_getCode"), + ETH_GET_FILTER_CHANGES("eth_getFilterChanges"), + ETH_GET_FILTER_LOGS("eth_getFilterLogs"), + ETH_GET_LOGS("eth_getLogs"), + ETH_GET_STORAGE_AT("eth_getStorageAt"), + ETH_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX("eth_getTransactionByBlockHashAndIndex"), + ETH_GET_TRANSACTION_BY_BLOCK_NUMBER_AND_INDEX("eth_getTransactionByBlockNumberAndIndex"), + ETH_GET_TRANSACTION_BY_HASH("eth_getTransactionByHash"), + ETH_GET_TRANSACTION_COUNT("eth_getTransactionCount"), + ETH_GET_TRANSACTION_RECEIPT("eth_getTransactionReceipt"), + ETH_GET_UNCLE_BY_BLOCK_HASH_AND_INDEX("eth_getUncleByBlockHashAndIndex"), + ETH_GET_UNCLE_BY_BLOCK_NUMBER_AND_INDEX("eth_getUncleByBlockNumberAndIndex"), + ETH_GET_UNCLE_COUNT_BY_BLOCK_HASH("eth_getUncleCountByBlockHash"), + ETH_GET_UNCLE_COUNT_BY_BLOCK_NUMBER("eth_getUncleCountByBlockNumber"), + ETH_GET_WORK("eth_getWork"), + ETH_HASHRATE("eth_hashrate"), + ETH_MINING("eth_mining"), + ETH_NEW_BLOCK_FILTER("eth_newBlockFilter"), + ETH_NEW_FILTER("eth_newFilter"), + ETH_NEW_PENDING_TRANSACTION_FILTER("eth_newPendingTransactionFilter"), + ETH_PROTOCOL_VERSION("eth_protocolVersion"), + ETH_SEND_RAW_TRANSACTION("eth_sendRawTransaction"), + ETH_SUBSCRIBE("eth_subscribe"), + ETH_SYNCING("eth_syncing"), + ETH_UNINSTALL_FILTER("eth_uninstallFilter"), + ETH_UNSUBSCRIBE("eth_unsubscribe"), + IBFT_DISCARD_VALIDATOR_VOTE("ibft_discardValidatorVote"), + IBFT_GET_PENDING_VOTES("ibft_getPendingVotes"), + IBFT_GET_VALIDATORS_BY_BLOCK_HASH("ibft_getValidatorsByBlockHash"), + IBFT_GET_VALIDATORS_BY_BLOCK_NUMBER("ibft_getValidatorsByBlockNumber"), + IBFT_PROPOSE_VALIDATOR_VOTE("ibft_proposeValidatorVote"), + MINER_SET_COINBASE("miner_setCoinbase"), + MINER_SET_ETHERBASE("miner_setEtherbase"), + MINER_START("miner_start"), + MINER_STOP("miner_stop"), + NET_ENODE("net_enode"), + NET_LISTENING("net_listening"), + NET_PEER_COUNT("net_peerCount"), + NET_SERVICES("net_services"), + NET_VERSION("net_version"), + PERM_ADD_ACCOUNTS_TO_WHITELIST("perm_addAccountsToWhitelist"), + PERM_ADD_NODES_TO_WHITELIST("perm_addNodesToWhitelist"), + PERM_GET_ACCOUNTS_WHITELIST("perm_getAccountsWhitelist"), + PERM_GET_NODES_WHITELIST("perm_getNodesWhitelist"), + PERM_RELOAD_PERMISSIONS_FROM_FILE("perm_reloadPermissionsFromFile"), + PERM_REMOVE_ACCOUNTS_FROM_WHITELIST("perm_removeAccountsFromWhitelist"), + PERM_REMOVE_NODES_FROM_WHITELIST("perm_removeNodesFromWhitelist"), + RPC_MODULES("rpc_modules"), + TX_POOL_PANTHEON_STATISTICS("txpool_pantheonStatistics"), + TX_POOL_PANTHEON_TRANSACTIONS("txpool_pantheonTransactions"), + WEB3_CLIENT_VERSION("web3_clientVersion"), + WEB3_SHA3("web3_sha3"); + + private final String methodName; + + private static Collection allMethodNames; + + public String getMethodName() { + return methodName; + } + + static { + allMethodNames = new ArrayList<>(); + for (RpcMethod m : RpcMethod.values()) { + allMethodNames.add(m.getMethodName()); + } + } + + RpcMethod(final String methodName) { + this.methodName = methodName; + } + + public static boolean rpcMethodExists(final String rpcMethodName) { + return allMethodNames.contains(rpcMethodName); + } +} diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethods.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethods.java new file mode 100644 index 0000000000..a4f157e456 --- /dev/null +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/RpcMethods.java @@ -0,0 +1,38 @@ +/* + * Copyright 2019 ConsenSys AG. + * + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + */ +package tech.pegasys.pantheon.ethereum.jsonrpc; + +import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; + +import java.util.Map; + +public class RpcMethods { + + private Map enabledMethods; + + public RpcMethods(final Map enabledMethods) { + this.enabledMethods = enabledMethods; + } + + public JsonRpcMethod getMethod(final String methodName) { + return enabledMethods.get(methodName); + } + + public boolean isEnabled(final String methodName) { + return enabledMethods.containsKey(methodName); + } + + public boolean isDefined(final String methodName) { + return RpcMethod.rpcMethodExists(methodName) || isEnabled(methodName); + } +} diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminAddPeer.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminAddPeer.java index 57592224e1..ec06b6e881 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminAddPeer.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminAddPeer.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -33,7 +34,7 @@ public AdminAddPeer(final P2PNetwork peerNetwork, final JsonRpcParameter paramet @Override public String getName() { - return "admin_addPeer"; + return RpcMethod.ADMIN_ADD_PEER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminNodeInfo.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminNodeInfo.java index 0253dd9cad..12fd7d476c 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminNodeInfo.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminNodeInfo.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.config.GenesisConfigOptions; import tech.pegasys.pantheon.ethereum.chain.ChainHead; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -53,7 +54,7 @@ public AdminNodeInfo( @Override public String getName() { - return "admin_nodeInfo"; + return RpcMethod.ADMIN_NODE_INFO.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminPeers.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminPeers.java index 11e70a6a74..9537be2d8a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminPeers.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminPeers.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -33,7 +34,7 @@ public AdminPeers(final P2PNetwork peerDiscoveryAgent) { @Override public String getName() { - return "admin_peers"; + return RpcMethod.ADMIN_PEERS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminRemovePeer.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminRemovePeer.java index 1265bc4222..6e81764792 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminRemovePeer.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/AdminRemovePeer.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -32,12 +33,12 @@ public AdminRemovePeer(final P2PNetwork peerNetwork, final JsonRpcParameter para @Override public String getName() { - return "admin_removePeer"; + return RpcMethod.ADMIN_REMOVE_PEER.getMethodName(); } @Override protected JsonRpcResponse performOperation(final Object id, final String enode) { - LOG.debug("Remove ({}) to peer cache", enode); + LOG.debug("Remove ({}) from peer cache", enode); final EnodeURL enodeURL = EnodeURL.fromString(enode); final boolean result = peerNetwork.removeMaintainedConnectionPeer(DefaultPeer.fromEnodeURL(enodeURL)); diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetrics.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetrics.java index 47467eae89..7320a0168d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetrics.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugMetrics.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -32,7 +33,7 @@ public DebugMetrics(final MetricsSystem metricsSystem) { @Override public String getName() { - return "debug_metrics"; + return RpcMethod.DEBUG_METRICS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugStorageRangeAt.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugStorageRangeAt.java index 955de1af35..62f0f29fc1 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugStorageRangeAt.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugStorageRangeAt.java @@ -16,6 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.core.MutableWorldState; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.processor.BlockReplay; @@ -47,7 +48,7 @@ public DebugStorageRangeAt( @Override public String getName() { - return "debug_storageRangeAt"; + return RpcMethod.DEBUG_STORAGE_RANGE_AT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlock.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlock.java index 221ffef7d4..2be45aebe0 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlock.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlock.java @@ -15,6 +15,7 @@ import tech.pegasys.pantheon.ethereum.core.Block; import tech.pegasys.pantheon.ethereum.core.BlockHashFunction; import tech.pegasys.pantheon.ethereum.debug.TraceOptions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.TransactionTraceParams; @@ -57,7 +58,7 @@ public DebugTraceBlock( @Override public String getName() { - return "debug_traceBlock"; + return RpcMethod.DEBUG_TRACE_BLOCK.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByHash.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByHash.java index b8a5600c86..d2b8d71a42 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByHash.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByHash.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.debug.TraceOptions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.TransactionTraceParams; @@ -38,7 +39,7 @@ public DebugTraceBlockByHash(final JsonRpcParameter parameters, final BlockTrace @Override public String getName() { - return "debug_traceBlockByHash"; + return RpcMethod.DEBUG_TRACE_BLOCK_BY_HASH.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByNumber.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByNumber.java index 4e9a39ee94..d6c3061ee8 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByNumber.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceBlockByNumber.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.debug.TraceOptions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -44,7 +45,7 @@ public DebugTraceBlockByNumber( @Override public String getName() { - return "debug_traceBlockByNumber"; + return RpcMethod.DEBUG_TRACE_BLOCK_BY_NUMBER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceTransaction.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceTransaction.java index f3a7080036..713c86d2fa 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceTransaction.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/DebugTraceTransaction.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.debug.TraceOptions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.TransactionTraceParams; @@ -44,7 +45,7 @@ public DebugTraceTransaction( @Override public String getName() { - return "debug_traceTransaction"; + return RpcMethod.DEBUG_TRACE_TRANSACTION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthAccounts.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthAccounts.java index e515474dfe..c976953493 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthAccounts.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthAccounts.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -20,7 +21,7 @@ public class EthAccounts implements JsonRpcMethod { @Override public String getName() { - return "eth_accounts"; + return RpcMethod.ETH_ACCOUNTS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthBlockNumber.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthBlockNumber.java index 543b03ddd7..9f0e5cf484 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthBlockNumber.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthBlockNumber.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; @@ -28,7 +29,7 @@ public EthBlockNumber(final BlockchainQueries blockchain) { @Override public String getName() { - return "eth_blockNumber"; + return RpcMethod.ETH_BLOCK_NUMBER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCall.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCall.java index 5b22e1f49a..6384383fab 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCall.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCall.java @@ -14,6 +14,7 @@ import static tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcErrorConverter.convertTransactionInvalidReason; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.exception.InvalidJsonRpcParameters; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; @@ -40,7 +41,7 @@ public EthCall( @Override public String getName() { - return "eth_call"; + return RpcMethod.ETH_CALL.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthChainId.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthChainId.java index a54ce0909d..880c3504cf 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthChainId.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthChainId.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -30,7 +31,7 @@ public EthChainId(final Optional chainId) { @Override public String getName() { - return "eth_chainId"; + return RpcMethod.ETH_CHAIN_ID.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCoinbase.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCoinbase.java index 465e17e222..88d32f0878 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCoinbase.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthCoinbase.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -32,7 +33,7 @@ public EthCoinbase(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "eth_coinbase"; + return RpcMethod.ETH_COINBASE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthEstimateGas.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthEstimateGas.java index 8d2e3956f7..9edb4d7863 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthEstimateGas.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthEstimateGas.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.BlockHeader; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonCallParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -45,7 +46,7 @@ public EthEstimateGas( @Override public String getName() { - return "eth_estimateGas"; + return RpcMethod.ETH_ESTIMATE_GAS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGasPrice.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGasPrice.java index 7667d1120a..b3a54fcab0 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGasPrice.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGasPrice.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; import tech.pegasys.pantheon.ethereum.core.Wei; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -29,7 +30,7 @@ public EthGasPrice(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "eth_gasPrice"; + return RpcMethod.ETH_GAS_PRICE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBalance.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBalance.java index bb11434c71..915ca8247c 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBalance.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBalance.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -27,7 +28,7 @@ public EthGetBalance(final BlockchainQueries blockchain, final JsonRpcParameter @Override public String getName() { - return "eth_getBalance"; + return RpcMethod.ETH_GET_BALANCE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByHash.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByHash.java index 2fd6ffdffd..38dbd02a50 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByHash.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByHash.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; @@ -38,7 +39,7 @@ public EthGetBlockByHash( @Override public String getName() { - return "eth_getBlockByHash"; + return RpcMethod.ETH_GET_BLOCK_BY_HASH.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByNumber.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByNumber.java index 2cf2312484..0a6cc2494e 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByNumber.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockByNumber.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -33,7 +34,7 @@ public EthGetBlockByNumber( @Override public String getName() { - return "eth_getBlockByNumber"; + return RpcMethod.ETH_GET_BLOCK_BY_NUMBER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByHash.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByHash.java index 14cc7c1e2a..36359cb350 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByHash.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByHash.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; @@ -33,7 +34,7 @@ public EthGetBlockTransactionCountByHash( @Override public String getName() { - return "eth_getBlockTransactionCountByHash"; + return RpcMethod.ETH_GET_BLOCK_TRANSACTION_COUNT_BY_HASH.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByNumber.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByNumber.java index 9650540c9b..64fd2a5082 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByNumber.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetBlockTransactionCountByNumber.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -27,7 +28,7 @@ public EthGetBlockTransactionCountByNumber( @Override public String getName() { - return "eth_getBlockTransactionCountByNumber"; + return RpcMethod.ETH_GET_BLOCK_TRANSACTION_COUNT_BY_NUMBER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetCode.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetCode.java index 88923dda9a..53a521b477 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetCode.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetCode.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -27,7 +28,7 @@ public EthGetCode(final BlockchainQueries blockchainQueries, final JsonRpcParame @Override public String getName() { - return "eth_getCode"; + return RpcMethod.ETH_GET_CODE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterChanges.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterChanges.java index 3604a4f558..0a2e89b98d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterChanges.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterChanges.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -38,7 +39,7 @@ public EthGetFilterChanges(final FilterManager filterManager, final JsonRpcParam @Override public String getName() { - return "eth_getFilterChanges"; + return RpcMethod.ETH_GET_FILTER_CHANGES.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java index 557aba5cad..9423488cfd 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetFilterLogs.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -36,7 +37,7 @@ public EthGetFilterLogs(final FilterManager filterManager, final JsonRpcParamete @Override public String getName() { - return "eth_getFilterLogs"; + return RpcMethod.ETH_GET_FILTER_LOGS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetLogs.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetLogs.java index b255fac2c4..76e799ef97 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetLogs.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetLogs.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.LogsQuery; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.FilterParameter; @@ -35,7 +36,7 @@ public EthGetLogs(final BlockchainQueries blockchain, final JsonRpcParameter par @Override public String getName() { - return "eth_getLogs"; + return RpcMethod.ETH_GET_LOGS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetStorageAt.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetStorageAt.java index 3f6decf4f0..055d47e68b 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetStorageAt.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetStorageAt.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -28,7 +29,7 @@ public EthGetStorageAt(final BlockchainQueries blockchain, final JsonRpcParamete @Override public String getName() { - return "eth_getStorageAt"; + return RpcMethod.ETH_GET_STORAGE_AT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockHashAndIndex.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockHashAndIndex.java index e267803425..7cc357dd86 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockHashAndIndex.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockHashAndIndex.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.UnsignedIntParameter; @@ -38,7 +39,7 @@ public EthGetTransactionByBlockHashAndIndex( @Override public String getName() { - return "eth_getTransactionByBlockHashAndIndex"; + return RpcMethod.ETH_GET_TRANSACTION_BY_BLOCK_HASH_AND_INDEX.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockNumberAndIndex.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockNumberAndIndex.java index 53c51e4e36..ebe0e1f17d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockNumberAndIndex.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByBlockNumberAndIndex.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -31,7 +32,7 @@ public EthGetTransactionByBlockNumberAndIndex( @Override public String getName() { - return "eth_getTransactionByBlockNumberAndIndex"; + return RpcMethod.ETH_GET_TRANSACTION_BY_BLOCK_NUMBER_AND_INDEX.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByHash.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByHash.java index 75e31157a4..f3b7974f1f 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByHash.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionByHash.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.core.Hash; import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; @@ -43,7 +44,7 @@ public EthGetTransactionByHash( @Override public String getName() { - return "eth_getTransactionByHash"; + return RpcMethod.ETH_GET_TRANSACTION_BY_HASH.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionCount.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionCount.java index b86196fa3b..4fdf888017 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionCount.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionCount.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -36,7 +37,7 @@ public EthGetTransactionCount( @Override public String getName() { - return "eth_getTransactionCount"; + return RpcMethod.ETH_GET_TRANSACTION_COUNT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionReceipt.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionReceipt.java index 956482a63f..e828ccbdef 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionReceipt.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetTransactionReceipt.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; @@ -37,7 +38,7 @@ public EthGetTransactionReceipt( @Override public String getName() { - return "eth_getTransactionReceipt"; + return RpcMethod.ETH_GET_TRANSACTION_RECEIPT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockHashAndIndex.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockHashAndIndex.java index 120886fd22..e58296ecdf 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockHashAndIndex.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockHashAndIndex.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.UnsignedIntParameter; @@ -35,7 +36,7 @@ public EthGetUncleByBlockHashAndIndex( @Override public String getName() { - return "eth_getUncleByBlockHashAndIndex"; + return RpcMethod.ETH_GET_UNCLE_BY_BLOCK_HASH_AND_INDEX.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockNumberAndIndex.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockNumberAndIndex.java index 367beb7608..3a462d3924 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockNumberAndIndex.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleByBlockNumberAndIndex.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -29,7 +30,7 @@ public EthGetUncleByBlockNumberAndIndex( @Override public String getName() { - return "eth_getUncleByBlockNumberAndIndex"; + return RpcMethod.ETH_GET_UNCLE_BY_BLOCK_NUMBER_AND_INDEX.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockHash.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockHash.java index 86ae2e7083..74cc1c84d5 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockHash.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockHash.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.queries.BlockchainQueries; @@ -33,7 +34,7 @@ public EthGetUncleCountByBlockHash( @Override public String getName() { - return "eth_getUncleCountByBlockHash"; + return RpcMethod.ETH_GET_UNCLE_COUNT_BY_BLOCK_HASH.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockNumber.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockNumber.java index dc3ce45da0..a04bafc22d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockNumber.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetUncleCountByBlockNumber.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.BlockParameter; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -27,7 +28,7 @@ public EthGetUncleCountByBlockNumber( @Override public String getName() { - return "eth_getUncleCountByBlockNumber"; + return RpcMethod.ETH_GET_UNCLE_COUNT_BY_BLOCK_NUMBER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetWork.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetWork.java index a719a98379..8e97ea20e6 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetWork.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthGetWork.java @@ -15,6 +15,7 @@ import static org.apache.logging.log4j.LogManager.getLogger; import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -39,7 +40,7 @@ public EthGetWork(final MiningCoordinator miner) { @Override public String getName() { - return "eth_getWork"; + return RpcMethod.ETH_GET_WORK.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthHashrate.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthHashrate.java index 23d0350ab3..bba5fb8797 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthHashrate.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthHashrate.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -32,7 +33,7 @@ public EthHashrate(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "eth_hashrate"; + return RpcMethod.ETH_HASHRATE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthMining.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthMining.java index f3fdbe7089..a12bb3c089 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthMining.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthMining.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -27,7 +28,7 @@ public EthMining(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "eth_mining"; + return RpcMethod.ETH_MINING.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewBlockFilter.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewBlockFilter.java index 0d4255466a..8f63770129 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewBlockFilter.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewBlockFilter.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; @@ -27,7 +28,7 @@ public EthNewBlockFilter(final FilterManager filterManager) { @Override public String getName() { - return "eth_newBlockFilter"; + return RpcMethod.ETH_NEW_BLOCK_FILTER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewFilter.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewFilter.java index bc1ac5ddba..e0d384704c 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewFilter.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewFilter.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.LogsQuery; @@ -32,7 +33,7 @@ public EthNewFilter(final FilterManager filterManager, final JsonRpcParameter pa @Override public String getName() { - return "eth_newFilter"; + return RpcMethod.ETH_NEW_FILTER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewPendingTransactionFilter.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewPendingTransactionFilter.java index 6ee957c215..81cac57a9a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewPendingTransactionFilter.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthNewPendingTransactionFilter.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; @@ -27,7 +28,7 @@ public EthNewPendingTransactionFilter(final FilterManager filterManager) { @Override public String getName() { - return "eth_newPendingTransactionFilter"; + return RpcMethod.ETH_NEW_PENDING_TRANSACTION_FILTER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthProtocolVersion.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthProtocolVersion.java index 9344180b5e..fb26db43f0 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthProtocolVersion.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthProtocolVersion.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.eth.EthProtocol; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -36,7 +37,7 @@ public EthProtocolVersion(final Set supportedCapabilities) { @Override public String getName() { - return "eth_protocolVersion"; + return RpcMethod.ETH_PROTOCOL_VERSION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java index 806d8b8863..708ac200fa 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSendRawTransaction.java @@ -16,6 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPool; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.exception.InvalidJsonRpcRequestException; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -47,7 +48,7 @@ public EthSendRawTransaction( @Override public String getName() { - return "eth_sendRawTransaction"; + return RpcMethod.ETH_SEND_RAW_TRANSACTION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSyncing.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSyncing.java index 609e0a5791..c827125720 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSyncing.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthSyncing.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.core.Synchronizer; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -32,7 +33,7 @@ public EthSyncing(final Synchronizer synchronizer) { @Override public String getName() { - return "eth_syncing"; + return RpcMethod.ETH_SYNCING.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthUninstallFilter.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthUninstallFilter.java index 0812e98b05..b6a71f32d4 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthUninstallFilter.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/EthUninstallFilter.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.filter.FilterManager; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -30,7 +31,7 @@ public EthUninstallFilter(final FilterManager filterManager, final JsonRpcParame @Override public String getName() { - return "eth_uninstallFilter"; + return RpcMethod.ETH_UNINSTALL_FILTER.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetEnode.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetEnode.java index 0d5bc107c7..dae31cf847 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetEnode.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetEnode.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -32,7 +33,7 @@ public NetEnode(final P2PNetwork p2pNetwork) { @Override public String getName() { - return "net_enode"; + return RpcMethod.NET_ENODE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetListening.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetListening.java index cfb1a2b1e4..e094fb9936 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetListening.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetListening.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -27,7 +28,7 @@ public NetListening(final P2PNetwork p2pNetwork) { @Override public String getName() { - return "net_listening"; + return RpcMethod.NET_LISTENING.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetPeerCount.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetPeerCount.java index 36a8f46c16..77cc797806 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetPeerCount.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetPeerCount.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -30,7 +31,7 @@ public NetPeerCount(final P2PNetwork p2pNetwork) { @Override public String getName() { - return "net_peerCount"; + return RpcMethod.NET_PEER_COUNT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetServices.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetServices.java index bff737189c..6f0dd277ba 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetServices.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetServices.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.jsonrpc.JsonRpcConfiguration; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -42,7 +43,7 @@ public NetServices( @Override public String getName() { - return "net_services"; + return RpcMethod.NET_SERVICES.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetVersion.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetVersion.java index 27c8a5b8d6..5d2bd0a783 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetVersion.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/NetVersion.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -20,7 +21,7 @@ import java.util.Optional; /** - * In Consensys' client, net_version maps to the network id, as specified in * + * In ConsenSys' client, net_version maps to the network id, as specified in * * https://github.com/ethereum/wiki/wiki/JSON-RPC#net_version * *

This method can be deprecated in the future, @see https://github.com/ethereum/EIPs/issues/611 @@ -34,7 +35,7 @@ public NetVersion(final Optional chainId) { @Override public String getName() { - return "net_version"; + return RpcMethod.NET_VERSION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/RpcModules.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/RpcModules.java index 33cb003ac2..cbe85e63c0 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/RpcModules.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/RpcModules.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.jsonrpc.RpcApi; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -36,7 +37,7 @@ public RpcModules(final Collection modulesList) { @Override public String getName() { - return "rpc_modules"; + return RpcMethod.RPC_MODULES.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonStatistics.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonStatistics.java index 034e0c3195..1cfdf16208 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonStatistics.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonStatistics.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions; import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions.TransactionInfo; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -31,7 +32,7 @@ public TxPoolPantheonStatistics(final PendingTransactions pendingTransactions) { @Override public String getName() { - return "txpool_pantheonStatistics"; + return RpcMethod.TX_POOL_PANTHEON_STATISTICS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonTransactions.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonTransactions.java index 9a76d42c2d..2ecf2b5a9d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonTransactions.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/TxPoolPantheonTransactions.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.ethereum.eth.transactions.PendingTransactions; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -28,7 +29,7 @@ public TxPoolPantheonTransactions(final PendingTransactions pendingTransactions) @Override public String getName() { - return "txpool_pantheonTransactions"; + return RpcMethod.TX_POOL_PANTHEON_TRANSACTIONS.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3ClientVersion.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3ClientVersion.java index 7f0131d29a..a7c8590041 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3ClientVersion.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3ClientVersion.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcSuccessResponse; @@ -26,7 +27,7 @@ public Web3ClientVersion(final String clientVersion) { @Override public String getName() { - return "web3_clientVersion"; + return RpcMethod.WEB3_CLIENT_VERSION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3Sha3.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3Sha3.java index a91298b544..fe62ece54d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3Sha3.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/Web3Sha3.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods; import tech.pegasys.pantheon.crypto.Hash; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -26,7 +27,7 @@ public Web3Sha3() {} @Override public String getName() { - return "web3_sha3"; + return RpcMethod.WEB3_SHA3.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetCoinbase.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetCoinbase.java index 6782683c03..baf631e74a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetCoinbase.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetCoinbase.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; import tech.pegasys.pantheon.ethereum.core.Address; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -35,7 +36,7 @@ public MinerSetCoinbase( @Override public String getName() { - return "miner_setCoinbase"; + return RpcMethod.MINER_SET_COINBASE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetEtherbase.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetEtherbase.java index 899cdc7b0b..158a33a3ba 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetEtherbase.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerSetEtherbase.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.miner; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; @@ -27,7 +28,7 @@ public MinerSetEtherbase(final MinerSetCoinbase minerSetCoinbaseMethod) { @Override public String getName() { - return "miner_setEtherbase"; + return RpcMethod.MINER_SET_ETHERBASE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStart.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStart.java index 2d3031a930..35898e7b8a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStart.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStart.java @@ -14,6 +14,7 @@ import tech.pegasys.pantheon.ethereum.blockcreation.CoinbaseNotSetException; import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -31,7 +32,7 @@ public MinerStart(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "miner_start"; + return RpcMethod.MINER_START.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStop.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStop.java index f984ec84a9..892fe41378 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStop.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/miner/MinerStop.java @@ -13,6 +13,7 @@ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.miner; import tech.pegasys.pantheon.ethereum.blockcreation.MiningCoordinator; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcResponse; @@ -28,7 +29,7 @@ public MinerStop(final MiningCoordinator miningCoordinator) { @Override public String getName() { - return "miner_stop"; + return RpcMethod.MINER_STOP.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddAccountsToWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddAccountsToWhitelist.java index af47b1c86d..0b8b605f83 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddAccountsToWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddAccountsToWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -39,7 +40,7 @@ public PermAddAccountsToWhitelist( @Override public String getName() { - return "perm_addAccountsToWhitelist"; + return RpcMethod.PERM_ADD_ACCOUNTS_TO_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelist.java index 48322fb319..025fd35f05 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermAddNodesToWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -41,7 +42,7 @@ public PermAddNodesToWhitelist( @Override public String getName() { - return "perm_addNodesToWhitelist"; + return RpcMethod.PERM_ADD_NODES_TO_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetAccountsWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetAccountsWhitelist.java index ae9244cd5f..b8a991966d 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetAccountsWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetAccountsWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -32,7 +33,7 @@ public PermGetAccountsWhitelist(final Optional white @Override public String getName() { - return "perm_getAccountsWhitelist"; + return RpcMethod.PERM_GET_ACCOUNTS_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelist.java index a521d1ad2f..a3f79e52d8 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermGetNodesWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -36,7 +37,7 @@ public PermGetNodesWhitelist( @Override public String getName() { - return "perm_getNodesWhitelist"; + return RpcMethod.PERM_GET_NODES_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermReloadPermissionsFromFile.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermReloadPermissionsFromFile.java index be7618cc33..e84834dcd7 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermReloadPermissionsFromFile.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermReloadPermissionsFromFile.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; @@ -37,7 +38,7 @@ public PermReloadPermissionsFromFile( @Override public String getName() { - return "perm_reloadPermissionsFromFile"; + return RpcMethod.PERM_RELOAD_PERMISSIONS_FROM_FILE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromWhitelist.java index 2d8d8a9e7b..16c31a7bcb 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveAccountsFromWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -39,7 +40,7 @@ public PermRemoveAccountsFromWhitelist( @Override public String getName() { - return "perm_removeAccountsFromWhitelist"; + return RpcMethod.PERM_REMOVE_ACCOUNTS_FROM_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelist.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelist.java index 4b60e29678..a972cd9a97 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelist.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/permissioning/PermRemoveNodesFromWhitelist.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.permissioning; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -41,7 +42,7 @@ public PermRemoveNodesFromWhitelist( @Override public String getName() { - return "perm_removeNodesFromWhitelist"; + return RpcMethod.PERM_REMOVE_NODES_FROM_WHITELIST.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionCount.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionCount.java index f3b12991c4..9d718e553a 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionCount.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionCount.java @@ -16,6 +16,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.MutableWorldState; import tech.pegasys.pantheon.ethereum.core.PrivacyParameters; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -43,7 +44,7 @@ public EeaGetTransactionCount( @Override public String getName() { - return "eea_getTransactionCount"; + return RpcMethod.EEA_GET_TRANSACTION_COUNT.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionReceipt.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionReceipt.java index 2a294bb04d..c2813d2e08 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionReceipt.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaGetTransactionReceipt.java @@ -25,6 +25,7 @@ import tech.pegasys.pantheon.ethereum.core.Log; import tech.pegasys.pantheon.ethereum.core.PrivacyParameters; import tech.pegasys.pantheon.ethereum.core.Transaction; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.parameters.JsonRpcParameter; @@ -70,12 +71,12 @@ public EeaGetTransactionReceipt( @Override public String getName() { - return "eea_getTransactionReceipt"; + return RpcMethod.EEA_GET_TRANSACTION_RECEIPT.getMethodName(); } @Override public JsonRpcResponse response(final JsonRpcRequest request) { - LOG.trace("Executing eea_getTransactionReceipt"); + LOG.trace("Executing {}", RpcMethod.EEA_GET_TRANSACTION_RECEIPT.getMethodName()); final Hash transactionHash = parameters.required(request.getParams(), 0, Hash.class); final Optional maybeLocation = blockchain.getBlockchain().getTransactionLocation(transactionHash); diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaSendRawTransaction.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaSendRawTransaction.java index c6b6ebc012..541b04064e 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaSendRawTransaction.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/methods/privacy/EeaSendRawTransaction.java @@ -18,6 +18,7 @@ import tech.pegasys.pantheon.ethereum.core.Address; import tech.pegasys.pantheon.ethereum.core.Transaction; import tech.pegasys.pantheon.ethereum.eth.transactions.TransactionPool; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.exception.InvalidJsonRpcRequestException; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.methods.JsonRpcMethod; @@ -62,7 +63,7 @@ public EeaSendRawTransaction( @Override public String getName() { - return "eea_sendRawTransaction"; + return RpcMethod.EEA_SEND_RAW_TRANSACTION.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java index d79b946954..701f7df3c8 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/internal/response/JsonRpcError.java @@ -25,6 +25,7 @@ public enum JsonRpcError { METHOD_NOT_FOUND(-32601, "Method not found"), INVALID_PARAMS(-32602, "Invalid params"), INTERNAL_ERROR(-32603, "Internal error"), + METHOD_NOT_ENABLED(-32604, "Method not enabled"), // P2P related errors P2P_DISABLED(-32000, "P2P has been disabled. This functionality is not available"), diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthSubscribe.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthSubscribe.java index e0f71e9531..3ca521bd94 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthSubscribe.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthSubscribe.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.websocket.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -32,7 +33,7 @@ public class EthSubscribe extends AbstractSubscriptionMethod { @Override public String getName() { - return "eth_subscribe"; + return RpcMethod.ETH_SUBSCRIBE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthUnsubscribe.java b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthUnsubscribe.java index b1385d64db..0d37e02ed0 100644 --- a/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthUnsubscribe.java +++ b/ethereum/jsonrpc/src/main/java/tech/pegasys/pantheon/ethereum/jsonrpc/websocket/methods/EthUnsubscribe.java @@ -12,6 +12,7 @@ */ package tech.pegasys.pantheon.ethereum.jsonrpc.websocket.methods; +import tech.pegasys.pantheon.ethereum.jsonrpc.RpcMethod; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.JsonRpcRequest; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcError; import tech.pegasys.pantheon.ethereum.jsonrpc.internal.response.JsonRpcErrorResponse; @@ -32,7 +33,7 @@ public class EthUnsubscribe extends AbstractSubscriptionMethod { @Override public String getName() { - return "eth_unsubscribe"; + return RpcMethod.ETH_UNSUBSCRIBE.getMethodName(); } @Override diff --git a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceRpcApisTest.java b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceRpcApisTest.java index fd6e6b9a4b..8f08302be7 100644 --- a/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceRpcApisTest.java +++ b/ethereum/jsonrpc/src/test/java/tech/pegasys/pantheon/ethereum/jsonrpc/JsonRpcHttpServiceRpcApisTest.java @@ -142,7 +142,7 @@ public void requestWithNetMethodShouldFailWhenNetApiIsNotEnabled() throws Except assertThat(resp.code()).isEqualTo(400); // Check general format of result final JsonObject json = new JsonObject(resp.body().string()); - final JsonRpcError expectedError = JsonRpcError.METHOD_NOT_FOUND; + final JsonRpcError expectedError = JsonRpcError.METHOD_NOT_ENABLED; testHelper.assertValidJsonRpcError( json, id, expectedError.getCode(), expectedError.getMessage()); }