Skip to content

Commit

Permalink
Merge branch 'next' into andrew-update-kernel-proc-naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Fumuran committed Jan 14, 2025
2 parents 0683b40 + 1386bcc commit f16f0e8
Show file tree
Hide file tree
Showing 74 changed files with 2,995 additions and 2,095 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ jobs:
rustup component add clippy
make clippy
clippy-no-std:
name: clippy no_std
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: Swatinem/rust-cache@v2
with:
# Only update the cache on push onto the next branch. This strikes a nice balance between
# cache hits and cache evictions (github has a 10GB cache limit).
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- name: Clippy no_std
run: |
rustup update --no-self-update
rustup component add clippy
make clippy-no-std
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@ jobs:
run: make test-default
- name: test-prove
run: make test-prove

doc-tests:
name: doc-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: Swatinem/rust-cache@v2
with:
save-if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/next' }}
- name: Install rust
run: rustup update --no-self-update
- name: Run doc-tests
run: make test-docs
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@
- Implemented `to_hex` for `AccountIdPrefix` and `epoch_block_num` for `BlockHeader` (#1039).
- Introduce `AccountIdBuilder` to simplify `AccountId` generation in tests (#1045).
- Introduced `AccountComponentTemplate` with TOML serialization and templating (#1015, #1027).
<<<<<<< HEAD
- [BREAKING] Updated the names and values of the kernel procedure offsets and corresponding kernel procedures (#1037).
=======
- Introduce `AccountIdError` and make account ID byte representations (`u128`, `[u8; 15]`) consistent (#1055).
- Refactor `AccountId` and `AccountIdPrefix` into version wrappers (#1058).
>>>>>>> next
## 0.6.2 (2024-11-20)

Expand Down
22 changes: 21 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ clippy: ## Runs Clippy with configs
cargo clippy --workspace --all-targets $(ALL_FEATURES_BUT_ASYNC) -- -D warnings


.PHONY: clippy-no-std
clippy-no-std: ## Runs Clippy with configs
cargo clippy --no-default-features --target wasm32-unknown-unknown --workspace --lib -- -D warnings


.PHONY: fix
fix: ## Runs Fix with configs
cargo fix --workspace --allow-staged --allow-dirty --all-targets $(ALL_FEATURES_BUT_ASYNC)
Expand All @@ -37,7 +42,7 @@ format-check: ## Runs Format using nightly toolchain but only in check mode


.PHONY: lint
lint: format fix clippy ## Runs all linting tasks at once (Clippy, fixing, formatting)
lint: format fix clippy clippy-no-std ## Runs all linting tasks at once (Clippy, fixing, formatting)

# --- docs ----------------------------------------------------------------------------------------

Expand All @@ -62,6 +67,16 @@ test-default: ## Run default tests excluding `prove`
$(DEBUG_ASSERTIONS) $(BACKTRACE) cargo nextest run --profile default --cargo-profile test-release --features concurrent,testing --filter-expr "not test(prove)"


.PHONY: test-dev
test-dev: ## Run default tests excluding slow tests (prove and ID anchor block tests) in debug mode intended to be run locally
$(DEBUG_ASSERTIONS) $(BACKTRACE) cargo nextest run --profile default --features concurrent,testing --filter-expr "not test(prove) & not test(create_accounts_with_non_zero_anchor_block)"


.PHONY: test-docs
test-docs: ## Run documentation tests
$(WARNINGS) $(DEBUG_ASSERTIONS) cargo test --doc $(ALL_FEATURES_BUT_ASYNC)


.PHONY: test-prove
test-prove: ## Run `prove` tests (tests which use the Miden prover)
$(DEBUG_ASSERTIONS) $(BACKTRACE) cargo nextest run --profile prove --cargo-profile test-release --features concurrent,testing --filter-expr "test(prove)"
Expand All @@ -76,6 +91,11 @@ test: test-default test-prove ## Run all tests
check: ## Check all targets and features for errors without code generation
${BUILD_KERNEL_ERRORS} cargo check --all-targets $(ALL_FEATURES_BUT_ASYNC)


.PHONY: check-no-std
check-no-std: ## Check the no-std target without any features for errors without code generation
${BUILD_KERNEL_ERRORS} cargo check --no-default-features --target wasm32-unknown-unknown --workspace --lib

# --- building ------------------------------------------------------------------------------------

.PHONY: build
Expand Down
3 changes: 1 addition & 2 deletions bin/bench-tx/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ pub fn get_account_with_basic_authenticated_wallet(
public_key: Word,
assets: Option<Asset>,
) -> Account {
AccountBuilder::new()
.init_seed(init_seed)
AccountBuilder::new(init_seed)
.account_type(account_type)
.storage_mode(storage_mode)
.with_assets(assets)
Expand Down
46 changes: 23 additions & 23 deletions miden-lib/asm/kernels/transaction/api.masm
Original file line number Diff line number Diff line change
Expand Up @@ -111,23 +111,23 @@ export.account_get_current_hash
# => [ACCT_HASH, pad(12)]
end

#! Returns the account id.
#! Returns the account ID.
#!
#! Inputs: [pad(16)]
#! Outputs: [acct_id_hi, acct_id_lo, pad(14)]
#! Outputs: [acct_id_prefix, acct_id_suffix, pad(14)]
#!
#! Where:
#! - acct_id is the account id.
#! - acct_id is the account ID.
#!
#! Invocation: dynexec
export.account_get_id
# get the account id
# get the account ID
exec.account::get_id
# => [acct_id_hi, acct_id_lo, pad(16)]
# => [acct_id_prefix, acct_id_suffix, pad(16)]

# truncate the stack
movup.2 drop movup.2 drop
# => [acct_id_hi, acct_id_lo, pad(14)]
# => [acct_id_prefix, acct_id_suffix, pad(14)]
end

#! Returns the account nonce.
Expand Down Expand Up @@ -503,11 +503,11 @@ end

#! Returns the balance of a fungible asset associated with a faucet_id.
#!
#! Inputs: [faucet_id_hi, faucet_id_lo, pad(14)]
#! Inputs: [faucet_id_prefix, faucet_id_suffix, pad(14)]
#! Outputs: [balance, pad(15)]
#!
#! Where:
#! - faucet_id_{hi,lo} are the first and second felt of the faucet id of the fungible asset
#! - faucet_id_{prefix,suffix} are the prefix and suffix felts of the faucet id of the fungible asset
#! of interest.
#! - balance is the vault balance of the fungible asset.
#!
Expand All @@ -518,7 +518,7 @@ end
export.account_get_balance
# get the vault root
exec.memory::get_acct_vault_root_ptr movdn.2
# => [faucet_id_hi, faucet_id_lo, acct_vault_root_ptr, pad(14)]
# => [faucet_id_prefix, faucet_id_suffix, acct_vault_root_ptr, pad(14)]

# get the asset balance
exec.asset_vault::get_balance
Expand Down Expand Up @@ -765,10 +765,10 @@ end
#! Returns the sender of the note currently being processed.
#!
#! Inputs: [pad(16)]
#! Outputs: [sender_hi, sender_lo, pad(14)]
#! Outputs: [sender_id_prefix, sender_id_suffix, pad(14)]
#!
#! Where:
#! - sender_{hi,lo} are the first and second felt of the sender account id of the note currently
#! - sender_{prefix,suffix} are the prefix and suffix felts of the sender account ID of the note currently
#! being processed.
#!
#! Panics if:
Expand All @@ -777,11 +777,11 @@ end
#! Invocation: dynexec
export.note_get_sender
exec.note::get_sender
# => [sender_hi, sender_lo, pad(16)]
# => [sender_id_prefix, sender_id_suffix, pad(16)]

# truncate the stack
movup.2 drop movup.2 drop
# => [sender_hi, sender_lo, pad(14)]
# => [sender_id_prefix, sender_id_suffix, pad(14)]
end

#! Returns the script hash of the note currently being processed.
Expand Down Expand Up @@ -925,9 +925,9 @@ end
#! Moves the account pointer to the currently accessing foreign account.
#!
#! Inputs:
#! Operand stack: [foreign_account_id_hi, foreign_account_id_lo, pad(14)]
#! Operand stack: [foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]
#! Advice map: {
#! FOREIGN_ACCOUNT_ID: [[foreign_account_lo, foreign_account_id_hi, 0, account_nonce],
#! FOREIGN_ACCOUNT_ID: [[foreign_account_id_suffix, foreign_account_id_prefix, 0, account_nonce],
#! VAULT_ROOT, STORAGE_ROOT, CODE_ROOT],
#! STORAGE_ROOT: [[STORAGE_SLOT_DATA]],
#! CODE_ROOT: [num_procs, [ACCOUNT_PROCEDURE_DATA]]
Expand All @@ -936,10 +936,10 @@ end
#! Operand stack: [pad(16)]
#!
#! Where:
#! - foreign_account_id_{hi,lo} are the first and second felt of the ID of the foreign account
#! - foreign_account_id_{prefix,suffix} are the prefix and suffix felts of the ID of the foreign account
#! whose procedure is going to be executed.
#! - FOREIGN_ACCOUNT_ID is the word constructed from the foreign_account_id as follows:
#! [foreign_account_lo, foreign_account_id_hi, 0, 0].
#! [foreign_account_id_suffix, foreign_account_id_prefix, 0, 0].
#! - account_nonce is the nonce of the foreign account.
#! - VAULT_ROOT is the commitment of the foreign account's vault.
#! - STORAGE_ROOT is the commitment of the foreign account's storage.
Expand All @@ -956,27 +956,27 @@ end
export.tx_start_foreign_context
# check that this procedure was executed against the native account
exec.memory::assert_native_account
# OS => [foreign_account_id_hi, foreign_account_id_lo, pad(14)]
# OS => [foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]

# get the memory address and a flag whether this account was already loaded.
exec.account::get_foreign_account_ptr
# OS => [was_loaded, ptr, foreign_account_id_hi, foreign_account_id_lo, pad(14)]
# OS => [was_loaded, ptr, foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]

if.true
exec.memory::set_current_account_data_ptr drop drop
# OS => [pad(16)]
else
exec.memory::set_current_account_data_ptr
# OS => [foreign_account_id_hi, foreign_account_id_lo, pad(14)]
# OS => [foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]

# construct the word with account ID to load the core account data from the advice map
push.0.0
# OS => [0, 0, foreign_account_id_hi, foreign_account_id_lo, pad(14)]
# OS => [0, 0, foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]

# move the core account data to the advice stack
adv.push_mapval
# OS => [0, 0, foreign_account_id_hi, foreign_account_id_lo, pad(14)]
# AS => [[foreign_account_id_hi, foreign_account_lo, 0, account_nonce], VAULT_ROOT, STORAGE_ROOT, CODE_ROOT]
# OS => [0, 0, foreign_account_id_prefix, foreign_account_id_suffix, pad(14)]
# AS => [[foreign_account_id_prefix, foreign_account_id_suffix, 0, account_nonce], VAULT_ROOT, STORAGE_ROOT, CODE_ROOT]

# store the id and nonce of the foreign account to the memory
dropw adv_loadw
Expand Down
Loading

0 comments on commit f16f0e8

Please sign in to comment.