Skip to content

Commit

Permalink
Merge branch 'develop' into bug/remove-docker
Browse files Browse the repository at this point in the history
  • Loading branch information
dimalit authored Sep 11, 2023
2 parents 82659fe + 79dfc4a commit 116a5ff
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
16 changes: 10 additions & 6 deletions test/unittests/libethereum/TransactionQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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 ) {
Expand Down
20 changes: 11 additions & 9 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,22 +795,23 @@ 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))
BOOST_AUTO_TEST_CASE( logs_range ) {
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";
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 116a5ff

Please sign in to comment.