Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamic kernel procedure invocation #803

Merged
merged 13 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Implemented offset based storage access (#843).
- [BREAKING] `AccountStorageType` enum was renamed to `AccountStorageMode` along with its variants (#854).
- [BREAKING] `AccountStub` structure was renamed to `AccountHeader` (#855).
- [BREAKING] Kernel procedures now have to be invoked using `dynexec` instruction (#803).
- Refactored `AccountStorage` from `Smt` to `sequential hash` (#846)

## 0.5.1 (2024-08-28) - `miden-objects` crate only
Expand Down
16 changes: 8 additions & 8 deletions bench-tx/bench-tx.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{
"simple": {
"prologue": 3833,
"notes_processing": 2178,
"prologue": 4065,
"notes_processing": 2526,
"note_execution": {
"0x8cb51db3dbec8fab6c0ce3ac3e332aaa28fc99de07ae5a52dd93047a1fe459c2": 1401,
"0xed95b651bebd558f84ece32c4e7b8ac7b0fff9d845d3bff86037b64e9f9c7245": 735
"0x5c5e81a3c7b9950283a3e63e3526cdf189728a8f63d5459c6e43567ff22cc683": 851,
"0x8c3f1ace49f9b66d75c27e4b38a0082ddb8b8c5d1475e02399188c54eed5df32": 1633
},
"tx_script_processing": 44,
"epilogue": 2287
},
"p2id": {
"prologue": 2141,
"notes_processing": 1012,
"prologue": 2373,
"notes_processing": 1357,
"note_execution": {
"0xc1299ce481078310e6b4cf09f005bd898468019bb4cf7a03f5ded4b9e518790f": 977
"0x0105f1a0142b9ebc6bfba0b09de88807eac595b46b70f0fea403ce01aee1fe54": 1322
},
"tx_script_processing": 88460,
"tx_script_processing": 88989,
"epilogue": 291
}
}
5 changes: 3 additions & 2 deletions docs/architecture/transactions/contexts.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,14 @@ export.receive_asset
end
```

The [account API](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/miden/account.masm#L162) exposes procedures to manage accounts. This particular procedure that was called by the wallet invokes a `syscall` to return back to the root context **(3)**, where the account vault is stored in memory (see prologue). `syscall` can invoke all procedures defined in the [Kernel API](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/kernels/transaction/api.masm).
The [account API](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/miden/account.masm#L162) exposes procedures to manage accounts. This particular procedure that was called by the wallet invokes a `syscall` to return back to the root context **(3)**, where the account vault is stored in memory (see prologue). Procedures defined in the [Kernel API](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/kernels/transaction/api.masm) should be invoked with `syscall` using the corresponding [procedure offset](https://github.com/0xPolygonMiden/miden-base/blob/main/miden-lib/asm/miden/kernel_proc_offsets.masm) and the `exec_kernel_proc` kernel procedure.

```arduino
#! Add the specified asset to the vault.
#! ...
export.add_asset
syscall.account_vault_add_asset
exec.kernel_proc_offsets::account_vault_add_asset_offset
syscall.exec_kernel_proc
end
```

Expand Down
Loading
Loading