Skip to content

Commit 0d8b13f

Browse files
authored
Merge pull request #13 from movementlabsxyz/0xmovses/ENG-111-aptos-rpc
Create RPC endpoints `AptosVM` and `AptosDb` and primitive types
2 parents c74e397 + 5334afb commit 0d8b13f

30 files changed

+2404
-32
lines changed

.gitmodules

-18
This file was deleted.

.idea/.gitignore

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

.idea/codeStyles/codeStyleConfig.xml

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

.idea/modules.xml

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

.idea/sdk.iml

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

.idea/vcs.xml

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

Cargo.toml

+86-13
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,48 @@ resolver = "2"
55
members = [
66
"m2/rollup",
77
"m2/stf",
8+
"protocol-units/sov-aptos",
9+
"protocol-units/sov-modules/sov-aptos-vm"
810
]
911

12+
[workspace.features]
13+
sov-aptos = ["experimental"]
14+
1015
[workspace.package]
1116
version = "0.3.0"
1217
edition = "2021"
1318
license = "MIT OR Apache-2.0"
1419
authors = ["Movement Labs"]
20+
repository = "www.github.com/movementlabs"
21+
homepage = "www.homepage.com"
1522
publish = false
1623
rust-version = "1.73"
1724

1825
[workspace.dependencies]
26+
auto_impl = "1.2.0"
27+
serde = { version = "1.0.192", features = ["derive", "rc"] }
28+
serde_json = { version = "1.0.81", features = [
29+
"preserve_order",
30+
"arbitrary_precision",
31+
] } # Note: arbitrary_precision is required to parse u256 in JSON
32+
anyhow = "1.0.68"
33+
derive_more = { version = "0.99.11", default-features = false }
34+
bytes = { version = "1.2.1", default-features = false }
35+
clap = { version = "4.4.10", features = ["derive"] }
36+
hex = { version = "0.4.3", default-features = false, features = ["alloc", "serde"] }
37+
async-trait = "0.1.71"
38+
borsh = { version = "0.10.3", features = ["rc", "bytes"] }
39+
tracing = "0.1.40"
40+
tokio = { version = "1.35.1", features = ["full"] }
41+
tempfile = "3.5"
42+
jsonrpsee = { version = "0.20.1", features = ["jsonrpsee-types"] }
43+
proptest = { version = "1.3.1", default-features = false, features = ["alloc"] }
44+
poem-openapi = { version = "=2.0.11", features = ["swagger-ui", "url"] }
45+
schemars = { version = "0.8.16", features = ["derive"] }
46+
thiserror = "1.0.50"
47+
x25519-dalek = "2.0.1"
48+
49+
# Sovereign Labs dependencies
1950
sov-modules-api = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
2051
sov-state = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
2152
sov-accounts = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
@@ -29,25 +60,67 @@ sov-db = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", re
2960
sov-sequencer = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3061
sov-rollup-interface = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3162
sov-risc0-adapter = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
32-
sov-mock-zkvm = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
63+
sov-mock-zkvm = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3364
sov-first-read-last-write-cache = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3465
sov-cli = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3566
sov-mock-da = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3667
sov-celestia-adapter = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3768
sov-prover-storage-manager = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
69+
sov-chain-state = { git = "ssh://git@github.com/Sovereign-Labs/sovereign-sdk-wip.git", rev = "517e99e558513e24983d8d09ef16a73675ea1a1b" }
3870

39-
stf-starter = { path = "./crates/stf" }
71+
risc0-build = "0.20"
4072

41-
serde = { version = "1.0.192", features = ["derive", "rc"] }
42-
serde_json = { version = "1.0" }
73+
# aptos dependencies
74+
ethereum-types = "0.14.1"
75+
ethers = "=2.0.10"
76+
ethers-core = { version = "=2.0.10", default-features = false }
77+
ethers-contract = "=2.0.10"
78+
ethers-providers = { version = "=2.0.10", default-features = false }
79+
ethers-signers = { version = "=2.0.10", default-features = false }
80+
ethers-middleware = { version = "=2.0.10", default-features = false }
81+
82+
# Aptos dependencies
83+
# We use a forked version so that we can override dependency versions. This is required
84+
# to be avoid depenedency conflicts with other Sovereign Labs crates.
85+
aptos-sdk = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
86+
aptos-consensus-types = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
87+
aptos-crypto = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
88+
aptos-db = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
89+
aptos-api-types = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
90+
aptos-api = { git = "https://github.com/0xmovses/aptos-core", rev = "d3cc82ac6739bd1b9f2f532ddfe79fc261dceb5d" }
91+
92+
# https://github.com/paradigmxyz/reth/tree/c0655fed8915490f82d4acf8900a16a10554cbfb
93+
reth-primitives = { git = "https://github.com/paradigmxyz/reth", rev = "c0655fed8915490f82d4acf8900a16a10554cbfb", default-features = false }
94+
reth-interfaces = { git = "https://github.com/paradigmxyz/reth", rev = "c0655fed8915490f82d4acf8900a16a10554cbfb" }
95+
reth-rpc-types = { git = "https://github.com/paradigmxyz/reth", rev = "c0655fed8915490f82d4acf8900a16a10554cbfb" }
96+
reth-rpc-types-compat = { git = "https://github.com/paradigmxyz/reth", rev = "c0655fed8915490f82d4acf8900a16a10554cbfb" }
97+
reth-revm = { git = "https://github.com/paradigmxyz/reth", rev = "c0655fed8915490f82d4acf8900a16a10554cbfb" }
98+
99+
# Matches reth dependency. Using exact revision for matching our tightly coupled usage of both reth and revm crates
100+
revm = { version = "5.0.0", default-features = false, features = ["serde"] }
101+
# Used just to be safe about breaking changes
102+
revm-primitives = { version = "=2.0.0", default-features = false }
103+
secp256k1 = { version = "0.27", default-features = false, features = ["global-context", "rand-std", "recovery"] }
104+
105+
[workspace.lints.rust]
106+
dead_code = "deny"
107+
unused_imports = "deny"
108+
non_ascii_idents = "deny" # Bad for readability and it can also be a security vulnerability
109+
110+
# In case you need inspiration for new lints to add to the list, this is a good
111+
# reference: <https://github.com/EmbarkStudios/rust-ecosystem/blob/6783ae1573d62f3f5439b8ff9e04bec191ec2eaf/lints.toml>.
112+
[workspace.lints.clippy]
113+
debug_assert_with_mut_call = "deny"
114+
inefficient_to_string = "deny"
115+
map_flatten = "deny"
116+
manual_ok_or = "deny"
117+
doc_link_with_quotes = "deny"
118+
match_same_arms = "deny"
119+
semicolon_if_nothing_returned = "deny"
43120

44-
anyhow = "1.0.68"
45-
clap = { version = "4.4.10", features = ["derive"] }
46-
async-trait = "0.1.71"
47-
borsh = { version = "0.10.3", features = ["rc", "bytes"] }
48-
tracing = "0.1.40"
49-
tokio = { version = "1", features = ["full"] }
50-
tempfile = "3.5"
51-
jsonrpsee = { version = "0.20.1", features = ["jsonrpsee-types"] }
52121

53-
risc0-build = "0.20"
122+
[patch.crates-io]
123+
merlin = { git = "https://github.com/aptos-labs/merlin" }
124+
x25519-dalek = { git = "https://github.com/aptos-labs/x25519-dalek", branch = "zeroize_v1" }
125+
sha2 = { git = "https://github.com/risc0/RustCrypto-hashes", tag = "sha2-v0.10.8-risczero.0" }
126+
ed25519-dalek = { git = "https://github.com/risc0/curve25519-dalek", tag = "curve25519-4.1.0-risczero.1" }

m2/provers/risc0/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
publish = false
88

99
[build-dependencies]
10-
risc0-build = { workspace = true }
10+
risc0-build = { workpsace = true }
1111

1212
[package.metadata.risc0]
1313
methods = ["guest-celestia", "guest-mock"]

m2/rollup/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tracing = { workspace = true }
3838
serde_json = { workspace = true }
3939
jsonrpsee = { workspace = true }
4040
tokio = { workspace = true }
41+
subtle = "2.5.0"
4142

4243
m2-risc0 = { path = "../provers/risc0" }
4344
m2-stf = { path = "../stf", features = ["native"] }

protocol-units/sov-aptos/Cargo.toml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
[package]
2+
name = "sov-aptos"
3+
authors = { workspace = true }
4+
edition = { workspace = true }
5+
license = { workspace = true }
6+
repository = { workspace = true }
7+
8+
version = { workspace = true }
9+
readme = "README.md"
10+
resolver = "2"
11+
publish = false
12+
13+
[dependencies]
14+
anyhow = { workspace = true }
15+
tracing = { workspace = true }
16+
jsonrpsee = { workspace = true, features = ["http-client", "server"] }
17+
sov-rollup-interface = { workspace = true, features = [
18+
"native",
19+
] }
20+
21+
aptos-sdk = { workspace = true }
22+
sov-aptos-vm = { path = "../sov-modules/sov-aptos-vm" }
23+
m2-stf = { path = "../../m2/stf", features = ["native"] }
24+
sov-modules-api = { workspace = true }
25+
sov-accounts = { workspace = true }
26+
27+
borsh = { workspace = true }
28+
serde = { workspace = true }
29+
serde_json = { workspace = true }
30+
31+
reth-primitives = { workspace = true }
32+
reth-rpc-types = { workspace = true }
33+
34+
ethers = { workspace = true }
35+
tokio = { workspace = true }
36+
schnellru = "0.2.1"
37+
38+
[dev-dependencies]
39+
tokio = { workspace = true }
40+
proptest = { workspace = true }
41+
42+
[features]
43+
default = []
44+
local = []
45+
native = ["m2-stf/native"]

protocol-units/sov-aptos/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn some_fn() {
2+
todo!()
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[package]
2+
name = "sov-aptos-vm"
3+
description = "A Sovereign Labs compatible AptosVM implementation"
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+
readme = "README.md"
12+
resolver = "2"
13+
publish = false
14+
15+
[dependencies]
16+
auto_impl = { workspace = true }
17+
sov-modules-api = { workspace = true }
18+
sov-state = { workspace = true }
19+
sov-chain-state = { workspace = true }
20+
21+
anyhow = { workspace = true }
22+
thiserror = { workspace = true }
23+
bytes = { workspace = true }
24+
schemars = { workspace = true, optional = true }
25+
clap = { workspace = true, optional = true }
26+
serde = { workspace = true }
27+
serde_json = { workspace = true, optional = true }
28+
borsh = { workspace = true, features = ["rc"] }
29+
hex = { workspace = true }
30+
poem-openapi = { workspace = true }
31+
jsonrpsee = { workspace = true, features = [
32+
"macros",
33+
"client-core",
34+
"server"] }
35+
tracing = { workspace = true }
36+
derive_more = { workspace = true, default-features = true }
37+
lazy_static = "1.4.0"
38+
secp256k1 = { workspace = true }
39+
40+
aptos-sdk = { workspace = true }
41+
aptos-crypto = { workspace = true }
42+
aptos-consensus-types = { workspace = true }
43+
aptos-db = { workspace = true }
44+
aptos-api = { workspace = true }
45+
aptos-api-types = { workspace = true }
46+
47+
48+
alloy-sol-types = { version = "0.6" }
49+
revm = { workspace = true, features = [
50+
"optional_block_gas_limit",
51+
"optional_eip3607",
52+
"optional_no_base_fee",
53+
"std",
54+
"secp256k1"
55+
] }
56+
reth-primitives = { workspace = true }
57+
reth-rpc-types = { workspace = true }
58+
reth-rpc-types-compat = { workspace = true }
59+
reth-interfaces = { workspace = true, optional = true }
60+
reth-revm = { workspace = true }
61+
revm-primitives = { workspace = true }
62+
63+
# For test-utils
64+
ethereum-types = { workspace = true, optional = true }
65+
ethers-core = { workspace = true, optional = true }
66+
ethers-contract = { workspace = true, optional = true }
67+
ethers-signers = { workspace = true, optional = true }
68+
69+
[dev-dependencies]
70+
# sov-aptos = { path = ".", features = ["smart_contracts"] }
71+
# tokio = { workspace = true }
72+
# tempfile = { workspace = true }
73+
# bytes = { workspace = true }
74+
# sov-prover-storage-manager = { path = "../../../full-node/sov-prover-storage-manager", features = ["test-utils"] }
75+
# sov-mock-da = { path = "../../../adapters/mock-da", features = ["native"] }
76+
# sov-test-utils = { path = "../../sov-test-utils" }
77+
78+
[features]
79+
default = []
80+
native = [
81+
"clap",
82+
"reth-interfaces",
83+
#"reth-revm",
84+
# Optional for speed up in native mode
85+
# "revm/asm-keccak"
86+
"schemars",
87+
"serde_json",
88+
"sov-chain-state/native",
89+
]
90+
# For testing smart contract
91+
smart_contracts = [
92+
"ethereum-types",
93+
"ethers-contract",
94+
"ethers-core",
95+
"ethers-signers",
96+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `sov-aptos` module
2+
3+
The sov-aptos module provides compatibility with the aptos.
4+
5+
The module `CallMessage` contains `rlp` encoded Ethereum transaction, which is validated & executed immediately after being dispatched from the DA. Once all transactions from the DA slot have been processed, they are grouped into an `Ethereum` block. Users can access information such as receipts, blocks, transactions, and more through standard Ethereum endpoints.
6+
7+
## Note to developers (hooks.rs)
8+
9+
WARNING: `prevrandao` value is predictable up to `DEFERRED_SLOTS_COUNT` in advance,
10+
Users should follow the same best practice that they would on Ethereum and use future randomness.
11+
See: `<https://eips.ethereum.org/EIPS/eip-4399#tips-for-application-developers>`

0 commit comments

Comments
 (0)