Updated tests after changing EVM version to Berlin

This commit is contained in:
hrkrshnn 2021-04-13 09:34:23 +02:00
parent d5564a0304
commit 180e00f56d
11 changed files with 43 additions and 41 deletions

View File

@ -635,7 +635,7 @@ BOOST_AUTO_TEST_CASE(selfbalance)
bytes code = compileFirstExpression(sourceCode, {}, {}); bytes code = compileFirstExpression(sourceCode, {}, {});
if (solidity::test::CommonOptions::get().evmVersion() == EVMVersion::istanbul()) if (solidity::test::CommonOptions::get().evmVersion().hasSelfBalance())
{ {
bytes expectation({uint8_t(Instruction::SELFBALANCE)}); bytes expectation({uint8_t(Instruction::SELFBALANCE)});
BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end()); BOOST_CHECK_EQUAL_COLLECTIONS(code.begin(), code.end(), expectation.begin(), expectation.end());

View File

@ -1065,9 +1065,11 @@ BOOST_AUTO_TEST_CASE(evm_version)
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"petersburg\"") != string::npos);
result = compile(inputForVersion("\"evmVersion\": \"istanbul\",")); result = compile(inputForVersion("\"evmVersion\": \"istanbul\","));
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos);
result = compile(inputForVersion("\"evmVersion\": \"berlin\","));
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos);
// test default // test default
result = compile(inputForVersion("")); result = compile(inputForVersion(""));
BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"istanbul\"") != string::npos); BOOST_CHECK(result["contracts"]["fileA"]["A"]["metadata"].asString().find("\"evmVersion\":\"berlin\"") != string::npos);
// test invalid // test invalid
result = compile(inputForVersion("\"evmVersion\": \"invalid\",")); result = compile(inputForVersion("\"evmVersion\": \"invalid\","));
BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested."); BOOST_CHECK(result["errors"][0]["message"].asString() == "Invalid EVM version requested.");

View File

@ -18,7 +18,7 @@ contract C {
// executionCost: 1308 // executionCost: 1308
// totalCost: 1261108 // totalCost: 1261108
// external: // external:
// a(): 1130 // a(): 2430
// b(uint256): infinite // b(uint256): infinite
// f1(uint256): infinite // f1(uint256): infinite
// f2(uint256[],string[],uint16,address): infinite // f2(uint256[],string[],uint16,address): infinite

View File

@ -21,8 +21,8 @@ contract C {
// executionCost: 715 // executionCost: 715
// totalCost: 681315 // totalCost: 681315
// external: // external:
// a(): 985 // a(): 2285
// b(uint256): 2052 // b(uint256): 4652
// f1(uint256): 307 // f1(uint256): 307
// f2(uint256[],string[],uint16,address): infinite // f2(uint256[],string[],uint16,address): infinite
// f3(uint16[],string[],uint16,address): infinite // f3(uint16[],string[],uint16,address): infinite

View File

@ -28,7 +28,7 @@ contract Large {
// executionCost: 942 // executionCost: 942
// totalCost: 905342 // totalCost: 905342
// external: // external:
// a(): 1175 // a(): 2475
// b(uint256): infinite // b(uint256): infinite
// f0(uint256): infinite // f0(uint256): infinite
// f1(uint256): infinite // f1(uint256): infinite

View File

@ -31,25 +31,25 @@ contract Large {
// executionCost: 300 // executionCost: 300
// totalCost: 256700 // totalCost: 256700
// external: // external:
// a(): 983 // a(): 2283
// b(uint256): 2337 // b(uint256): 4937
// f0(uint256): 366 // f0(uint256): 366
// f1(uint256): 41506 // f1(uint256): 47006
// f2(uint256): 21572 // f2(uint256): 24972
// f3(uint256): 21660 // f3(uint256): 25060
// f4(uint256): 21638 // f4(uint256): 25038
// f5(uint256): 21616 // f5(uint256): 25016
// f6(uint256): 21528 // f6(uint256): 24928
// f7(uint256): 21308 // f7(uint256): 24708
// f8(uint256): 21440 // f8(uint256): 24840
// f9(uint256): 21462 // f9(uint256): 24862
// g0(uint256): 606 // g0(uint256): 606
// g1(uint256): 41218 // g1(uint256): 46718
// g2(uint256): 21306 // g2(uint256): 24706
// g3(uint256): 21394 // g3(uint256): 24794
// g4(uint256): 21372 // g4(uint256): 24772
// g5(uint256): 21460 // g5(uint256): 24860
// g6(uint256): 21240 // g6(uint256): 24640
// g7(uint256): 21350 // g7(uint256): 24750
// g8(uint256): 21328 // g8(uint256): 24728
// g9(uint256): 21174 // g9(uint256): 24574

View File

@ -15,7 +15,7 @@ contract Medium {
// executionCost: 386 // executionCost: 386
// totalCost: 351786 // totalCost: 351786
// external: // external:
// a(): 1152 // a(): 2452
// b(uint256): infinite // b(uint256): infinite
// f1(uint256): infinite // f1(uint256): infinite
// f2(uint256): infinite // f2(uint256): infinite

View File

@ -18,12 +18,12 @@ contract Medium {
// executionCost: 190 // executionCost: 190
// totalCost: 146990 // totalCost: 146990
// external: // external:
// a(): 983 // a(): 2283
// b(uint256): 2095 // b(uint256): 4695
// f1(uint256): 41286 // f1(uint256): 46786
// f2(uint256): 21330 // f2(uint256): 24730
// f3(uint256): 21374 // f3(uint256): 24774
// g0(uint256): 364 // g0(uint256): 364
// g7(uint256): 21240 // g7(uint256): 24640
// g8(uint256): 21218 // g8(uint256): 24618
// g9(uint256): 21174 // g9(uint256): 24574

View File

@ -11,6 +11,6 @@ contract Small {
// totalCost: 114759 // totalCost: 114759
// external: // external:
// fallback: 129 // fallback: 129
// a(): 1107 // a(): 2407
// b(uint256): infinite // b(uint256): infinite
// f1(uint256): infinite // f1(uint256): infinite

View File

@ -14,6 +14,6 @@ contract Small {
// totalCost: 62111 // totalCost: 62111
// external: // external:
// fallback: 118 // fallback: 118
// a(): 961 // a(): 2261
// b(uint256): 1985 // b(uint256): 4585
// f1(uint256): 41220 // f1(uint256): 46720

View File

@ -15,9 +15,9 @@ contract C {
// optimize-yul: true // optimize-yul: true
// ---- // ----
// creation: // creation:
// codeDepositCost: 27000 // codeDepositCost: 27200
// executionCost: 81 // executionCost: 81
// totalCost: 27081 // totalCost: 27281
// external: // external:
// readX(): 2290 // readX(): 2290
// resetX(): 5116 // resetX(): 5116