diff --git a/CHANGELOG.md b/CHANGELOG.md index 00e35a5d0..32426bd63 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - [BREAKING] Increase of nonce does not require changes in account state any more (#796). - Added `CHANGELOG.md` warning message on CI (#799). - Account deltas can now be merged (#797). +- Changed `AccountCode` procedures from merkle tree to sequential hash + added storage_offset support (#763). ## 0.4.0 (2024-07-03) diff --git a/bench-tx/src/main.rs b/bench-tx/src/main.rs index 28c8ed256..e0d3e9aea 100644 --- a/bench-tx/src/main.rs +++ b/bench-tx/src/main.rs @@ -90,7 +90,8 @@ pub fn benchmark_default_tx() -> Result { let (stack_inputs, advice_inputs) = transaction.get_kernel_inputs(); let advice_recorder: RecAdviceProvider = advice_inputs.into(); let mut host: TransactionHost<_, ()> = - TransactionHost::new(transaction.account().into(), advice_recorder, None); + TransactionHost::new(transaction.account().into(), advice_recorder, None) + .map_err(|e| format!("Failed to create transaction host: {}", e))?; vm_processor::execute( transaction.program(), @@ -174,7 +175,8 @@ pub fn benchmark_p2id() -> Result { )]); let authenticator = Some(Rc::new(authenticator)); let mut host = - TransactionHost::new(transaction.account().into(), advice_recorder, authenticator); + TransactionHost::new(transaction.account().into(), advice_recorder, authenticator) + .map_err(|e| format!("Failed to create transaction host: {}", e))?; vm_processor::execute( transaction.program(), diff --git a/docs/architecture/transactions/procedures.md b/docs/architecture/transactions/procedures.md index bde62bf0c..87f807e9c 100644 --- a/docs/architecture/transactions/procedures.md +++ b/docs/architecture/transactions/procedures.md @@ -8,73 +8,70 @@ There are user-facing procedures and kernel procedures. Users don't directly inv These procedures can be used to create smart contract/account code, note scripts, or account scripts. They basically serve as an API for the underlying kernel procedures. If a procedure can be called in the current context, an `exec` is sufficient. Otherwise the context procedures must be invoked by `call`. Users never need to invoke `syscall` procedures themselves. -!!! tip - - If capitalized, a variable representing a `word`, e.g., `ACCT_HASH` consists of four `felts`. If lowercase, the variable is represented by a single `felt`. +!!! tip - If capitalized, a variable representing a `word`, e.g., `ACCT_HASH` consists of four `felts`. If lowercase, the variable is represented by a single `felt`. ### Account -To import the account procedures, set `use.miden::account` at the beginning of the file. +To import the account procedures, set `use.miden::account` at the beginning of the file. Any procedure that changes the account state must be invoked in the account context and not by note or transaction scripts. All procedures invoke `syscall` to the kernel API and some are restricted by the kernel procedure `exec.authenticate_account_origin`, which fails if the parent context is not the executing account. -| Procedure name | Stack | Output | Context | Description | -|---------------------------|------------|--------------|---------|---------------------------------------------------------------------| -| `get_id` | `[]` | `[acct_id]` | account, note | | -| `get_nonce` | `[]` | `[nonce]` | account, note | | -| `get_initial_hash` | `[]` | `[H]` | account, note | | -| `get_current_hash` | `[]` | `[ACCT_HASH]`| account, note | -| `incr_nonce` | `[value]` | `[]` | account | | -| `get_item` | `[index]` | `[VALUE]` | account, note | | -| `set_item` | `[index, V']` | `[R', V]` | account | | -| `set_code` | `[CODE_ROOT]`| `[]` | account | | -| `get_balance` | `[faucet_id]`| `[balance]`| account, note | | -| `has_non_fungible_asset` | `[ASSET]` | `[has_asset]`| account, note | | -| `add_asset` | `[ASSET]` | `[ASSET']` | account | | -| `remove_asset` | `[ASSET]` | `[ASSET]` | account | | -| `get_vault_commitment` | `[]` | `[COM]` | account, note | | +| Procedure name | Stack | Output | Context | Description | +| ------------------------ | ------------------- | ------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `get_id` | `[]` | `[acct_id]` | account, note | | +| `get_nonce` | `[]` | `[nonce]` | account, note | | +| `get_initial_hash` | `[]` | `[H]` | account, note | | +| `get_current_hash` | `[]` | `[ACCT_HASH]` | account, note | | +| `incr_nonce` | `[value]` | `[]` | account | | +| `get_item` | `[index]` | `[VALUE]` | account, note | | +| `set_item` | `[index, V']` | `[R', V]` | account | | +| `set_code` | `[CODE_COMMITMENT]` | `[]` | account | | +| `get_balance` | `[faucet_id]` | `[balance]` | account, note | | +| `has_non_fungible_asset` | `[ASSET]` | `[has_asset]` | account, note | | +| `add_asset` | `[ASSET]` | `[ASSET']` | account | | +| `remove_asset` | `[ASSET]` | `[ASSET]` | account | | +| `get_vault_commitment` | `[]` | `[COM]` | account, note | | ### Note To import the note procedures, set `use.miden::note` at the beginning of the file. All procedures are restricted to the note context. -| Procedure name | Inputs | Outputs | Context | Description | -|--------------------------|---------------------|-----------------------|---------|-------------------------------------------------------------------------------------------------------------------------------------| -| `get_assets` | `[dest_ptr]` | `[num_assets, dest_ptr]` | note | | -| `get_inputs` | `[dest_ptr]` | `[dest_ptr]` | note | | -| `get_sender` | `[]` | `[sender]` | note | | -| `compute_inputs_hash` | `[inputs_ptr, num_inputs]` | `[HASH]` | note | | - +| Procedure name | Inputs | Outputs | Context | Description | +| --------------------- | -------------------------- | ------------------------ | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `get_assets` | `[dest_ptr]` | `[num_assets, dest_ptr]` | note | | +| `get_inputs` | `[dest_ptr]` | `[dest_ptr]` | note | | +| `get_sender` | `[]` | `[sender]` | note | | +| `compute_inputs_hash` | `[inputs_ptr, num_inputs]` | `[HASH]` | note | | ### Tx -To import the transaction procedures set `use.miden::tx` at the beginning of the file. Only the `create_note` procedure is restricted to the account context. -| Procedure name | Inputs | Outputs | Context | Description | -|--------------------------|------------------|-------------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| `get_block_number` | `[]` | `[num]` | account, note |