Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
contracts: Document seal_input
  • Loading branch information
athei committed Feb 1, 2021
commit a5923e4d0186e6ac5496fed5f52f0f0169754e6d
10 changes: 10 additions & 0 deletions frame/contracts/src/wasm/runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,6 +935,16 @@ define_env!(Env, <E: Ext>,
Err(TrapReason::Termination)
},

// Stores the input passed by the caller into the supplied buffer.
//
// The value is stored to linear memory at the address pointed to by `out_ptr`.
// `out_len_ptr` must point to a u32 value that describes the available space at
// `out_ptr`. This call overwrites it with the size of the value. If the available
// space at `out_ptr` is less than the size of the value a trap is triggered.
//
// # Note
//
// This function can only be called once. Calling it multiple times will trigger a trap.
seal_input(ctx, buf_ptr: u32, buf_len_ptr: u32) => {
ctx.charge_gas(RuntimeToken::InputBase)?;
if let Some(input) = ctx.input_data.take() {
Expand Down