Skip to content

Commit 8e8a9bf

Browse files
committed
Merge branch 'monza' into 0xmovses/ENG-301-e2e-state-reversion-1
2 parents 200210a + 7348635 commit 8e8a9bf

File tree

29 files changed

+911
-432
lines changed

29 files changed

+911
-432
lines changed

.dockerignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.movement
2+
.etc
3+
target

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ target/
55
ledger_db/
66
state_merkle_db/
77
.etc
8+
.movement

Cargo.lock

+309-250
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+40-34
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ monza-opt-executor = { path = "protocol-units/execution/monza/opt-executor" }
3737
monza-fin-executor = { path = "protocol-units/execution/monza/fin-executor" }
3838
monza-execution-util = { path = "protocol-units/execution/monza/util" }
3939
monza-executor = { path = "protocol-units/execution/monza/executor" }
40+
4041
## types
4142
movement-types = { path = "util/movement-types"}
4243
## buildtime
@@ -55,7 +56,7 @@ move-rocks = { path = "protocol-units/mempool/move-rocks" }
5556
sequencing-util = { path = "protocol-units/sequencing/util" }
5657
memseq = { path = "protocol-units/sequencing/memseq" }
5758
# random
58-
rand = "0.8.4"
59+
rand = "0.7.3"
5960

6061
anyhow = "1.0"
6162
# To try (experimental) std support, add `features = [ "std" ]` to risc0-zkvm
@@ -68,10 +69,41 @@ serde = "1.0"
6869
serde_json = "1.0"
6970

7071

71-
tempfile = "3.2.0"
72-
73-
# runtime
74-
tokio = { version = "1.36.0", features = ["fs", "rt-multi-thread"] }
72+
auto_impl = "1.2.0"
73+
chrono = "0.4.37"
74+
serde_with = "3.7.0"
75+
derivative = "2.2.0"
76+
derive_more = { version = "0.99.11", default-features = false }
77+
bytes = { version = "1.2.1", default-features = false }
78+
clap = { version = "4.4.10", features = ["derive"] }
79+
log = "0.4.21"
80+
hex = { version = "0.4.3", default-features = false, features = [
81+
"alloc",
82+
"serde",
83+
] }
84+
async-trait = "0.1.71"
85+
tracing = "0.1.40"
86+
tracing-log = "0.2.0"
87+
env_logger = "0.11.0"
88+
tokio = { version = "1.35.1", features = ["full"] }
89+
tokio-stream = "0.1.15"
90+
async-stream = "0.3.0"
91+
tempfile = "3.5"
92+
fail = "0.5.1"
93+
jsonrpsee = { version = "0.20.1", features = ["jsonrpsee-types"] }
94+
proptest = { version = "1.3.1", default-features = false, features = ["alloc"] }
95+
poem = { version = "=1.3.59", features = ["anyhow", "rustls"] }
96+
poem-openapi = { version = "=2.0.11", features = ["swagger-ui", "url"] }
97+
schemars = { version = "0.8.16", features = ["derive"] }
98+
thiserror = "1.0.50"
99+
x25519-dalek = "1.0.1"
100+
rand_core = "0.5.1"
101+
zstd-sys = "2.0.9"
102+
async-channel = "2.2.1"
103+
sha2 = "0.10.8"
104+
once_cell = "1.8.0"
105+
url = "2.2.2"
106+
dirs = "3.0.2"
75107

76108
# storage
77109
rocksdb = { version = "0.21.0", features = [
@@ -85,7 +117,6 @@ rocksdb = { version = "0.21.0", features = [
85117
# cryptography
86118
jmt = "0.9.0"
87119
trie-db = "0.28.0"
88-
sha2 = "0.10"
89120

90121
# for jmt
91122
digest = "0.10"
@@ -95,43 +126,16 @@ mirai-annotations = "1.10.1"
95126
num-derive = "0.4.2"
96127
num-traits = "0.2.14"
97128
parking_lot = { version = "0.12.1" }
98-
thiserror = { version = "1.0.24" }
99129
blake3 = { version = "1.4.0", features = ["traits-preview"] }
100-
hex = { vesion = "0.4.3", features = ["serde"] }
101-
tracing = "0.1"
102130
ics23 = { version = "0.11.0" }
103131

104-
105-
proptest = "1.0"
106132
proptest-derive = "0.4"
107133

108134
# internal
109135
# tentacles = { path = "protocol-units/cryptography/tentacles" }
110136
move-vm-integration-test-helpers = { path = "test-helpers/move-vm-integration-test-helpers" }
111137
move-vm-ext = { path = "types/move-vm-ext" }
112138

113-
auto_impl = "1.2.0"
114-
chrono = "0.4.37"
115-
serde_with = "3.7.0"
116-
derivative = "2.2.0"
117-
derive_more = { version = "0.99.11", default-features = false }
118-
bytes = { version = "1.2.1", default-features = false }
119-
clap = { version = "4.4.10", features = ["derive"] }
120-
log = "0.4.21"
121-
async-trait = "0.1.71"
122-
tokio-stream = "0.1.15"
123-
async-stream = "0.3.0"
124-
fail = "0.5.1"
125-
jsonrpsee = { version = "0.20.1", features = ["jsonrpsee-types"] }
126-
poem = { version = "=1.3.59", features = ["anyhow", "rustls"] }
127-
poem-openapi = { version = "=2.0.11", features = ["swagger-ui", "url"] }
128-
schemars = { version = "0.8.16", features = ["derive"] }
129-
x25519-dalek = "1.0.1"
130-
rand_core = "0.5.1"
131-
zstd-sys = "2.0.9"
132-
async-channel = "2.2.1"
133-
once_cell = "1.8.0"
134-
url = "2.2.2"
135139

136140
risc0-build = "0.20"
137141

@@ -164,7 +168,9 @@ ethers-middleware = { version = "=2.0.10", default-features = false }
164168
aptos-vm = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
165169
aptos-sdk = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
166170
aptos-consensus-types = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
167-
aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
171+
aptos-crypto = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza", features = [
172+
"cloneable-private-keys",
173+
] }
168174
aptos-db = { git = "https://github.com/movementlabsxyz/aptos-core.git", branch = "monza" }
169175
aptos-api-types = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
170176
aptos-types = { git = "https://github.com/movementlabsxyz/aptos-core", branch = "monza" }
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Nix builder
2+
FROM nixos/nix:latest AS builder
3+
4+
# Copy our source and setup our working dir.
5+
COPY . /tmp/build
6+
WORKDIR /tmp/build
7+
8+
# Build our Nix environment
9+
RUN nix \
10+
--extra-experimental-features "nix-command flakes" \
11+
--option filter-syscalls false \
12+
build
13+
14+
# Copy the Nix store closure into a directory. The Nix store closure is the
15+
# entire set of Nix store values that we need for our build.
16+
RUN mkdir /tmp/nix-store-closure
17+
RUN cp -R $(nix-store -qR result/) /tmp/nix-store-closure
18+
19+
# Final image is based on scratch. We copy a bunch of Nix dependencies
20+
# but they're fully self-contained so we don't need Nix anymore.
21+
FROM scratch
22+
23+
WORKDIR /app
24+
25+
# Copy /nix/store
26+
COPY --from=builder /tmp/nix-store-closure /nix/store
27+
COPY --from=builder /tmp/build/result /app
28+
CMD ["/app/bin/app"]

docker/build/rd/Dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Use the latest Nix image
2+
FROM nixos/nix:latest
3+
4+
# Set up working directory where the flake will be copied
5+
WORKDIR /app
6+
7+
# Copy the flake files into the container
8+
COPY . /app
9+
10+
# Set the entrypoint to use `nix develop` to execute commands within the Nix environment
11+
ENTRYPOINT ["nix", "develop", "--command", "bash", "-c"]

flake.nix

+30-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
flake-utils,
1313
...
1414
}:
15-
flake-utils.lib.eachSystem ["aarch64-darwin" "x86_64-linux"] (
15+
flake-utils.lib.eachSystem ["aarch64-darwin" "x86_64-linux" "aarch64-linux"] (
1616
system: let
1717
overlays = [(import rust-overlay)];
1818
pkgs = import nixpkgs {
@@ -26,6 +26,30 @@
2626

2727
# celestia-app
2828
celestia-app = import ./celestia-app.nix { inherit pkgs; };
29+
30+
# monza-aptos
31+
monza-aptos = pkgs.stdenv.mkDerivation {
32+
pname = "monza-aptos";
33+
version = "branch-monza";
34+
35+
src = pkgs.fetchFromGitHub {
36+
owner = "movementlabsxyz";
37+
repo = "aptos-core";
38+
rev = "06443b81f6b8b8742c4aa47eba9e315b5e6502ff";
39+
sha256 = "sha256-iIYGbIh9yPtC6c22+KDi/LgDbxLEMhk4JJMGvweMJ1Q=";
40+
};
41+
42+
installPhase = ''
43+
cp -r . $out
44+
'';
45+
46+
meta = with pkgs.lib; {
47+
description = "Aptos core repository on the monza branch";
48+
homepage = "https://github.com/movementlabsxyz/aptos-core";
49+
license = licenses.asl20;
50+
};
51+
52+
};
2953

3054
# Specific version of toolchain
3155
rust = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
@@ -65,6 +89,7 @@
6589
testingDependencies = with pkgs; [
6690
celestia-node
6791
celestia-app
92+
monza-aptos
6893
]
6994
++ buildDependencies;
7095

@@ -76,12 +101,16 @@
76101
in
77102
with pkgs; {
78103

104+
# Monza Aptos
105+
packages.monza-aptos = monza-aptos;
106+
79107
# Development Shell
80108
devShells.default = mkShell {
81109
buildInputs = developmentDependencies;
82110

83111
shellHook = ''
84112
#!/bin/bash
113+
export MONZA_APTOS_PATH=$(nix path-info -r .#monza-aptos | tail -n 1)
85114
cat <<'EOF'
86115
_ _ __ _ _ ____ _ _ ____ __ _ ____
87116
( \/ ) / \ / )( \( __)( \/ )( __)( ( \(_ _)

justfile

-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@ m1-da-light-node FEATURES *ARGS:
22
cargo build -p m1-da-light-node
33
scripts/movement/run m1-da-light-node {{ FEATURES }} {{ ARGS }}
44
monza-full-node FEATURES *ARGS:
5-
cargo build -p monza-full-node
65
scripts/movement/run monza-full-node {{ FEATURES }} {{ ARGS }}

monza-aptos.nix

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{ pkgs }:
2+
3+
pkgs.stdenv.mkDerivation {
4+
pname = "monza-aptos";
5+
version = "branch-monza";
6+
7+
src = pkgs.fetchFromGitHub {
8+
owner = "movementlabsxyz";
9+
repo = "aptos-core";
10+
rev = "06443b81f6b8b8742c4aa47eba9e315b5e6502ff";
11+
sha256 = "sha256-bmFcJrC4ocbCw1pew2HKEdLj6+1D/0VuWtdoTs1S2sU=";
12+
};
13+
14+
installPhase = ''
15+
ls -al && sleep 30
16+
mkdir -p $out
17+
cp -r ./* $out/
18+
'';
19+
20+
meta = with pkgs.lib; {
21+
description = "Aptos core repository on the monza branch";
22+
homepage = "https://github.com/movementlabsxyz/aptos-core";
23+
license = licenses.asl20;
24+
};
25+
}

networks/monza/monza-client/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ once_cell = { workspace = true }
1818
tokio = { workspace = true }
1919
url = { workspace = true }
2020
rand = { workspace = true }
21+
monza-execution-util = { workspace = true }
2122

2223
[lints]
2324
workspace = true

networks/monza/monza-client/src/tests/mod.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,25 +8,25 @@ use once_cell::sync::Lazy;
88
use std::str::FromStr;
99
use url::Url;
1010

11+
static MONZA_CONFIG : Lazy<monza_execution_util::config::Config> = Lazy::new(|| {
12+
monza_execution_util::config::Config::try_from_env().context("Failed to create the config").unwrap()
13+
});
14+
1115
// :!:>section_1c
1216
static NODE_URL: Lazy<Url> = Lazy::new(|| {
17+
1318
Url::from_str(
14-
std::env::var("MONZA_FULL_NODE_URL")
15-
.as_ref()
16-
.map(|s| s.as_str())
17-
.unwrap_or("http://localhost:3000"),
18-
)
19-
.unwrap()
19+
format!("http://{}", MONZA_CONFIG.monza_config.aptos_rest_listen_url.as_str()).as_str()
20+
).unwrap()
21+
2022
});
2123

2224
static FAUCET_URL: Lazy<Url> = Lazy::new(|| {
25+
2326
Url::from_str(
24-
std::env::var("MONZA_FAUCET_URL")
25-
.as_ref()
26-
.map(|s| s.as_str())
27-
.unwrap_or("http://localhost:8081"),
28-
)
29-
.unwrap()
27+
format!("http://{}", MONZA_CONFIG.monza_config.aptos_faucet_listen_url.as_str()).as_str()
28+
).unwrap()
29+
3030
});
3131
// <:!:section_1c
3232

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[package]
2+
name = "monza-config"
3+
description = "Config tool for Monza"
4+
authors = { workspace = true }
5+
edition = { workspace = true }
6+
homepage = { workspace = true }
7+
license = { workspace = true }
8+
repository = { workspace = true }
9+
10+
version = { workspace = true }
11+
12+
[lib]
13+
path = "src/lib.rs"
14+
15+
[[bin]]
16+
name = "monza-config"
17+
path = "src/bin/monza_config.rs"
18+
19+
[dependencies]
20+
monza-execution-util = { workspace = true }
21+
anyhow = { workspace = true }
22+
tokio = { workspace = true }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use monza_config::Config;
2+
3+
#[tokio::main]
4+
async fn main() -> Result<(), anyhow::Error> {
5+
// read any values from env, but populate the default values if they are not present
6+
let config = Config::try_from_env()?;
7+
// write the values to the env
8+
print!("{}", config.write_bash_export_string()?);
9+
Ok(())
10+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#[derive(Debug, Clone, PartialEq, Eq)]
2+
pub struct Config {
3+
pub execution_config : monza_execution_util::config::Config,
4+
}
5+
6+
impl Config {
7+
8+
pub fn new(execution_config : monza_execution_util::config::Config) -> Self {
9+
Self {
10+
execution_config,
11+
}
12+
}
13+
14+
pub fn try_from_env() -> Result<Self, anyhow::Error> {
15+
16+
let execution_config = monza_execution_util::config::Config::try_from_env()?;
17+
18+
Ok(Self {
19+
execution_config,
20+
})
21+
22+
}
23+
24+
pub fn write_to_env(&self) -> Result<(), anyhow::Error>{
25+
self.execution_config.write_to_env()?;
26+
Ok(())
27+
}
28+
29+
pub fn write_bash_export_string(&self) -> Result<String, anyhow::Error> {
30+
Ok(format!(
31+
"{}",
32+
self.execution_config.write_bash_export_string()?
33+
))
34+
}
35+
36+
}

0 commit comments

Comments
 (0)