From c200761d41538c2b6ceaea7d00cc60141ab75062 Mon Sep 17 00:00:00 2001 From: Dmytro Nazarenko Date: Thu, 2 Nov 2023 12:40:27 +0000 Subject: [PATCH 1/4] Update VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3f67e25ce..7290025ec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -3.17.0 +3.17.2 From f013fac176f4e5d711fdd9d7e786990aca499cd5 Mon Sep 17 00:00:00 2001 From: DmytroNazarenko Date: Fri, 3 Nov 2023 17:14:44 +0000 Subject: [PATCH 2/4] #1526 Make net_version returns decimal number --- libweb3jsonrpc/Net.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libweb3jsonrpc/Net.cpp b/libweb3jsonrpc/Net.cpp index 8145dba5d..26ff582e6 100644 --- a/libweb3jsonrpc/Net.cpp +++ b/libweb3jsonrpc/Net.cpp @@ -35,7 +35,7 @@ Net::Net( const dev::eth::ChainParams& _chainParams ) : m_chainParams( _chainPar // TODO Ask here real values from consensus/broadcast std::string Net::net_version() { - return toJS( m_chainParams.chainID ); + return toString( m_chainParams.chainID ); } std::string Net::net_peerCount() { From 68798a76a529d9c92d33a7919b8d8f2d30d65033 Mon Sep 17 00:00:00 2001 From: DmytroNazarenko Date: Mon, 6 Nov 2023 13:42:37 +0000 Subject: [PATCH 3/4] Add unit test --- test/unittests/libweb3jsonrpc/jsonrpc.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/test/unittests/libweb3jsonrpc/jsonrpc.cpp b/test/unittests/libweb3jsonrpc/jsonrpc.cpp index 5ef568135..9e85c5d1a 100644 --- a/test/unittests/libweb3jsonrpc/jsonrpc.cpp +++ b/test/unittests/libweb3jsonrpc/jsonrpc.cpp @@ -40,7 +40,7 @@ #include #include #include -// SKALE #include +#include #include #include #include @@ -329,7 +329,7 @@ struct JsonRpcFixture : public TestOutputHelperFixture { else client->setAuthor( chainParams.sChain.blockAuthor ); - using FullServer = ModularServer< rpc::EthFace, /* rpc::NetFace,*/ rpc::Web3Face, + using FullServer = ModularServer< rpc::EthFace, rpc::NetFace, rpc::Web3Face, rpc::AdminEthFace /*, rpc::AdminNetFace*/, rpc::DebugFace, rpc::TestFace >; accountHolder.reset( new FixedAccountHolder( [&]() { return client.get(); }, {} ) ); @@ -343,7 +343,7 @@ struct JsonRpcFixture : public TestOutputHelperFixture { gasPricer = make_shared< eth::TrivialGasPricer >( 0, DefaultGasPrice ); - rpcServer.reset( new FullServer( ethFace /*, new rpc::Net(*web3)*/, + rpcServer.reset( new FullServer( ethFace , new rpc::Net( chainParams ), new rpc::Web3( /*web3->clientVersion()*/ ), // TODO Add real version? new rpc::AdminEth( *client, *gasPricer, keyManager, *sessionManager.get() ), /*new rpc::AdminNet(*web3, *sessionManager), */ new rpc::Debug( *client ), @@ -502,6 +502,23 @@ BOOST_AUTO_TEST_CASE( jsonrpc_number ) { // BOOST_CHECK_EQUAL(web3->isNetworkStarted(), false); //} +BOOST_AUTO_TEST_CASE( jsonrpc_netVersion ) +{ + std::string _config = c_genesisConfigString; + Json::Value ret; + Json::Reader().parse( _config, ret ); + + // Set chainID = 65535 + ret["params"]["chainID"] = "0xffff"; + + Json::FastWriter fastWriter; + std::string config = fastWriter.write( ret ); + JsonRpcFixture fixture( config ); + + auto version = jsToU256(fixture.rpcClient->net_version()); + BOOST_CHECK_EQUAL( version, 65535 ); +} + BOOST_AUTO_TEST_CASE( jsonrpc_setMining ) { JsonRpcFixture fixture; fixture.rpcClient->admin_eth_setMining( true, fixture.adminSession ); From 238665d54b4fda65327ebe8a591242e2ea8a0449 Mon Sep 17 00:00:00 2001 From: DmytroNazarenko Date: Mon, 6 Nov 2023 15:38:42 +0000 Subject: [PATCH 4/4] #1526 Update test --- test/unittests/libweb3jsonrpc/jsonrpc.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unittests/libweb3jsonrpc/jsonrpc.cpp b/test/unittests/libweb3jsonrpc/jsonrpc.cpp index 9e85c5d1a..22abf959a 100644 --- a/test/unittests/libweb3jsonrpc/jsonrpc.cpp +++ b/test/unittests/libweb3jsonrpc/jsonrpc.cpp @@ -515,8 +515,8 @@ BOOST_AUTO_TEST_CASE( jsonrpc_netVersion ) std::string config = fastWriter.write( ret ); JsonRpcFixture fixture( config ); - auto version = jsToU256(fixture.rpcClient->net_version()); - BOOST_CHECK_EQUAL( version, 65535 ); + auto version = fixture.rpcClient->net_version(); + BOOST_CHECK_EQUAL( version, "65535" ); } BOOST_AUTO_TEST_CASE( jsonrpc_setMining ) {