seal: Change prefix and module name from "ext_" to "seal_" for contract callable functions (#6798)

* seal: Change prefix "ext_" to "seal_" for contract callable functions

The word Ext is a overloaded term in the context of substrate. It usually
is a trait which abstracts away access to external resources usually in order
to mock them away for the purpose of tests. The contract module has its own
`Ext` trait in addition the the substrate `Ext` which makes things even more
confusing.

In order to differentiate the contract callable functions more clearly from
this `Ext` concept we rename them to use the "seal_" prefix instead.

This should change no behaviour at all. This is a pure renaming commit.

* seal: Rename import module from "env" to "seal0"

* seal: Fixup integration test

* seal: Add more tests for new import module names
This commit is contained in:
Alexander Theißen
2020-08-10 15:14:34 +02:00
committed by GitHub
parent f9f8262303
commit 04b185e3d4
29 changed files with 355 additions and 303 deletions
+5 -5
View File
@@ -58,9 +58,9 @@ pub enum TransactorKind {
/// Output of a contract call or instantiation which ran to completion.
#[cfg_attr(test, derive(PartialEq, Eq, Debug))]
pub struct ExecReturnValue {
/// Flags passed along by `ext_return`. Empty when `ext_return` was never called.
/// Flags passed along by `seal_return`. Empty when `seal_return` was never called.
pub flags: ReturnFlags,
/// Buffer passed along by `ext_return`. Empty when `ext_return` was never called.
/// Buffer passed along by `seal_return`. Empty when `seal_return` was never called.
pub data: Vec<u8>,
}
@@ -355,7 +355,7 @@ where
// `collect_rent` will be done on first call and destination contract and balance
// cannot be changed before the first call
// We do not allow 'calling' plain accounts. For transfering value
// `ext_transfer` must be used.
// `seal_transfer` must be used.
let contract = if let Some(ContractInfo::Alive(info)) = rent::collect_rent::<T>(&dest) {
info
} else {
@@ -455,7 +455,7 @@ where
// We need each contract that exists to be above the subsistence threshold
// in order to keep up the guarantuee that we always leave a tombstone behind
// with the exception of a contract that called `ext_terminate`.
// with the exception of a contract that called `seal_terminate`.
if T::Currency::total_balance(&dest) < nested.config.subsistence_threshold() {
Err(Error::<T>::NewContractNotFunded)?
}
@@ -599,7 +599,7 @@ fn transfer<'a, T: Trait, V: Vm<T>, L: Loader<T>>(
Err(Error::<T>::OutOfGas)?
}
// Only ext_terminate is allowed to bring the sender below the subsistence
// Only seal_terminate is allowed to bring the sender below the subsistence
// threshold or even existential deposit.
let existence_requirement = match (cause, origin) {
(Terminate, _) => ExistenceRequirement::AllowDeath,