-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vm): reading kernel state opcodes (#5739)
This pr will cover the following opcodes: ADDRESS STORAGEADDRESS SENDER FEEPERL2GAS FEEPERDAGAS TRANSACTIONFEE CHAINID VERSION BLOCKNUMBER TIMESTAMP
- Loading branch information
Showing
42 changed files
with
2,602 additions
and
319 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
include "avm_main.pil"; | ||
include "constants.pil"; | ||
|
||
namespace avm_kernel(256); | ||
pol public kernel_inputs; | ||
pol commit kernel_sel; | ||
|
||
// Note: in the future, with some codegen adjustments, this column will not be needed | ||
// as we can just add every entry in the public kernel_inputs to the lookup table | ||
pol commit q_public_input_kernel_add_to_table; |
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
// NOTE: the constants in this file line up to the indexes of values in the | ||
// `PublicKernelInputs.nr` object | ||
namespace constants(256); | ||
// From Public Context Inputs | ||
pol SENDER_SELECTOR = 0; | ||
pol ADDRESS_SELECTOR = 1; | ||
pol PORTAL_SELECTOR = 2; | ||
|
||
// NOTE: constant expression evaluation does not seem to be supported yet in pil | ||
// pol START_GLOBAL_VARIABLES = CALL_CONTEXT_LENGTH + HEADER_LENGTH = 6 + 22 = 28 | ||
|
||
// Global Variables | ||
pol CHAIN_ID_SELECTOR = 28; | ||
pol VERSION_SELECTOR = 29; | ||
pol BLOCK_NUMBER_SELECTOR = 30; | ||
pol TIMESTAMP_SELECTOR = 31; | ||
pol COINBASE_SELECTOR = 32; | ||
|
||
pol END_GLOBAL_VARIABLES = 28 + 8; // We only use the first 5 of 8 global variables for now | ||
|
||
pol START_SIDE_EFFECT_COUNTER = 36; | ||
|
||
// Gas | ||
pol FEE_PER_DA_GAS_SELECTOR = 37; | ||
pol FEE_PER_L2_GAS_SELECTOR = 38; | ||
|
||
pol TRANSACTION_FEE_SELECTOR = 39; | ||
|
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
use_zsh_alias() { | ||
# Run Zsh command, source .zshrc, and then execute the alias | ||
zsh -i -c "$1" | ||
} | ||
|
||
# Compile | ||
use_zsh_alias "bb_pil pil/avm/avm_main.pil --name Avm" | ||
|
||
# Format generated folders | ||
root_dir="src" | ||
|
||
# Find all directories named 'generate' under the specified root directory | ||
find "$root_dir" -type d -name 'generate' | while read dir_path; do | ||
echo "Processing directory: $dir_path" | ||
|
||
# Find all C/C++ source files in these directories and format them | ||
find "$dir_path" -type f \( -iname '*.hpp' -o -iname '*.cpp' \) -exec clang-format -i {} + | ||
done | ||
|
||
|
||
# Build vm tests | ||
cmake --build --preset clang16 --target vm_tests |
Oops, something went wrong.