This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Because of the new bounds on the trait tests can't get away by using u64 as accound id. Replacing the 8 byte value by a 32 byte value creates out quite a bit of code churn.
- Loading branch information
Showing
13 changed files
with
543 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,42 @@ | ||
;; This calls Django (4) and transfers 100 balance during this call and copies the return code | ||
;; of this call to the output buffer. | ||
;; This calls the supplied dest and transfers 100 balance during this call and copies | ||
;; the return code of this call to the output buffer. | ||
;; It also forwards its input to the callee. | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "seal0" "seal_call" (func $seal_call (param i32 i32 i64 i32 i32 i32 i32 i32 i32) (result i32))) | ||
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
;; [0, 8) address of django | ||
(data (i32.const 0) "\04\00\00\00\00\00\00\00") | ||
;; [0, 8) 100 balance | ||
(data (i32.const 0) "\64\00\00\00\00\00\00\00") | ||
|
||
;; [8, 16) 100 balance | ||
(data (i32.const 8) "\64\00\00\00\00\00\00\00") | ||
;; [8, 12) here we store the return code of the transfer | ||
|
||
;; [16, 20) here we store the return code of the transfer | ||
;; [12, 16) size of the input data | ||
(data (i32.const 12) "\24") | ||
|
||
;; [20, 24) here we store the input data | ||
|
||
;; [24, 28) size of the input data | ||
(data (i32.const 24) "\04") | ||
;; [16, inf) here we store the input data | ||
;; 32 byte dest + 4 byte forward | ||
|
||
(func (export "deploy")) | ||
|
||
(func (export "call") | ||
(call $seal_input (i32.const 20) (i32.const 24)) | ||
(call $seal_input (i32.const 16) (i32.const 12)) | ||
(i32.store | ||
(i32.const 16) | ||
(i32.const 8) | ||
(call $seal_call | ||
(i32.const 0) ;; Pointer to "callee" address. | ||
(i32.const 8) ;; Length of "callee" address. | ||
(i32.const 16) ;; Pointer to "callee" address. | ||
(i32.const 32) ;; Length of "callee" address. | ||
(i64.const 0) ;; How much gas to devote for the execution. 0 = all. | ||
(i32.const 8) ;; Pointer to the buffer with value to transfer | ||
(i32.const 0) ;; Pointer to the buffer with value to transfer | ||
(i32.const 8) ;; Length of the buffer with value to transfer. | ||
(i32.const 20) ;; Pointer to input data buffer address | ||
(i32.load (i32.const 24)) ;; Length of input data buffer | ||
(i32.const 48) ;; Pointer to input data buffer address | ||
(i32.const 4) ;; Length of input data buffer | ||
(i32.const 0xffffffff) ;; u32 max sentinel value: do not copy output | ||
(i32.const 0) ;; Ptr to output buffer len | ||
) | ||
) | ||
;; exit with success and take transfer return code to the output buffer | ||
(call $seal_return (i32.const 0) (i32.const 16) (i32.const 4)) | ||
(call $seal_return (i32.const 0) (i32.const 8) (i32.const 4)) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,49 @@ | ||
;; This instantiats Charlie (3) and transfers 100 balance during this call and copies the return code | ||
;; This instantiats a contract and transfers 100 balance during this call and copies the return code | ||
;; of this call to the output buffer. | ||
;; The first 32 byte of input is the code hash to instantiate | ||
;; The rest of the input is forwarded to the constructor of the callee | ||
(module | ||
(import "seal0" "seal_input" (func $seal_input (param i32 i32))) | ||
(import "seal0" "seal_instantiate" (func $seal_instantiate (param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32) (result i32))) | ||
(import "seal0" "seal_instantiate" (func $seal_instantiate | ||
(param i32 i32 i64 i32 i32 i32 i32 i32 i32 i32 i32 i32 i32) (result i32) | ||
)) | ||
(import "seal0" "seal_return" (func $seal_return (param i32 i32 i32))) | ||
(import "env" "memory" (memory 1 1)) | ||
|
||
;; [0, 8) address of django | ||
(data (i32.const 0) "\04\00\00\00\00\00\00\00") | ||
;; [0, 8) 100 balance | ||
(data (i32.const 0) "\64\00\00\00\00\00\00\00") | ||
|
||
;; [8, 16) 100 balance | ||
(data (i32.const 8) "\64\00\00\00\00\00\00\00") | ||
;; [8, 12) here we store the return code of the transfer | ||
|
||
;; [16, 20) here we store the return code of the transfer | ||
;; [12, 16) size of the input buffer | ||
(data (i32.const 12) "\24") | ||
|
||
;; [20, 24) size of the input buffer | ||
(data (i32.const 20) "\FF") | ||
|
||
;; [24, inf) input buffer | ||
;; [16, inf) input buffer | ||
;; 32 bye code hash + 4 byte forward | ||
|
||
(func (export "deploy")) | ||
|
||
(func (export "call") | ||
(call $seal_input (i32.const 24) (i32.const 20)) | ||
(call $seal_input (i32.const 16) (i32.const 12)) | ||
(i32.store | ||
(i32.const 16) | ||
(i32.const 8) | ||
(call $seal_instantiate | ||
(i32.const 24) ;; Pointer to the code hash. | ||
(i32.const 16) ;; Pointer to the code hash. | ||
(i32.const 32) ;; Length of the code hash. | ||
(i64.const 0) ;; How much gas to devote for the execution. 0 = all. | ||
(i32.const 8) ;; Pointer to the buffer with value to transfer | ||
(i32.const 0) ;; Pointer to the buffer with value to transfer | ||
(i32.const 8) ;; Length of the buffer with value to transfer. | ||
(i32.const 56) ;; Pointer to input data buffer address | ||
(i32.sub (i32.load (i32.const 20)) (i32.const 32)) ;; Length of input data buffer | ||
(i32.const 48) ;; Pointer to input data buffer address | ||
(i32.const 4) ;; Length of input data buffer | ||
(i32.const 0xffffffff) ;; u32 max sentinel value: do not copy address | ||
(i32.const 0) ;; Length is ignored in this case | ||
(i32.const 0xffffffff) ;; u32 max sentinel value: do not copy output | ||
(i32.const 0) ;; Length is ignored in this case | ||
(i32.const 0) ;; salt_ptr | ||
(i32.const 0) ;; salt_len | ||
) | ||
) | ||
;; exit with success and take transfer return code to the output buffer | ||
(call $seal_return (i32.const 0) (i32.const 16) (i32.const 4)) | ||
(call $seal_return (i32.const 0) (i32.const 8) (i32.const 4)) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.