Skip to content

Commit

Permalink
Merge pull request #75 from eosnetworkfoundation/yarkin/test_fix2
Browse files Browse the repository at this point in the history
Multiple fixes to test codes
  • Loading branch information
yarkinwho authored Oct 17, 2023
2 parents 6785528 + 0b59009 commit abbfaed
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
4 changes: 3 additions & 1 deletion cmd/test/ethereum.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ static const std::vector<fs::path> kSlowTests{
kBlockchainDir / "GeneralStateTests" / "VMTests" / "vmPerformance",
};

static const std::vector<fs::path> kFailingTests{};
static const std::vector<fs::path> kFailingTests{
kTransactionDir / "ttRSValue" / "TransactionWithRSvalue0.json",
};

static constexpr size_t kColumnWidth{80};

Expand Down
22 changes: 11 additions & 11 deletions silkworm/silkrpc/core/estimate_gas_oracle_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ TEST_CASE("estimate gas") {

SECTION("Call empty, always fails but success in last step") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _))
.Times(16)
.WillOnce(Return(expect_result_fail))
Expand Down Expand Up @@ -137,7 +137,7 @@ TEST_CASE("estimate gas") {

SECTION("Call empty, alternatively fails and succeeds") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _))
.Times(14)
.WillOnce(Return(expect_result_fail))
Expand All @@ -162,7 +162,7 @@ TEST_CASE("estimate gas") {

SECTION("Call empty, alternatively succeeds and fails") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _))
.Times(14)
.WillOnce(Return(expect_result_ok))
Expand All @@ -188,7 +188,7 @@ TEST_CASE("estimate gas") {
SECTION("Call with gas, always fails but succes last step") {
call.gas = kTxGas * 4;
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
EXPECT_CALL(estimate_gas_oracle, try_execution(_, _, _))
.Times(17)
.WillOnce(Return(expect_result_fail))
Expand Down Expand Up @@ -228,7 +228,7 @@ TEST_CASE("estimate gas") {

SECTION("Call with gas_price, gas not capped") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
call.gas = kTxGas * 2;
call.gas_price = intx::uint256{10'000};

Expand Down Expand Up @@ -258,7 +258,7 @@ TEST_CASE("estimate gas") {

SECTION("Call with gas_price, gas capped") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
call.gas = kTxGas * 2;
call.gas_price = intx::uint256{40'000};

Expand All @@ -285,7 +285,7 @@ TEST_CASE("estimate gas") {

SECTION("Call with gas_price and value, gas not capped") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
call.gas = kTxGas * 2;
call.gas_price = intx::uint256{10'000};
call.value = intx::uint256{500'000'000};
Expand Down Expand Up @@ -316,7 +316,7 @@ TEST_CASE("estimate gas") {

SECTION("Call with gas_price and value, gas capped") {
ExecutionResult expect_result_ok{.error_code = evmc_status_code::EVMC_SUCCESS};
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
call.gas = kTxGas * 2;
call.gas_price = intx::uint256{20'000};
call.value = intx::uint256{500'000'000};
Expand Down Expand Up @@ -364,7 +364,7 @@ TEST_CASE("estimate gas") {
}

SECTION("Call with too high value, exception") {
ExecutionResult expect_result_fail{.pre_check_error = "intrisic gas"};
ExecutionResult expect_result_fail{.pre_check_error = "intrinsic gas too low"};
call.value = intx::uint256{2'000'000'000};

try {
Expand All @@ -382,7 +382,7 @@ TEST_CASE("estimate gas") {
}

SECTION("Call fail, try exception") {
ExecutionResult expect_result_fail_pre_check{.error_code = 4, .pre_check_error = "intrinsic gas"};
ExecutionResult expect_result_fail_pre_check{.error_code = 4, .pre_check_error = "errors other than intrinsic gas too low"};
ExecutionResult expect_result_fail{.error_code = 4};
call.gas = kTxGas * 2;
call.gas_price = intx::uint256{20'000};
Expand All @@ -406,7 +406,7 @@ TEST_CASE("estimate gas") {
}

SECTION("Call fail, try exception with data") {
ExecutionResult expect_result_fail_pre_check{.error_code = 4, .pre_check_error = "intrinsic gas"};
ExecutionResult expect_result_fail_pre_check{.error_code = 4, .pre_check_error = "errors other than intrinsic gas too low"};
auto data = *silkworm::from_hex("2ac3c1d3e24b45c6c310534bc2dd84b5ed576335");
ExecutionResult expect_result_fail{.error_code = 4, .data = data};
call.gas = kTxGas * 2;
Expand Down
18 changes: 17 additions & 1 deletion silkworm/silkrpc/core/evm_trace_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,23 @@ TEST_CASE_METHOD(TraceCallExecutorTest, "TraceCallExecutor::trace_call precompil
"storage":{}
}
},
"trace": [],
"trace":[
{
"action":{
"callType":"call",
"from":"0x0a6bb546b9208cfab9e8fa2b9b2c042b18df7030",
"gas":"0x7148",
"input":"0x",
"to":"0x0000000000000000000000000000000000000009",
"value":"0x0"
},
"error":"",
"result":null,
"subtraces":0,
"traceAddress":[],
"type":"call"
}
],
"vmTrace": {
"code": "0x",
"ops": []
Expand Down

0 comments on commit abbfaed

Please sign in to comment.