Skip to content

Commit

Permalink
Merge branch 'master' into pvl/remove-obsolete-check
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar authored Oct 23, 2023
2 parents b405684 + 8597e7d commit 95dbca0
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/defi-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/rpc/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
};

/**
Expand Down
23 changes: 13 additions & 10 deletions test/functional/feature_address_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,15 +199,18 @@ def addressmap_valid_address_invalid_type_should_fail(self):
address = self.nodes[0].getnewaddress("", "legacy")
p2sh_address = self.nodes[0].getnewaddress("", "p2sh-segwit")
eth_address = self.nodes[0].getnewaddress("", "erc55")
assert_invalid = lambda *args: assert_raises_rpc_error(
assert_invalid_parameter = lambda *args: assert_raises_rpc_error(
-8, "Invalid type parameter", self.nodes[0].addressmap, *args
)
assert_invalid(address, 9)
assert_invalid(address, -1)
assert_invalid(eth_address, AddressConversionType.DVMToEVMAddress)
assert_invalid(address, AddressConversionType.EVMToDVMAddress)
assert_invalid(p2sh_address, AddressConversionType.DVMToEVMAddress)
assert_invalid(p2sh_address, AddressConversionType.DVMToEVMAddress)
assert_invalid_format = lambda *args: assert_raises_rpc_error(
-8, "Invalid address format", self.nodes[0].addressmap, *args
)
assert_invalid_parameter(address, 9)
assert_invalid_parameter(address, -1)
assert_invalid_format(eth_address, AddressConversionType.DVMToEVMAddress)
assert_invalid_format(address, AddressConversionType.EVMToDVMAddress)
assert_invalid_format(p2sh_address, AddressConversionType.DVMToEVMAddress)
assert_invalid_format(p2sh_address, AddressConversionType.DVMToEVMAddress)

def addressmap_invalid_address_should_fail(self):
self.rollback_to(self.start_block_height)
Expand All @@ -222,21 +225,21 @@ def addressmap_invalid_address_should_fail(self):
)
assert_raises_rpc_error(
-8,
"Invalid type parameter",
"Invalid address format",
self.nodes[0].addressmap,
eth_address,
AddressConversionType.DVMToEVMAddress,
)
assert_raises_rpc_error(
-8,
"Invalid type parameter",
"Invalid address format",
self.nodes[0].addressmap,
"test",
AddressConversionType.DVMToEVMAddress,
)
assert_raises_rpc_error(
-8,
"Invalid type parameter",
"Invalid address format",
self.nodes[0].addressmap,
"test",
AddressConversionType.EVMToDVMAddress,
Expand Down
6 changes: 5 additions & 1 deletion test/functional/test_framework/test_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 95dbca0

Please sign in to comment.