From fe7f153fa02c3588fa08266501dd94c19a983eeb Mon Sep 17 00:00:00 2001 From: Arsenii Lyashenko Date: Sat, 11 Feb 2023 11:26:11 +0300 Subject: [PATCH] Resolve issue #1857 --- gtest/src/program.rs | 7 +------ pallets/gear/src/tests.rs | 41 ++++++++++++--------------------------- 2 files changed, 13 insertions(+), 35 deletions(-) diff --git a/gtest/src/program.rs b/gtest/src/program.rs index 15a3b6a93a0..5f2c3e381b8 100644 --- a/gtest/src/program.rs +++ b/gtest/src/program.rs @@ -526,14 +526,9 @@ mod tests { let log = run_result.log(); assert!(!log.is_empty()); - // TODO: fix this in #1857 assert!(log[0] .payload() - .starts_with(b"Reason is unknown. Possibly `unreachable` instruction is occurred")); - // assert!(log[0] - // .payload() - // .starts_with(b"'Invalid input, should be three IDs separated by - // comma'")); + .starts_with(b"'Invalid input, should be three IDs separated by comma'")); let run_result = prog.send(user_id, String::from("should_be_skipped")); diff --git a/pallets/gear/src/tests.rs b/pallets/gear/src/tests.rs index bc3cb7198cd..8ad0356f8ff 100644 --- a/pallets/gear/src/tests.rs +++ b/pallets/gear/src/tests.rs @@ -5649,20 +5649,15 @@ fn test_create_program_with_value_lt_ed() { // to send init message with value in invalid range. assert_total_dequeued(1); - // TODO: fix this in #1857 assert_failed( msg_id, - ActorExecutionErrorReason::Ext(TrapExplanation::Unknown), + ActorExecutionErrorReason::Ext(TrapExplanation::Core(ExtError::Message( + MessageError::InsufficientValue { + message_value: 499, + existential_deposit: 500, + }, + ))), ); - // assert_failed( - // msg_id, - // ActorExecutionErrorReason::Ext(TrapExplanation::Core(ExtError::Message( - // MessageError::InsufficientValue { - // message_value: 499, - // existential_deposit: 500, - // }, - // ))), - // ); }) } @@ -5735,20 +5730,15 @@ fn test_create_program_with_exceeding_value() { // to send init message with value more than program has. assert_total_dequeued(1); - // TODO: fix this in #1857 assert_failed( origin_msg_id, - ActorExecutionErrorReason::Ext(TrapExplanation::Unknown), + ActorExecutionErrorReason::Ext(TrapExplanation::Core(ExtError::Message( + MessageError::NotEnoughValue { + message_value: 1001, + value_left: 1000, + }, + ))), ); - // assert_failed( - // origin_msg_id, - // ActorExecutionErrorReason::Ext(TrapExplanation::Core(ExtError::Message( - // MessageError::NotEnoughValue { - // message_value: 1001, - // value_left: 1000, - // }, - // ))), - // ); }) } @@ -9157,17 +9147,10 @@ fn check_reply_push_payload_exceed() { run_to_block(2, None); assert_last_dequeued(1); - // TODO: fix this in #1857 assert_failed( message_id, ActorExecutionErrorReason::Ext(TrapExplanation::Unknown), ); - // assert_failed( - // message_id, - // ActorExecutionErrorReason::Ext(TrapExplanation::Core(ExtError::Message( - // MessageError::MaxMessageSizeExceed, - // ))), - // ); }); }