Skip to content
Draft
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
2 changes: 1 addition & 1 deletion .github/actions/cartesi-machine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inputs:
version:
description: 'Version of Cartesi Machine to install'
required: false
default: 0.19.0
default: 0.20.0-test
suffix-version:
description: 'Suffix of Cartesi Machine to install'
required: false
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Cartesi Machine
uses: ./.github/actions/cartesi-machine
with:
version: 0.19.0
version: 0.20.0-test
suffix-version: ""

- name: Setup env
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Install Cartesi Machine
uses: ./.github/actions/cartesi-machine
with:
version: 0.19.0
version: 0.20.0-test
- name: Download PRT contracts
working-directory: ./prt/contracts
run: |
Expand Down Expand Up @@ -138,7 +138,7 @@ 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
Expand Down
2 changes: 1 addition & 1 deletion cartesi-rollups/contracts/src/DaveConsensus.sol
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ contract DaveConsensus is IDaveConsensus, ERC165 {

require(proof.length == Memory.LOG2_MAX_SIZE, InvalidOutputsMerkleRootProofSize(proof.length));
bytes32 allegedStateHash = proof.merkleRootAfterReplacement(
EmulatorConstants.PMA_CMIO_TX_BUFFER_START >> EmulatorConstants.TREE_LOG2_WORD_SIZE,
EmulatorConstants.AR_CMIO_TX_BUFFER_START >> EmulatorConstants.HASH_TREE_LOG2_WORD_SIZE,
keccak256(abi.encode(outputsMerkleRoot))
);

Expand Down
2 changes: 1 addition & 1 deletion cartesi-rollups/contracts/test/DaveConsensus.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,7 @@ contract DaveConsensusTest is Test {

bytes32 root = new LibMerkle32Wrapper()
.merkleRootAfterReplacement(
siblings, EmulatorConstants.PMA_CMIO_TX_BUFFER_START >> EmulatorConstants.TREE_LOG2_WORD_SIZE, leaf
siblings, EmulatorConstants.AR_CMIO_TX_BUFFER_START >> EmulatorConstants.TREE_LOG2_WORD_SIZE, leaf
);
assertEq(current, root);

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
4 changes: 2 additions & 2 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
update-submodules:
git submodule update --recursive --init

apply-generated-files-diff VERSION="v0.19.0":
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
Expand All @@ -16,7 +16,7 @@ clean-contracts: clean-consensus-contracts clean-prt-contracts clean-bindings cl
make -C machine/emulator clean depclean distclean

setup: update-submodules clean-emulator clean-contracts bundle-boost apply-generated-files-diff
make -C machine/emulator # Requires docker, necessary for machine bindings
make -C machine/emulator -j8 # Requires docker, necessary for machine bindings

# Run this once after cloning, if using a docker environment
setup-docker: setup build-docker-image
Expand Down
2 changes: 1 addition & 1 deletion machine/emulator
Submodule emulator updated 308 files
2 changes: 1 addition & 1 deletion machine/rust-bindings/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ members = [


[workspace.package]
version = "0.19.0"
version = "0.20.0-test"
edition = "2021"

license = "Apache-2.0"
Expand Down
24 changes: 23 additions & 1 deletion machine/rust-bindings/cartesi-machine-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,28 @@ fn main() {
}
}

// OpenMP linker configuration (cross-platform)
if cfg!(target_os = "macos") {
// macOS: Try Homebrew first, then MacPorts
let homebrew_libomp = PathBuf::from("/opt/homebrew/opt/libomp");
if homebrew_libomp.exists() {
println!("cargo:rustc-link-search={}/lib", homebrew_libomp.display());
println!("cargo:rustc-link-lib=omp");
} else {
let macports_libomp = PathBuf::from("/opt/local/lib/libomp");
if macports_libomp.exists() {
println!("cargo:rustc-link-search=/opt/local/lib/libomp");
println!("cargo:rustc-link-lib=gomp");
} else {
// Fallback: let system linker find it
println!("cargo:rustc-link-lib=omp");
}
}
} else {
// Linux and other Unix-like systems: libgomp comes with GCC
println!("cargo:rustc-link-lib=gomp");
}

//
// Generate bindings
//
Expand Down Expand Up @@ -197,7 +219,7 @@ mod build_cm {
process::{Command, Stdio},
};

const VERSION_STRING: &str = "v0.19.0";
const VERSION_STRING: &str = "v0.20.0-test";

pub fn download(machine_dir_path: &Path) {
let patch_file = machine_dir_path.join("add-generated-files.diff");
Expand Down
Loading