From 96e950d720dbc2a990c5d3b52ba35ed098cf6543 Mon Sep 17 00:00:00 2001 From: Niven Date: Mon, 23 Oct 2023 14:36:11 +0800 Subject: [PATCH] Add defi-cli support for web3 RPCs and debug RPCs (#2606) * Add defi-cli support for web3 RPCs and debug RPCs * Add dumpdb * Add RPCs to test node --- src/defi-cli.cpp | 2 +- src/rpc/client.cpp | 8 ++++++++ test/functional/test_framework/test_node.py | 6 +++++- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/defi-cli.cpp b/src/defi-cli.cpp index 691d5b5593c..5b4a0393e34 100644 --- a/src/defi-cli.cpp +++ b/src/defi-cli.cpp @@ -327,7 +327,7 @@ static UniValue CallRPC(BaseRequestHandler *rh, const std::string& strMethod, co // Check if DVM or EVM RPC int port = dvmport; - if (strMethod.rfind("eth_", 0) == 0 || strMethod.rfind("debug_", 0) == 0 || strMethod.rfind("net_", 0) == 0) + if (strMethod.rfind("eth_", 0) == 0 || strMethod.rfind("debug_", 0) == 0 || strMethod.rfind("net_", 0) == 0 || strMethod.rfind("web3_", 0) == 0) port = evmport; // Obtain event base diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 9a7f20c97c0..82ff754ceea 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -410,6 +410,14 @@ static const CRPCConvertParam vRPCConvertParams[] = { "eth_getTransactionByBlockHashAndIndex", 1, "txIndex"}, { "eth_getTransactionByBlockNumberAndIndex", 0, "tag"}, { "eth_getTransactionByBlockNumberAndIndex", 1, "txIndex"}, + + { "debug_traceTransaction", 0, "object"}, + { "debug_dumpdb", 0, "dump"}, + { "debug_dumpdb", 1, "from"}, + { "debug_dumpdb", 2, "limit"}, + { "debug_feeEstimate", 0, "tx"}, + + { "web3_sha", 0, "input"}, }; /** diff --git a/test/functional/test_framework/test_node.py b/test/functional/test_framework/test_node.py index 30d2257ccea..5a95672f1d6 100755 --- a/test/functional/test_framework/test_node.py +++ b/test/functional/test_framework/test_node.py @@ -279,10 +279,14 @@ def __init__( # net "net_version", # debug + "debug_traceTransaction", + "debug_dumpdb", + "debug_logaccountstates", + "debug_logblocktemplates", "debug_feeEstimate", - "debug_logqueues", # web3 "web3_clientVersion", + "web3_sha3", } def get_genesis_keys(self):