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 27, 2023
1 parent 0451caa commit e4e0ec5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 39 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
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ ARG SANITIZE=no
RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \
build-essential vim wget git clang-tidy-15 clang-format-15 lcov \
libreadline-dev libboost-context1.81-dev \
libboost-filesystem1.81-dev libssl-dev libc-ares-dev zlib1g-dev \
libreadline-dev libboost-filesystem1.81-dev libssl-dev libc-ares-dev zlib1g-dev \
ca-certificates automake libtool patchelf cmake pkg-config lua5.4 liblua5.4-dev \
libgrpc++-dev libprotobuf-dev protobuf-compiler-grpc \
luarocks libb64-dev libcrypto++-dev nlohmann-json3-dev && \
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
16 changes: 8 additions & 8 deletions src/machine-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,17 @@ struct htif_config final {
uint64_t fromhost{FROMHOST_INIT}; ///< Value of fromhost CSR
uint64_t tohost{TOHOST_INIT}; ///< Value of tohost CSR
bool console_getchar{false}; ///< Make console getchar available?
bool yield_manual{false}; ///< Make yield manual available?
bool yield_automatic{false}; ///< Make yield automatic available?
bool yield_manual{true}; ///< Make yield manual available?
bool yield_automatic{true}; ///< Make yield automatic available?
};

/// \brief Rollup configuration
struct rollup_config { // NOLINT(bugprone-exception-escape)
memory_range_config rx_buffer{}; ///< RX buffer
memory_range_config tx_buffer{}; ///< TX buffer
memory_range_config input_metadata{}; ///< Buffer for input metadata
memory_range_config voucher_hashes{}; ///< Buffer for the voucher hash array
memory_range_config notice_hashes{}; ///< Buffer for the notice hash array
struct rollup_config { // NOLINT(bugprone-exception-escape)
memory_range_config rx_buffer{.start = 0x60000000, .length = 2 << 20}; ///< RX buffer
memory_range_config tx_buffer{.start = 0x60200000, 2 << 20}; ///< TX buffer
memory_range_config input_metadata{.start = 0x60400000, .length = 4096}; ///< Buffer for input metadata
memory_range_config voucher_hashes{.start = 0x60600000, .length = 2 << 20}; ///< Buffer for the voucher hash array
memory_range_config notice_hashes{.start = 0x60800000, .length = 2 << 20}; ///< Buffer for the notice hash array
};

/// \brief Machine state configuration
Expand Down

0 comments on commit e4e0ec5

Please sign in to comment.