Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,10 @@ jobs:
working-directory: ./machine/emulator
run: |
make bundle-boost
wget https://github.com/cartesi/machine-emulator/releases/download/v0.19.0/add-generated-files.diff
wget https://github.com/cartesi/machine-emulator/releases/download/v0.20.0-test/add-generated-files.diff
git apply add-generated-files.diff
make
sudo make install
sudo make install DESTDIR=$GITHUB_WORKSPACE/ PREFIX=usr/

- name: Setup env
run: |
Expand Down
5 changes: 4 additions & 1 deletion cartesi-rollups/node/blockchain-reader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ mod blockchain_reader_tests {
let mut machine = Machine::create(
&MachineConfig::new_with_ram(RAMConfig {
length: 134217728,
image_filename: "../../../test/programs/linux.bin".into(),
backing_store: cartesi_machine::config::machine::BackingStoreConfig {
data_filename: "../../../test/programs/linux.bin".into(),
..Default::default()
},
}),
&RuntimeConfig::default(),
)
Expand Down
9 changes: 6 additions & 3 deletions cartesi-rollups/node/blockchain-reader/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use cartesi_rollups_contracts::i_input_box::IInputBox;
use serde::Deserialize;
use std::{
fs::{self, File},
io::Read,
io::{Read, Seek},
path::PathBuf,
};

Expand Down Expand Up @@ -77,8 +77,11 @@ pub async fn spawn_anvil_and_provider() -> Result<(AnvilInstance, DynProvider, A
let dave_app_factory = deployment_address("DaveAppFactory");

let initial_hash = {
// $ xxd -p -c32 test/programs/echo/machine-image/hash
let mut file = File::open(program_path.join("machine-image").join("hash")).unwrap();
// Root hash is stored in hash_tree.sht at offset 0x60 (node 1's hash in sparse tree).
// Equivalent to: xxd -seek 0x60 -l 0x20 -c 0x20 -p .../machine-image/hash_tree.sht
let mut file =
File::open(program_path.join("machine-image").join("hash_tree.sht")).unwrap();
file.seek(std::io::SeekFrom::Start(0x60)).unwrap();
let mut buffer = [0u8; 32];
file.read_exact(&mut buffer).unwrap();
buffer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ mod tests {
let mut machine = Machine::create(
&MachineConfig::new_with_ram(RAMConfig {
length: 134217728,
image_filename: "../../../test/programs/linux.bin".into(),
backing_store: cartesi_machine::config::machine::BackingStoreConfig {
data_filename: "../../../test/programs/linux.bin".into(),
..Default::default()
},
}),
&RuntimeConfig::default(),
)
Expand Down
5 changes: 4 additions & 1 deletion cartesi-rollups/node/state-manager/src/sql/test_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ pub fn setup_db() -> (TempDir, Connection) {
let mut machine = Machine::create(
&MachineConfig::new_with_ram(RAMConfig {
length: 134217728,
image_filename: "../../../test/programs/linux.bin".into(),
backing_store: cartesi_machine::config::machine::BackingStoreConfig {
data_filename: "../../../test/programs/linux.bin".into(),
..Default::default()
},
}),
&RuntimeConfig::default(),
)
Expand Down
9 changes: 7 additions & 2 deletions justfile
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will this change behave if we need to use an unreleased machine?

Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ clean-emulator:
clean-contracts: clean-consensus-contracts clean-prt-contracts clean-bindings clean-deployments
make -C machine/emulator clean # wtf? this is cleaning the emulator, not contracts

apply-generated-files-diff VERSION="v0.20.0-test":
cd machine/emulator && \
wget https://github.com/cartesi/machine-emulator/releases/download/{{VERSION}}/add-generated-files.diff && \
git apply add-generated-files.diff

# setup the emulator locally.
# ```sh
# export PATH=$PATH:$PWD/usr/bin
# ```
setup: update-submodules clean-emulator clean-contracts
setup: update-submodules clean-emulator clean-contracts apply-generated-files-diff
make -C machine/emulator bundle-boost
make -C machine/emulator uarch-with-toolchain # Requires docker, necessary for machine bindings
make -C machine/emulator # Requires docker, necessary for machine bindings
make -C machine/emulator -j$(nproc) all
make -C machine/emulator install DESTDIR=$PWD/ PREFIX=usr/

Expand Down
Loading
Loading