Skip to content

Commit

Permalink
1545 Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kladkogex committed Nov 19, 2024
1 parent 3bc2048 commit 32c6e6c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/unittests/libweb3jsonrpc/jsonrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1835,6 +1835,8 @@ BOOST_AUTO_TEST_CASE( recalculateExternalGas ) {

std::string txHash = fixture.rpcClient->eth_sendTransaction( create );
dev::eth::mineTransaction( *( fixture.client ), 1 );

fixture.client->state().getOriginalDb()->createBlockSnap( 2 );
Json::Value receipt = fixture.rpcClient->eth_getTransactionReceipt( txHash );
BOOST_REQUIRE( receipt["status"].asString() == "0x1" );
std::string contractAddress = receipt["contractAddress"].asString();
Expand All @@ -1855,10 +1857,12 @@ BOOST_AUTO_TEST_CASE( recalculateExternalGas ) {

txHash = fixture.rpcClient->eth_sendRawTransaction( dev::toHex( t.toBytes() ) );
dev::eth::mineTransaction( *( fixture.client ), 1 );
fixture.client->state().getOriginalDb()->createBlockSnap( 3 );
receipt = fixture.rpcClient->eth_getTransactionReceipt( txHash );

BOOST_REQUIRE( receipt["status"].asString() == "0x0" );
BOOST_REQUIRE( receipt["gasUsed"].asString() == "0x61cb" );

BOOST_REQUIRE( receipt["status"].asString() == "0x1" );
BOOST_REQUIRE( receipt["gasUsed"].asString() == "0x13ef4" );

sleep(10);

Expand All @@ -1873,6 +1877,8 @@ BOOST_AUTO_TEST_CASE( recalculateExternalGas ) {
txHash = fixture.rpcClient->eth_sendTransaction( refill );
dev::eth::mineTransaction( *( fixture.client ), 1 );

fixture.client->state().getOriginalDb()->createBlockSnap( 4 );

// send txn to a contract from another suspicious account
// store( 4 )
txn["from"] = "0x5cdb7527ec85022991D4e27F254C438E8337ad7E";
Expand All @@ -1888,10 +1894,11 @@ BOOST_AUTO_TEST_CASE( recalculateExternalGas ) {

txHash = fixture.rpcClient->eth_sendRawTransaction( dev::toHex( t.toBytes() ) );
dev::eth::mineTransaction( *( fixture.client ), 1 );
fixture.client->state().getOriginalDb()->createBlockSnap( 5 );
receipt = fixture.rpcClient->eth_getTransactionReceipt( txHash );

BOOST_REQUIRE( receipt["status"].asString() == "0x1" );
BOOST_REQUIRE( receipt["gasUsed"].asString() == "0x13ef4" );
BOOST_REQUIRE( receipt["gasUsed"].asString() == "0x8f2c" );
}

BOOST_AUTO_TEST_CASE( skipTransactionExecution ) {
Expand Down

0 comments on commit 32c6e6c

Please sign in to comment.