Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
suffix-version:
description: 'Suffix of Cartesi Machine to install'
required: false
Expand Down
8 changes: 4 additions & 4 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
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
- name: Download PRT contracts
working-directory: ./prt/contracts
run: |
Expand Down Expand Up @@ -138,8 +138,8 @@ jobs:
working-directory: ./machine/emulator
run: |
make bundle-boost
wget -O add-generated-files.diff https://github.com/cartesi/machine-emulator/releases/download/v0.19.0/add-generated-files.diff
echo "a892e2d9f5c331f5e80bcb5db4133e7db625aa4d14ffdf9467b75c4c34d1744f add-generated-files.diff" | sha256sum -c
wget -O add-generated-files.diff https://github.com/cartesi/machine-emulator/releases/download/v0.20.0/add-generated-files.diff
echo "d9c2afcefc2759e7cd37bbedc83d54c81515f0fddb671103b489b8789aee33bb add-generated-files.diff" | sha256sum -c
git apply add-generated-files.diff
rm add-generated-files.diff
make
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 @@ -242,7 +242,7 @@ contract DaveConsensus is IDaveConsensus, ERC165, ApplicationChecker {

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)),
LibKeccak256.hashPair
);
Expand Down
2 changes: 1 addition & 1 deletion cartesi-rollups/contracts/test/DaveAppFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ contract DaveAppFactoryTest is Test {

bytes32[] memory outputsMerkleRootProof = _randomProof(Memory.LOG2_MAX_SIZE);
bytes32 machineMerkleRoot = outputsMerkleRootProof.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
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 @@ -572,7 +572,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
6 changes: 3 additions & 3 deletions cartesi-rollups/node/state-manager/src/rollups_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cartesi_prt_core::machine::constants::{
use crate::{CommitmentLeaf, Proof};
use cartesi_machine::{
config::runtime::{HTIFRuntimeConfig, RuntimeConfig},
constants::{break_reason, pma::TX_START},
constants::{break_reason, machine::TREE_LOG2_ROOT_SIZE, pma::TX_START},
error::{MachineError, MachineResult},
machine::Machine,
types::{
Expand Down Expand Up @@ -45,7 +45,7 @@ pub const STRIDE_COUNT_IN_EPOCH: u64 = 1
<< (LOG2_INPUT_SPAN_TO_EPOCH + LOG2_BARCH_SPAN_TO_INPUT + LOG2_UARCH_SPAN_TO_BARCH
- LOG2_STRIDE);

pub const CHECKPOINT_ADDRESS: u64 = 0x7ffff000;
pub const CHECKPOINT_ADDRESS: u64 = 0xfe0;

pub struct RollupsMachine {
machine: Machine,
Expand Down Expand Up @@ -88,7 +88,7 @@ impl RollupsMachine {
}

pub fn outputs_proof(&mut self) -> MachineResult<(Hash, Proof)> {
let proof = self.machine.proof(TX_START, 5)?;
let proof = self.machine.proof(TX_START, 5, TREE_LOG2_ROOT_SIZE)?;
let siblings = Proof::new(proof.sibling_hashes);
let output_merkle = self.machine.read_memory(TX_START, 32)?;

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" FILEHASH="a892e2d9f5c331f5e80bcb5db4133e7db625aa4d14ffdf9467b75c4c34d1744f":
apply-generated-files-diff VERSION="v0.20.0" FILEHASH="d9c2afcefc2759e7cd37bbedc83d54c81515f0fddb671103b489b8789aee33bb":
cd machine/emulator && \
(wget -O add-generated-files.diff https://github.com/cartesi/machine-emulator/releases/download/{{VERSION}}/add-generated-files.diff && \
(echo "{{FILEHASH}} add-generated-files.diff" | sha256sum -c) && \
Expand All @@ -18,7 +18,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 366 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"
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");
}
Comment thread
mpolitzer marked this conversation as resolved.
}
} else {
// Linux and other Unix-like systems: libgomp comes with GCC
println!("cargo:rustc-link-lib=gomp");
Comment thread
mpolitzer marked this conversation as resolved.
}

//
// 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";

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