Skip to content

Commit

Permalink
Remove seal_ prefixes from FFI (#1482)
Browse files Browse the repository at this point in the history
* remove seal_ prefixes from FFI

* ui tests to match latest rust

* remove useless wrapper

* Revert "remove useless wrapper": it is useful, just fix it

This reverts commit f950f64.
  • Loading branch information
agryaznov authored Nov 11, 2022
1 parent 7789caf commit e883ce5
Show file tree
Hide file tree
Showing 13 changed files with 278 additions and 291 deletions.
6 changes: 3 additions & 3 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ like the following excerpt:
```rust
#[link(wasm_import_module = "seal0")]
extern "C" {
pub fn seal_get_storage(
pub fn get_storage(
key_ptr: Ptr32<[u8]>,
output_ptr: Ptr32Mut<[u8]>,
output_len_ptr: Ptr32Mut<u32>,
Expand All @@ -152,7 +152,7 @@ extern "C" {

#[link(wasm_import_module = "seal1")]
extern "C" {
pub fn seal_set_storage(
pub fn set_storage(
key_ptr: Ptr32<[u8]>,
value_ptr: Ptr32<[u8]>,
value_len: u32,
Expand All @@ -165,7 +165,7 @@ old API functions ‒ otherwise smart contracts that are deployed on-chain would

Hence there is this version mechanism. Functions start out at version `seal0` and for
each new released iteration of the function there is a new version of it introduced.
In the example above you can see that we changed the function `seal_set_storage` at
In the example above you can see that we changed the function `set_storage` at
one point.

The prefix `seal` here is for historic reasons. There is some analogy to sealing a
Expand Down
6 changes: 3 additions & 3 deletions crates/engine/src/ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ macro_rules! define_error_codes {
define_error_codes! {
/// The called function trapped and has its state changes reverted.
/// In this case no output buffer is returned.
/// Can only be returned from `seal_call` and `seal_instantiate`.
/// Can only be returned from `call` and `instantiate`.
CalleeTrapped = 1,
/// The called function ran to completion but decided to revert its state.
/// An output buffer is returned when one was supplied.
/// Can only be returned from `seal_call` and `seal_instantiate`.
/// Can only be returned from `call` and `instantiate`.
CalleeReverted = 2,
/// The passed key does not exist in storage.
KeyNotFound = 3,
Expand All @@ -92,7 +92,7 @@ define_error_codes! {
CodeNotFound = 7,
/// The account that was called is no contract.
NotCallable = 8,
/// The call to `seal_debug_message` had no effect because debug message
/// The call to `debug_message` had no effect because debug message
/// recording was disabled.
LoggingDisabled = 9,
/// ECDSA public key recovery failed. Most probably wrong recovery id or signature.
Expand Down
2 changes: 1 addition & 1 deletion crates/env/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ where
///
/// 3. If a contract calls into itself after changing its code the new call would use
/// the new code. However, if the original caller panics after returning from the sub call it
/// would revert the changes made by `seal_set_code_hash` and the next caller would use
/// would revert the changes made by `set_code_hash` and the next caller would use
/// the old code.
///
/// # Errors
Expand Down
4 changes: 2 additions & 2 deletions crates/env/src/engine/off_chain/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,14 +245,14 @@ impl EnvBackend for EnvInstance {
where
T: scale::Decode,
{
unimplemented!("the off-chain env does not implement `seal_input`")
unimplemented!("the off-chain env does not implement `input`")
}

fn return_value<R>(&mut self, _flags: ReturnFlags, _return_value: &R) -> !
where
R: scale::Encode,
{
unimplemented!("the off-chain env does not implement `seal_return_value`")
unimplemented!("the off-chain env does not implement `return_value`")
}

fn debug_message(&mut self, message: &str) {
Expand Down
Loading

0 comments on commit e883ce5

Please sign in to comment.