Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
GCdePaula committed Jan 14, 2025
1 parent c76d30d commit e9bd3b7
Show file tree
Hide file tree
Showing 69 changed files with 146 additions and 229 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ members = [
"common-rs/arithmetic",

# prt
"prt/client-rs",
"prt/tests/compute-rs",
"prt/client-rs/core",
"prt/client-rs/executable",

# rollups-node
"cartesi-rollups/node/blockchain-reader",
"cartesi-rollups/node/prt-runner",
"cartesi-rollups/node/dave-rollups",
"cartesi-rollups/node/epoch-manager",
"cartesi-rollups/node/machine-runner",
Expand Down Expand Up @@ -48,7 +49,7 @@ cartesi-prt-contracts = { path = "prt/contracts/bindings-rs" }

# rollups-node
rollups-blockchain-reader = { version = "0.1", path = "cartesi-rollups/node/blockchain-reader" }
rollups-compute-runner = { version = "0.1", path = "cartesi-rollups/node/compute-runner" }
rollups-prt-runner = { version = "0.1", path = "cartesi-rollups/node/prt-runner" }
rollups-epoch-manager = { version = "0.1", path = "cartesi-rollups/node/epoch-manager" }
rollups-machine-runner = { version = "0.1", path = "cartesi-rollups/node/machine-runner" }
rollups-state-manager = { version = "0.1", path = "cartesi-rollups/node/state-manager" }
Expand All @@ -58,7 +59,7 @@ cartesi-dave-arithmetic = { path = "common-rs/arithmetic" }
cartesi-dave-merkle = { path = "common-rs/merkle" }

# prt
cartesi-prt-core = { path = "prt/client-rs" }
cartesi-prt-core = { path = "prt/client-rs/core" }


## Dependencies
Expand All @@ -80,6 +81,11 @@ async-trait = "0.1"
futures = "0.3"
tokio = { version = "1", features = ["full"] }

# sqlite
lazy_static = "1.4"
rusqlite = { version = "0.31.0", features = ["bundled"] }
rusqlite_migration = "1.2.0"

clap = { version = "4.5", features = ["derive", "env"] }
hex = "0.4"
log = "0.4"
Expand Down
43 changes: 23 additions & 20 deletions cartesi-rollups/contracts/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,39 @@ default: build

build: build-smart-contracts bind

fmt:
forge fmt

# compile smart contracts
build-smart-contracts:
forge build
forge build

# clean smart contracts artifacts
clean-smart-contracts:
forge clean
forge clean

# clean generated bindings
clean-bindings:
rm -rf {{BINDINGS_DIR}}
rm -rf {{BINDINGS_DIR}}

# generate Rust bindings from Solidity code
bind: clean-bindings
forge bind --alloy --select {{BINDINGS_FILTER}} \
--module --bindings-path {{BINDINGS_DIR}} \
--root {{SRC_DIR}}
forge bind --alloy --select {{BINDINGS_FILTER}} \
--module --bindings-path {{BINDINGS_DIR}} \
--root {{SRC_DIR}}

deploy-dev INITIAL_HASH:
forge script \
script/InputBox.s.sol \
--fork-url {{ANVIL_ENDPOINT}} \
--broadcast \
--sig 'run()' \
-vvvv 2>&1
forge script \
script/DaveConsensus.s.sol \
--fork-url {{ANVIL_ENDPOINT}} \
--broadcast \
--sig 'run(bytes32,address)' \
{{INITIAL_HASH}} \
$(jq -r '.transactions[] | select(.transactionType=="CREATE").contractAddress' broadcast/InputBox.s.sol/{{ANVIL_CHAIN_ID}}/run-latest.json) \
-vvvv 2>&1
forge script \
script/InputBox.s.sol \
--fork-url {{ANVIL_ENDPOINT}} \
--broadcast \
--sig 'run()' \
-vvvv 2>&1
forge script \
script/DaveConsensus.s.sol \
--fork-url {{ANVIL_ENDPOINT}} \
--broadcast \
--sig 'run(bytes32,address)' \
{{INITIAL_HASH}} \
$(jq -r '.transactions[] | select(.transactionType=="CREATE").contractAddress' broadcast/InputBox.s.sol/{{ANVIL_CHAIN_ID}}/run-latest.json) \
-vvvv 2>&1
37 changes: 0 additions & 37 deletions cartesi-rollups/node/Dockerfile.test

This file was deleted.

5 changes: 3 additions & 2 deletions cartesi-rollups/node/blockchain-reader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ cartesi-dave-merkle = { workspace = true }
cartesi-prt-core = { workspace = true }
cartesi-prt-contracts = { workspace = true }

rusqlite = { workspace = true }
rusqlite_migration = { workspace = true }

clap = { workspace = true }
rusqlite = { version = "0.31.0", features = ["bundled"] }
rusqlite_migration = "1.2.0"
4 changes: 2 additions & 2 deletions cartesi-rollups/node/dave-rollups/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = { workspace = true }

[dependencies]
rollups-blockchain-reader = { workspace = true }
rollups-compute-runner = { workspace = true }
rollups-prt-runner = { workspace = true }
rollups-epoch-manager = { workspace = true }
rollups-machine-runner = { workspace = true }
rollups-state-manager = { workspace = true }
Expand All @@ -26,5 +26,5 @@ clap = { workspace = true }
futures = { workspace = true }
tokio = { workspace = true }
log = { workspace = true }
rusqlite = { version = "0.31.0", features = ["bundled"] }
rusqlite = { workspace = true }
env_logger = "0.11.5"
2 changes: 1 addition & 1 deletion cartesi-rollups/node/dave-rollups/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use cartesi_prt_core::arena::{BlockchainConfig, EthArenaSender, SenderFiller};
use clap::Parser;
use log::error;
use rollups_blockchain_reader::{AddressBook, BlockchainReader};
use rollups_compute_runner::ComputeRunner;
use rollups_prt_runner::ComputeRunner;
use rollups_epoch_manager::EpochManager;
use rollups_machine_runner::MachineRunner;
use rollups_state_manager::persistent_state_access::PersistentStateAccess;
Expand Down
2 changes: 1 addition & 1 deletion cartesi-rollups/node/machine-runner/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use cartesi_machine::{
use cartesi_prt_core::machine::constants::{LOG2_EMULATOR_SPAN, LOG2_INPUT_SPAN, LOG2_UARCH_SPAN};
use rollups_state_manager::{InputId, StateManager};

// gap of each leaf in the commitment tree, should use the same value as CanonicalConstants.sol:log2step(0)a
// gap of each leaf in the commitment tree, should use the same value as CanonicalConstants.sol:log2step(0)
const LOG2_STRIDE: u64 = 44;

pub struct MachineRunner<SM: StateManager> {
Expand Down
10 changes: 0 additions & 10 deletions cartesi-rollups/node/machine-runner/test-files/inputs.test

This file was deleted.

This file was deleted.

28 changes: 0 additions & 28 deletions cartesi-rollups/node/machine-runner/test-files/split_inputs.sh

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "rollups-compute-runner"
name = "rollups-prt-runner"
version.workspace = true
authors.workspace = true
description.workspace = true
Expand Down
File renamed without changes.
4 changes: 0 additions & 4 deletions cartesi-rollups/node/rollups-test-entrypoint.sh

This file was deleted.

6 changes: 3 additions & 3 deletions cartesi-rollups/node/state-manager/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ readme = { workspace = true }
repository = { workspace = true }

[dependencies]
rusqlite = { version = "0.31.0", features = ["bundled"] }
rusqlite_migration = "1.2.0"
lazy_static = { workspace = true }
rusqlite = { workspace = true }
rusqlite_migration = { workspace = true }

lazy_static = "1.4.0"
thiserror = { workspace = true }
6 changes: 5 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ update-submodules:
clean-emulator:
make -C machine/emulator clean depclean distclean

setup: update-submodules clean-emulator
download-deps:
just -f ./test/programs/justfile download-deps

build-programs:
just -f ./test/programs/justfile build-programs

setup: update-submodules clean-emulator download-deps build-programs

build-consensus:
just -f ./cartesi-rollups/contracts/justfile build
clean-consensus-bindings:
Expand Down
27 changes: 12 additions & 15 deletions prt/client-rs/Cargo.toml → prt/client-rs/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
[package]
name = "cartesi-prt-core"
version = "0.1.0"

authors = [
"Gabriel Coutinho de Paula <[email protected]>",
"Algebraic Sofia <[email protected]>",
"Stephen Chen <[email protected]>",
]
description = "A Cartesi validator reference implementation"
edition = "2021"
homepage = "https://github.com/cartesi/dave"
license-file = "LICENSE"
readme = "README.md"
repository = "https://github.com/cartesi/dave"

version = { workspace = true}
authors = { workspace = true}
edition = { workspace = true}
homepage = { workspace = true}
license-file = { workspace = true}
readme = { workspace = true}
repository = { workspace = true}

[dependencies]
# common-rs
Expand All @@ -39,11 +35,12 @@ thiserror = { workspace = true }

clap = { workspace = true, features = ["derive", "env"] }
hex = { workspace = true }
lazy_static = "1.4.0"
log = { workspace = true }
num-traits = { workspace = true }
rusqlite = { version = "0.31.0", features = ["bundled"] }
rusqlite_migration = "1.2.0"

lazy_static = { workspace = true }
rusqlite = { workspace = true }
rusqlite_migration = { workspace = true }

serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,19 @@ impl ClockState {
impl std::fmt::Display for ClockState {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
if self.start_instant == 0 {
write!(f, "clock paused, {} seconds left", self.allowance)
write!(f, "clock paused, {} blocks left", self.allowance)
} else {
let time_elapsed = self.block_number - self.start_instant;
if self.allowance >= time_elapsed {
write!(
f,
"clock ticking, {} seconds left",
"clock ticking, {} blocks left",
self.allowance - time_elapsed
)
} else {
write!(
f,
"clock ticking, {} seconds overdue",
"clock ticking, {} blocks overdue",
time_elapsed - self.allowance
)
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit e9bd3b7

Please sign in to comment.