Skip to content

Commit

Permalink
feat!: Make rollup enabled by default
Browse files Browse the repository at this point in the history
  • Loading branch information
vfusco committed Oct 26, 2023
1 parent 46d5de6 commit 30b2704
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ jobs:
- name: Save and Load
run: |
mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }}/snapshots
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --max-mcycle=0 --rollup --store=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --max-mcycle=0 --store=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
docker run --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --load=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
sudo rm -rf ${{ env.CARTESI_IMAGES_PATH }}/snapshots
Expand Down Expand Up @@ -344,7 +344,7 @@ jobs:
- name: Save and Load
run: |
mkdir -m 755 -p ${{ env.CARTESI_IMAGES_PATH }}/snapshots
docker run --platform linux/arm64 --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --max-mcycle=0 --rollup --store=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
docker run --platform linux/arm64 --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --max-mcycle=0 --store=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
docker run --platform linux/arm64 --rm -v ${{ env.CARTESI_IMAGES_PATH }}:${{ env.CARTESI_IMAGES_PATH }} -t ${{ github.repository_owner }}/machine-emulator:devel /usr/bin/cartesi-machine --load=${{ env.CARTESI_IMAGES_PATH }}/snapshots/save_and_load_test
sudo rm -rf ${{ env.CARTESI_IMAGES_PATH }}/snapshots
Expand Down
11 changes: 9 additions & 2 deletions src/cartesi-machine-tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,15 @@ local function build_machine(test_name)
},
htif = {
console_getchar = false,
yield_progress = false,
yield_rollup = false,
yield_automatic = true,
yield_manual = true,
},
rollup = {
rx_buffer = { start = 0x60000000, length = 2 << 20 },
tx_buffer = { start = 0x60200000, length = 2 << 20 },
input_metadata = { start = 0x60400000, length = 4096 },
voucher_hashes = { start = 0x60600000, length = 2 << 20 },
notice_hashes = { start = 0x60800000, length = 2 << 20 },
},
flash_drive = { {
start = 0x80000000000000,
Expand Down
47 changes: 22 additions & 25 deletions src/cartesi-machine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,17 @@ where options are:
semantics are the same as for the --flash-drive option with the following
difference: start and length are mandatory.
--rollup
defines appropriate values for rollup-rx-buffer, rollup-tx-buffer,
--no-rollup
do not define values for rollup-rx-buffer, rollup-tx-buffer,
rollup-input-metadata, rollup-voucher-hashes, rollup-notice hashes,
and htif yield for use with rollups.
equivalent to the following options:
default defined values are equivalent to the following options:
--rollup-rx-buffer=start:0x60000000,length:2<<20
--rollup-tx-buffer=start:0x60200000,length:2<<20
--rollup-input-metadata=start:0x60400000,length:4096
--rollup-voucher-hashes=start:0x60600000,length:2<<20
--rollup-notice-hashes=start:0x60800000,length:2<<20
--htif-yield-manual
--htif-yield-automatic
--rollup-advance-state=<key>:<value>[,<key>:<value>[,...]...]
advances the state of the machine through a number of inputs in an epoch
Expand Down Expand Up @@ -306,11 +304,11 @@ where options are:
This option will copy TERM, LANG, LC_ALL environment variables from the host to the guest,
allowing the use of true colors and special characters when the host terminal supports.
--htif-yield-manual
honor yield requests with manual reset by target.
--no-htif-yield-manual
do not honor yield requests with manual reset by target.
--htif-yield-automatic
honor yield requests with automatic reset by target.
--no-htif-yield-automatic
do not honor yield requests with automatic reset by target.
--store=<directory>
store machine to <directory>, where "%%h" is substituted by the
Expand Down Expand Up @@ -448,7 +446,13 @@ local init_splash = true
local append_bootargs = ""
local append_init = ""
local append_entrypoint = ""
local rollup
local rollup = {
rx_buffer = { start = 0x60000000, length = 2 << 20 },
tx_buffer = { start = 0x60200000, length = 2 << 20 },
input_metadata = { start = 0x60400000, length = 4096 },
voucher_hashes = { start = 0x60600000, length = 2 << 20 },
notice_hashes = { start = 0x60800000, length = 2 << 20 },
}
local uarch
local rollup_advance
local rollup_inspect
Expand All @@ -457,8 +461,8 @@ local skip_root_hash_check = false
local skip_version_check = false
local htif_no_console_putchar = false
local htif_console_getchar = false
local htif_yield_automatic = false
local htif_yield_manual = false
local htif_yield_automatic = true
local htif_yield_manual = true
local initial_hash = false
local final_hash = false
local initial_proof = {}
Expand Down Expand Up @@ -670,33 +674,26 @@ local options = {
end,
},
{
"^%-%-htif%-yield%-manual$",
"^%-%-no%-htif%-yield%-manual$",
function(all)
if not all then return false end
htif_yield_manual = true
htif_yield_manual = false
return true
end,
},
{
"^%-%-htif%-yield%-automatic$",
"^%-%-no%-htif%-yield%-automatic$",
function(all)
if not all then return false end
htif_yield_automatic = true
htif_yield_automatic = false
return true
end,
},
{
"^%-%-rollup$",
"^%-%-no%-rollup$",
function(all)
if not all then return false end
rollup = rollup or {}
rollup.rx_buffer = { start = 0x60000000, length = 2 << 20 }
rollup.tx_buffer = { start = 0x60200000, length = 2 << 20 }
rollup.input_metadata = { start = 0x60400000, length = 4096 }
rollup.voucher_hashes = { start = 0x60600000, length = 2 << 20 }
rollup.notice_hashes = { start = 0x60800000, length = 2 << 20 }
htif_yield_automatic = true
htif_yield_manual = true
rollup = nil
return true
end,
},
Expand Down

0 comments on commit 30b2704

Please sign in to comment.