Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

contracts: New contract events + unconfusions #4685

Merged
merged 9 commits into from
Jan 21, 2020
Next Next commit
contracts: during execution -> contract trapped during execution
This message confused many people so we are improving it to make clear what happened.
  • Loading branch information
Robbepop committed Jan 20, 2020
commit 3d2ba05f2cff52a664644ffebca526c84e08ee5f
6 changes: 3 additions & 3 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ fn dispatch_call_not_dispatched_after_top_level_transaction_failure() {
100_000,
vec![],
),
"during execution"
"contract trapped during execution"
);
assert_eq!(System::events(), vec![
EventRecord {
Expand Down Expand Up @@ -1533,7 +1533,7 @@ fn storage_max_value_limit() {
100_000,
Encode::encode(&(self::MaxValueSize::get() + 1)),
),
"during execution"
"contract trapped during execution"
);
});
}
Expand Down Expand Up @@ -2056,7 +2056,7 @@ fn cannot_self_destruct_while_live() {
100_000,
vec![0],
),
"during execution"
"contract trapped during execution"
);

// Check that BOB is still alive.
Expand Down
4 changes: 2 additions & 2 deletions frame/contracts/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1430,7 +1430,7 @@ mod tests {
MockExt::default(),
&mut gas_meter
),
Err(ExecError { reason: DispatchError::Other("during execution"), buffer: _ })
Err(ExecError { reason: DispatchError::Other("contract trapped during execution"), buffer: _ })
);
}

Expand Down Expand Up @@ -1472,7 +1472,7 @@ mod tests {
MockExt::default(),
&mut gas_meter
),
Err(ExecError { reason: DispatchError::Other("during execution"), buffer: _ })
Err(ExecError { reason: DispatchError::Other("contract trapped during execution"), buffer: _ })
);
}

Expand Down
2 changes: 1 addition & 1 deletion frame/contracts/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ pub(crate) fn to_execution_result<E: Ext>(
Err(ExecError { reason: "validation error".into(), buffer: runtime.scratch_buf }),
// Any other kind of a trap should result in a failure.
Err(sp_sandbox::Error::Execution) | Err(sp_sandbox::Error::OutOfBounds) =>
Err(ExecError { reason: "during execution".into(), buffer: runtime.scratch_buf }),
Err(ExecError { reason: "contract trapped during execution".into(), buffer: runtime.scratch_buf }),
}
}

Expand Down