Skip to content

Commit

Permalink
refactor: ABI for syscall and call instructions (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran authored Nov 26, 2024
1 parent 3fefe18 commit 1e597ca
Show file tree
Hide file tree
Showing 43 changed files with 2,303 additions and 1,623 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@

### Fixes

- Fixed `AccountId::new_with_type_and_mode()` (#958).
- Fixed `AccountId::new_with_type_and_mode()` (#958).
- Updated the ABI for the assembly procedures (#971).

## 0.6.0 (2024-11-05)

Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions bin/bench-tx/bench-tx.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"simple": {
"prologue": 4314,
"notes_processing": 2539,
"prologue": 4365,
"notes_processing": 2571,
"note_execution": {
"0xae044cdd180167726f6eb2ea979cf175f87aebf5f42e4e5cafaaec1ae9de9486": 1644,
"0xf345f3580300b778a8aff7aa4412f373218712706e26cc3eb8f4c6c1785d2da6": 853
"0xb13132cc8d5902ffa95759f8575b4385c1534da1fea24d8bdab3265aa14635f9": 1660,
"0xbb5e3d1981ff0554ee88484ff417b5810e48f8c3b1ac34e23788bf6441f31974": 869
},
"tx_script_processing": 47,
"epilogue": 2425
"epilogue": 2434
},
"p2id": {
"prologue": 2559,
"notes_processing": 1390,
"prologue": 2601,
"notes_processing": 1411,
"note_execution": {
"0x7eb50fa0df4f858ac4048d26122a1cfa69abeb0b9ddd04c8b756bc690a0769ba": 1355
"0xb380bacdb610da889051ff4c4ae946130bc0921bf3192beedd3155400297e7ca": 1376
},
"tx_script_processing": 89151,
"epilogue": 414
"tx_script_processing": 89189,
"epilogue": 423
}
}
2 changes: 2 additions & 0 deletions bin/bench-tx/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ pub const ACCOUNT_ID_SENDER: u64 = 0x800000000000001f; // 9223372036854775839

pub const DEFAULT_AUTH_SCRIPT: &str = "
begin
padw padw padw padw
call.::miden::contracts::auth::basic::auth_tx_rpo_falcon512
dropw dropw dropw dropw
end
";

Expand Down
18 changes: 15 additions & 3 deletions docs/architecture/notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,25 @@ There are [standard note scripts](https://github.com/0xPolygonMiden/miden-base/t
dup movdn.5
# => [ptr, 0, 0, 0, 0, ptr, end_ptr, ...]

# load the asset and add it to the account
mem_loadw call.wallet::receive_asset
# load the asset
mem_loadw
# => [ASSET, ptr, end_ptr, ...]
# pad the stack before call
padw swapw padw padw swapdw
# => [ASSET, pad(12), ptr, end_ptr, ...]

# add asset to the account
call.wallet::receive_asset
# => [pad(16), ptr, end_ptr, ...]

# clean the stack after call
dropw dropw dropw
# => [0, 0, 0, 0, ptr, end_ptr, ...]

# increment the pointer and compare it to the end_ptr
movup.4 add.1 dup dup.6 neq
# => [latch, ptr+1, ASSET, end_ptr, ...]
# => [latch, ptr+1, 0, 0, 0, 0, end_ptr, ...]
end

# clear the stack
Expand Down
16 changes: 14 additions & 2 deletions docs/architecture/transactions/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,21 @@ proc.add_note_assets_to_account
while.true
...
# load the asset and add it to the account
mem_loadw call.wallet::receive_asset
# load the asset
mem_loadw
# => [ASSET, ptr, end_ptr, ...]
# pad the stack before call
padw swapw padw padw swapdw
# => [ASSET, pad(12), ptr, end_ptr, ...]
# add asset to the account
call.wallet::receive_asset
# => [pad(16), ptr, end_ptr, ...]
# clean the stack after call
dropw dropw dropw
# => [0, 0, 0, 0, ptr, end_ptr, ...]
...
end
...
Expand Down
2 changes: 2 additions & 0 deletions docs/architecture/transactions/kernel.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ The transaction script can be used to authenticate the transaction by increasing
use.miden::contracts::auth::basic->auth_tx
begin
padw padw padw padw
call.auth_tx::auth_tx_rpo_falcon512
dropw dropw dropw dropw
end
```

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture/transactions/procedures.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ To import the transaction procedures set `use.miden::tx` at the beginning of the
| ----------------------- | ------------------------- | ------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `get_block_number` | `[]` | `[num]` | account, note | <ul> <li>Returns the block number `num` of the last known block at the time of transaction execution. |
| `get_block_hash` | `[]` | `[H]` | account, note | <ul> <li>Returns the block hash `H` of the last known block at the time of transaction execution.</li> </ul> |
| `get_input_notes_hash` | `[]` | `[COM]` | account, note | <ul> <li>Returns the input notes hash `COM`. </li><li>This is computed as a sequential hash of (nullifier, empty_word_or_note_hash) tuples over all input notes. The `empty_word_or_notes_hash` functions as a flag, if the value is set to zero, then the notes are authenticated by the transaction kernel. If the value is non-zero, then note authentication will be delayed to the batch/block kernel. The delayed authentication allows a transaction to consume a public note that is not yet included to a block. </li> </ul> |
| `get_output_notes_hash` | `[0, 0, 0, 0]` | `[COM]` | account, note | <ul> <li>Returns the output notes hash `COM`. </li><li>This is computed as a sequential hash of (note_id, note_metadata) tuples over all output notes. </li> </ul> |
| `get_input_notes_commitment` | `[]` | `[COM]` | account, note | <ul> <li>Returns the input notes hash `COM`. </li><li>This is computed as a sequential hash of (nullifier, empty_word_or_note_hash) tuples over all input notes. The `empty_word_or_notes_hash` functions as a flag, if the value is set to zero, then the notes are authenticated by the transaction kernel. If the value is non-zero, then note authentication will be delayed to the batch/block kernel. The delayed authentication allows a transaction to consume a public note that is not yet included to a block. </li> </ul> |
| `get_output_notes_commitment` | `[0, 0, 0, 0]` | `[COM]` | account, note | <ul> <li>Returns the output notes hash `COM`. </li><li>This is computed as a sequential hash of (note_id, note_metadata) tuples over all output notes. </li> </ul> |
| `create_note` | `[ASSET, tag, RECIPIENT]` | `[ptr]` | account | <ul> <li>Creates a new note and returns a pointer to the memory address at which the note is stored.</li><li> `ASSET` is the asset to be included in the note. </li><li>`tag` is the tag to be included in the note. `RECIPIENT` is the recipient of the note.</li><li> `ptr` is the pointer to the memory address at which the note is stored.</li> </ul> |

### Asset
Expand Down
Loading

0 comments on commit 1e597ca

Please sign in to comment.