From 78fdbc20d6e87ffca40f1b197438ffe2a46c90b9 Mon Sep 17 00:00:00 2001 From: Victor Fusco <1221933+vfusco@users.noreply.github.com> Date: Fri, 6 Oct 2023 17:52:39 -0300 Subject: [PATCH] feat!: Make rollup enabled by default --- .github/workflows/build.yml | 4 +-- src/cartesi-machine-tests.lua | 11 ++++++-- src/cartesi-machine.lua | 47 ++++++++++++++++------------------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 889b9bf13..daeed4eba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 @@ -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 diff --git a/src/cartesi-machine-tests.lua b/src/cartesi-machine-tests.lua index 08556958e..91e8dfefd 100755 --- a/src/cartesi-machine-tests.lua +++ b/src/cartesi-machine-tests.lua @@ -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, diff --git a/src/cartesi-machine.lua b/src/cartesi-machine.lua index 1afc7197e..284251fbd 100755 --- a/src/cartesi-machine.lua +++ b/src/cartesi-machine.lua @@ -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=:[,:[,...]...] advances the state of the machine through a number of inputs in an epoch @@ -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= store machine to , where "%%h" is substituted by the @@ -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 @@ -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 = {} @@ -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, },