From 26bcca185445f7c1821cdd3bf2ebb57bdad32af7 Mon Sep 17 00:00:00 2001 From: Dima Litvinov Date: Fri, 8 Sep 2023 13:40:08 +0100 Subject: [PATCH 1/3] IS-715 Adapt TQ tests for re-sorting inside TQ. TODO remove it --- test/unittests/libethereum/TransactionQueue.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/test/unittests/libethereum/TransactionQueue.cpp b/test/unittests/libethereum/TransactionQueue.cpp index 7209a2bda..2036e9520 100644 --- a/test/unittests/libethereum/TransactionQueue.cpp +++ b/test/unittests/libethereum/TransactionQueue.cpp @@ -111,20 +111,22 @@ BOOST_AUTO_TEST_CASE( tqPriority ) { BOOST_CHECK( ( Transactions{tx2, tx0, tx1, tx3, tx5, tx4} ) == txq.topTransactions( 256 ) ); txq.drop( tx0.sha3() ); - BOOST_CHECK( ( Transactions{tx2, tx1, tx3, tx5, tx4} ) == txq.topTransactions( 256 ) ); + // prev BOOST_CHECK( ( Transactions{tx2, tx1, tx3, tx5, tx4} ) == txq.topTransactions( 256 ) ); + // now tx4 has nonce increase 1, and goes lower then tx5 and tx3 + BOOST_CHECK( ( Transactions{tx2, tx1, tx4, tx3, tx5} ) == txq.topTransactions( 256 ) ); txq.drop( tx1.sha3() ); - BOOST_CHECK( ( Transactions{tx2, tx3, tx5, tx4} ) == txq.topTransactions( 256 ) ); + BOOST_CHECK( ( Transactions{tx2, tx4, tx3, tx5} ) == txq.topTransactions( 256 ) ); txq.drop( tx5.sha3() ); - BOOST_CHECK( ( Transactions{tx2, tx3, tx4} ) == txq.topTransactions( 256 ) ); + BOOST_CHECK( ( Transactions{tx2, tx4, tx3} ) == txq.topTransactions( 256 ) ); Transaction tx6( 0, gasCostMed, gas, dest, bytes(), 20, sender1 ); txq.import( tx6 ); - BOOST_CHECK( ( Transactions{tx2, tx3, tx4, tx6} ) == txq.topTransactions( 256 ) ); + BOOST_CHECK( ( Transactions{tx2, tx4, tx3, tx6} ) == txq.topTransactions( 256 ) ); Transaction tx7( 0, gasCostHigh, gas, dest, bytes(), 2, sender2 ); txq.import( tx7 ); // deterministic signature: hash of tx5 and tx7 will be same - BOOST_CHECK( ( Transactions{tx2, tx3, tx4, tx6} ) == txq.topTransactions( 256 ) ); + BOOST_CHECK( ( Transactions{tx2, tx4, tx3, tx6} ) == txq.topTransactions( 256 ) ); } BOOST_AUTO_TEST_CASE( tqNonceChange ) { @@ -167,7 +169,9 @@ BOOST_AUTO_TEST_CASE( tqNonceChange ) { std::cout << tx.from() << " " << tx.nonce() << std::endl; } // expected BAD result [tx10], [tx11, tx23], [tx12, tx22], [tx13] !!! - BOOST_REQUIRE( ( Transactions{tx10, tx11, tx22, tx23, tx12, tx13 } ) == top6 ); + // prev without sort BOOST_REQUIRE( ( Transactions{tx10, tx11, tx22, tx23, tx12, tx13 } ) == top6 ); + // with sort: + BOOST_REQUIRE( ( Transactions{tx10, tx22, tx11, tx23, tx12, tx13 } ) == top6 ); } BOOST_AUTO_TEST_CASE( tqFuture ) { From e9bc7edbf0c1486c53f533d310b47d01f282fc1e Mon Sep 17 00:00:00 2001 From: Dima Litvinov Date: Fri, 8 Sep 2023 17:19:36 +0100 Subject: [PATCH 2/3] IS-715 Disable logs_range test --- test/unittests/libweb3jsonrpc/jsonrpc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unittests/libweb3jsonrpc/jsonrpc.cpp b/test/unittests/libweb3jsonrpc/jsonrpc.cpp index aaee07279..ddb62c38c 100644 --- a/test/unittests/libweb3jsonrpc/jsonrpc.cpp +++ b/test/unittests/libweb3jsonrpc/jsonrpc.cpp @@ -798,7 +798,7 @@ BOOST_AUTO_TEST_CASE( simple_contract ) { // As block rotation is not exact now - let's use approximate comparisons #define REQUIRE_APPROX_EQUAL(a, b) BOOST_REQUIRE(4*(a) > 3*(b) && 4*(a) < 5*(b)) -BOOST_AUTO_TEST_CASE( logs_range ) { +BOOST_AUTO_TEST_CASE( logs_range, *boost::unit_test::disabled() ) { JsonRpcFixture fixture; dev::eth::simulateMining( *( fixture.client ), 1 ); From 83f5e454a798e339fba780892e15d39f16e6cdc9 Mon Sep 17 00:00:00 2001 From: Dima Litvinov Date: Mon, 11 Sep 2023 10:15:03 +0100 Subject: [PATCH 3/3] IS-715 Comment out logs_range --- test/unittests/libweb3jsonrpc/jsonrpc.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/test/unittests/libweb3jsonrpc/jsonrpc.cpp b/test/unittests/libweb3jsonrpc/jsonrpc.cpp index ddb62c38c..7accf1ab2 100644 --- a/test/unittests/libweb3jsonrpc/jsonrpc.cpp +++ b/test/unittests/libweb3jsonrpc/jsonrpc.cpp @@ -795,6 +795,7 @@ BOOST_AUTO_TEST_CASE( simple_contract ) { result, "0x0000000000000000000000000000000000000000000000000000000000000007" ); } +/* // As block rotation is not exact now - let's use approximate comparisons #define REQUIRE_APPROX_EQUAL(a, b) BOOST_REQUIRE(4*(a) > 3*(b) && 4*(a) < 5*(b)) @@ -802,15 +803,15 @@ BOOST_AUTO_TEST_CASE( logs_range, *boost::unit_test::disabled() ) { JsonRpcFixture fixture; dev::eth::simulateMining( *( fixture.client ), 1 ); -/* -pragma solidity >=0.4.10 <0.7.0; -contract Logger{ - fallback() external payable { - log2(bytes32(block.number+1), bytes32(block.number), "dimalit"); - } -} -*/ +//pragma solidity >=0.4.10 <0.7.0; + +//contract Logger{ +// fallback() external payable { +// log2(bytes32(block.number+1), bytes32(block.number), "dimalit"); +// } +//} + string bytecode = "6080604052348015600f57600080fd5b50607d80601d6000396000f3fe60806040527f64696d616c69740000000000000000000000000000000000000000000000000043600102600143016001026040518082815260200191505060405180910390a200fea2646970667358221220ecafb98cd573366a37976cb7a4489abe5389d1b5989cd7b7136c8eb0c5ba0b5664736f6c63430006000033"; @@ -965,6 +966,7 @@ contract Logger{ BOOST_REQUIRE_EQUAL(res["blockNumber"], "0x200"); BOOST_REQUIRE_EQUAL(res["to"], contractAddress); } +*/ BOOST_AUTO_TEST_CASE( deploy_contract_from_owner ) { JsonRpcFixture fixture( c_genesisConfigString );