Skip to content

Commit

Permalink
Merge pull request #1997 from skalenetwork/bug/SKALED-1951-broken-all…
Browse files Browse the repository at this point in the history
…-tests

Bug/skaled 1951 broken all tests
  • Loading branch information
DmytroNazarenko authored Oct 3, 2024
2 parents a486b0b + e96df22 commit 244bcb8
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
4 changes: 3 additions & 1 deletion libethcore/ChainOperationParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,10 @@ EVMSchedule const ChainOperationParams::makeEvmSchedule(
result = EIP158Schedule;
else if ( _workingBlockNumber >= EIP150ForkBlock )
result = EIP150Schedule;
else if ( _workingBlockNumber >= homesteadForkBlock )
return HomesteadSchedule;
else
result = HomesteadSchedule;
return FrontierSchedule;

// 2 based on previous - decide by timestamp
if ( PushZeroPatch::isEnabledWhen( _committedBlockTimestamp ) )
Expand Down
2 changes: 2 additions & 0 deletions libethcore/EVMSchedule.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct EVMSchedule {
};

static const EVMSchedule DefaultSchedule = EVMSchedule();
// Used only in GeneralStateTests --all tests
static const EVMSchedule FrontierSchedule = EVMSchedule( false, false, 21000 );
static const EVMSchedule HomesteadSchedule = EVMSchedule( true, true, 53000 );

static const EVMSchedule EIP150Schedule = [] {
Expand Down
2 changes: 1 addition & 1 deletion libethereum/Transaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Transaction : public TransactionBase {

void ignoreExternalGas() {
m_externalGasIsChecked = true;
m_externalGas = 0;
m_externalGas.reset();
}

private:
Expand Down
4 changes: 0 additions & 4 deletions test/tools/jsontests/BlockChainTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1111,10 +1111,6 @@ BOOST_AUTO_TEST_CASE( stZeroCallsTest,
*boost::unit_test::precondition( dev::test::run_not_express ) ) {}
BOOST_AUTO_TEST_CASE( stZeroCallsRevert,
*boost::unit_test::precondition( dev::test::run_not_express ) ) {}
BOOST_AUTO_TEST_CASE( stCodeSizeLimit,
*boost::unit_test::precondition( dev::test::run_not_express ) ) {}
BOOST_AUTO_TEST_CASE( stCreateTest,
*boost::unit_test::precondition( dev::test::run_not_express ) ) {}
BOOST_AUTO_TEST_CASE( stRevertTest,
*boost::unit_test::precondition( dev::test::run_not_express ) ) {}

Expand Down
3 changes: 3 additions & 0 deletions test/tools/libtesteth/ImportTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ void ImportTest::importTransaction( json_spirit::mObject const& _o, eth::Transac
toInt( _o.at( "gasLimit" ) ), Address( _o.at( "to" ).get_str() ),
importData( _o ), toInt( _o.at( "nonce" ) ),
Secret( _o.at( "secretKey" ).get_str() ) );
o_tr.ignoreExternalGas();
} else {
requireJsonFields( _o, "transaction",
{{"data", jsonVType::str_type}, {"gasLimit", jsonVType::str_type},
Expand All @@ -429,6 +430,7 @@ void ImportTest::importTransaction( json_spirit::mObject const& _o, eth::Transac
RLP transactionRLP( transactionRLPStream.out() );
try {
o_tr = Transaction( transactionRLP.data(), CheckTransaction::Everything );
o_tr.ignoreExternalGas();
} catch ( InvalidSignature const& ) {
// create unsigned transaction
o_tr = _o.at( "to" ).get_str().empty() ?
Expand All @@ -438,6 +440,7 @@ void ImportTest::importTransaction( json_spirit::mObject const& _o, eth::Transac
Transaction( toInt( _o.at( "value" ) ), toInt( _o.at( "gasPrice" ) ),
toInt( _o.at( "gasLimit" ) ), Address( _o.at( "to" ).get_str() ),
importData( _o ), toInt( _o.at( "nonce" ) ) );
o_tr.ignoreExternalGas();
} catch ( Exception& _e ) {
cnote << "invalid transaction" << boost::diagnostic_information( _e );
}
Expand Down
2 changes: 1 addition & 1 deletion test/tools/libtestutils/Common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ boost::filesystem::path dev::test::getTestPath() {
return Options::get().testpath;

string testPath;
const char* ptestPath = getenv( "ETHEREUM_TEST_PATH" );
static const char* ptestPath = getenv( "ETHEREUM_TEST_PATH" );

if ( ptestPath == nullptr ) {
clog( VerbosityDebug, "test" )
Expand Down
10 changes: 5 additions & 5 deletions test/unittests/libdevcore/CommonJS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,26 @@ BOOST_AUTO_TEST_CASE( test_jsToFixed, *boost::unit_test::precondition( dev::test
"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ) );
h256 b( "0x000000000000000000000000000000000000000000000000000000740c54b42f" );
BOOST_CHECK( b == jsToFixed< 32 >( "498423084079" ) );
BOOST_CHECK( h256() == jsToFixed< 32 >( "NotAHexadecimalOrDecimal" ) );
BOOST_CHECK_THROW( jsToFixed< 32 >( "NotAHexadecimalOrDecimal" ), std::invalid_argument );
}

BOOST_AUTO_TEST_CASE( test_jsToInt, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_CHECK( 43832124 == jsToInt( "43832124" ) );
BOOST_CHECK( 1342356623 == jsToInt( "0x5002bc8f" ) );
BOOST_CHECK( 3483942 == jsToInt( "015224446" ) );
BOOST_CHECK( 0 == jsToInt( "NotAHexadecimalOrDecimal" ) );
BOOST_CHECK_THROW( jsToInt( "NotAHexadecimalOrDecimal" ), std::invalid_argument );

BOOST_CHECK( u256( "983298932490823474234" ) == jsToInt< 32 >( "983298932490823474234" ) );
BOOST_CHECK( u256( "983298932490823474234" ) == jsToInt< 32 >( "0x354e03915c00571c3a" ) );
BOOST_CHECK( u256() == jsToInt< 32 >( "NotAHexadecimalOrDecimal" ) );
BOOST_CHECK_THROW( jsToInt< 32 >( "NotAHexadecimalOrDecimal" ), std::invalid_argument );
BOOST_CHECK( u128( "228273101986715476958866839113050921216" ) ==
jsToInt< 16 >( "0xabbbccddeeff11223344556677889900" ) );
BOOST_CHECK( u128() == jsToInt< 16 >( "NotAHexadecimalOrDecimal" ) );
BOOST_CHECK_THROW( jsToInt< 16 >( "NotAHexadecimalOrDecimal" ), std::invalid_argument );
}

BOOST_AUTO_TEST_CASE( test_jsToU256, *boost::unit_test::precondition( dev::test::run_not_express ) ) {
BOOST_CHECK( u256( "983298932490823474234" ) == jsToU256( "983298932490823474234" ) );
BOOST_CHECK( u256() == jsToU256( "NotAHexadecimalOrDecimal" ) );
BOOST_CHECK_THROW( jsToU256( "NotAHexadecimalOrDecimal" ), std::invalid_argument );
}

BOOST_AUTO_TEST_SUITE_END()

0 comments on commit 244bcb8

Please sign in to comment.