Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: L3 support #437

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8949443
feat : l3 support init
ocdbytes Dec 18, 2024
abc808e
code : refactor
ocdbytes Dec 18, 2024
a49e209
feat : added tests for starknet client
ocdbytes Dec 20, 2024
0d6168e
changelog update
ocdbytes Dec 20, 2024
76bc944
Merge branch 'main' into l3-support
ocdbytes Dec 20, 2024
75229a4
fix : lint
ocdbytes Dec 20, 2024
661cd33
feat: added update state worker test for starknet client
ocdbytes Dec 20, 2024
62fb337
feat : added messaging implementation for l2 client & resolved commen…
ocdbytes Dec 26, 2024
d4aa988
feat : updated l2 messaging implementation
ocdbytes Dec 27, 2024
a4314be
feat : updated l2 messaging implementation
ocdbytes Dec 27, 2024
9dea223
feat : updated messaging logic
ocdbytes Dec 27, 2024
fafd2c3
clients refactoring done
ocdbytes Jan 6, 2025
aa7834e
refactor : tests
ocdbytes Jan 6, 2025
6c1ff95
fix : tests
ocdbytes Jan 7, 2025
26c9319
feat : updated streams and added tests for streams
ocdbytes Jan 14, 2025
2a19391
fix : changed event params in messaging contract
ocdbytes Jan 14, 2025
8abf999
refactor : removed external devnet.yaml file
ocdbytes Jan 14, 2025
749df1c
feat : removed expects
ocdbytes Jan 14, 2025
b63cf61
refactor crates structure
ocdbytes Jan 14, 2025
c837570
merge main
ocdbytes Jan 14, 2025
1d4d3a4
resolved comments
ocdbytes Jan 15, 2025
fffd9dd
refactor
ocdbytes Jan 17, 2025
71c5524
feat : added automock tests and resolved comments
ocdbytes Jan 21, 2025
62d1df3
merge : main
ocdbytes Jan 21, 2025
79ef5ab
refactor
ocdbytes Jan 21, 2025
8657da3
refactor code and comments resolved
ocdbytes Jan 22, 2025
7afd1a3
Merge branch 'main' into l3-support
Mohiiit Feb 1, 2025
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
9 changes: 9 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ jobs:
with:
version: nightly

# TODO : For now madara binary is stored in aws s3 bucket :
# After the proper release binaries are implemented
# We can directly use that and we can remove this
# temporary AWS implementation
- name: Download madara binary for l2 client testing
run: |
curl -L https://madara-test-binary.s3.us-west-1.amazonaws.com/madara-linux -o ./test-artifacts/madara
chmod +x ./test-artifacts/madara

Comment on lines +42 to +50
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we downloading a madara binary for testing instead of running against a build of the code in the pr?

- name: Build and run tests
env:
ETH_FORK_URL: ${{ secrets.ETH_FORK_URL }}
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/rust-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ jobs:
- uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly
- name: Launch Anvil
run: anvil --fork-url $ANVIL_FORK_URL --fork-block-number $ANVIL_BLOCK_NUMBER &
env:
ANVIL_FORK_URL: "https://eth.merkle.io"
ANVIL_BLOCK_NUMBER: 20395662
- name: Wait for Anvil to be ready
run: |
while ! nc -z localhost 8545; do
sleep 1
done
Comment on lines +23 to +32
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure this is necessary? If I remember the rust unit tests should start anvil anyway no?

# TODO : For now madara binary is stored in aws s3 bucket :
# After the proper release binaries are implemented
# We can directly use that and we can remove this
# temporary AWS implementation
- name: Download madara binary for l2 client testing
run: |
curl -L https://madara-test-binary.s3.us-west-1.amazonaws.com/madara-linux -o ./test-artifacts/madara
chmod +x ./test-artifacts/madara
Comment on lines +37 to +40
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto


- name: Run unit tests
run: |
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ tmp/
# Running madara with make and docker compose
.secrets
image.tar.gz

# madara test artifacts for testing l2 clients for appchains
test-artifacts/madara
apoorvsadana marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Next release

- feat : l3 support
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can remove it

- fix(block_production): dynamic block closing now adds special address with prev block hash
- fix(rpc): call, simulate, estimate rpcs executed on top of the block, not at the start of it
- fix(compilation): crate-level compilation
Expand Down
125 changes: 77 additions & 48 deletions Cargo.lock

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

8 changes: 3 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[workspace]
members = [
# madara
"crates/madara/client/db",
"crates/madara/client/exec",
"crates/madara/client/sync",
"crates/madara/client/eth",
"crates/madara/client/settlement_client",
"crates/madara/client/rpc",
"crates/madara/client/gateway/client",
"crates/madara/client/gateway/server",
Expand All @@ -31,11 +30,10 @@ members = [
resolver = "2"
# Everything except test-related packages, so that they are not compiled when doing `cargo build`.
default-members = [
# madara
"crates/madara/client/db",
"crates/madara/client/exec",
"crates/madara/client/sync",
"crates/madara/client/eth",
"crates/madara/client/settlement_client",
"crates/madara/client/gateway/client",
"crates/madara/client/gateway/server",
"crates/madara/client/rpc",
Expand Down Expand Up @@ -129,7 +127,7 @@ mc-rpc = { path = "crates/madara/client/rpc" }
mc-gateway-client = { path = "crates/madara/client/gateway/client" }
mc-gateway-server = { path = "crates/madara/client/gateway/server" }
mc-sync = { path = "crates/madara/client/sync" }
mc-eth = { path = "crates/madara/client/eth" }
mc-settlement-client = { path = "crates/madara/client/settlement_client" }
mc-mempool = { path = "crates/madara/client/mempool" }
mc-block-production = { path = "crates/madara/client/block_production" }
mc-block-import = { path = "crates/madara/client/block_import" }
Expand Down
4 changes: 2 additions & 2 deletions crates/madara/client/db/docs/flat_storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ We may want to remove that flat storage from bonsai-trie as it's not used and we

Instead, we have implemented our own optimized lookup, which is implemented with a column that looks like this:

![schema flat_storage](./flat_storage.png)
![schema flat_storage](flat_storage.png)

The trick here is to rely on the fact that rocksdb columns are sorted trees.
The rocksdb `get` operation does not allow getting the value of (contract_1, key_1) at block 15 here, because
the key has not been modified at that block.
Instead, we use rocksdb iterators.

![schema flat_storage_iterator](./flat_storage_iterator.png)
![schema flat_storage_iterator](flat_storage_iterator.png)

This allows us to get the most recent value for a (contract, key) at that block, by using a single rocksdb lookup.

Expand Down
2 changes: 1 addition & 1 deletion crates/madara/client/devnet/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Devnet predeployed contract addresses

The devnet always has the predeployed contract addresses at these addresses, with these private keys.
They are OpenZeppelin contracts, see [cairo-artifacts](../../../cairo-artifacts/README.md).
They are OpenZeppelin contracts, see [cairo-artifacts](../../../../cairo-artifacts/README.md).
They are also shown on node startup.

```sh
Expand Down
38 changes: 0 additions & 38 deletions crates/madara/client/eth/src/sync.rs

This file was deleted.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the dependencies to use workspace instead of fixed versions to ensure consistency, avoid version conflicts, and simplify dependency management

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
description = "This crate is responsible to handle l1 communication"
name = "mc-eth"
name = "mc-settlement-client"
authors.workspace = true
edition.workspace = true
license.workspace = true
Expand Down Expand Up @@ -35,13 +35,20 @@ starknet_api.workspace = true
# Other
alloy.workspace = true
anyhow.workspace = true
assert_matches = "1.5.0"
bigdecimal.workspace = true
bitvec.workspace = true
futures = { workspace = true, default-features = true }

regex = "1.10.5"
serde = { workspace = true, default-features = true }
serde_json = "1"
starknet-accounts = "0.11.0"
starknet-contract = "0.11.0"
starknet-core = { workspace = true }
starknet-crypto = { workspace = true }
starknet-providers = { workspace = true }
starknet-signers = { workspace = true }
thiserror.workspace = true
time = "0.3.36"
tokio = { workspace = true, features = [
Expand All @@ -54,6 +61,9 @@ url.workspace = true


#Instrumentation
async-trait = { workspace = true }
hex = "0.4.3"
matchers = "0.1.0"
opentelemetry = { workspace = true, features = ["metrics", "logs"] }
opentelemetry-appender-tracing = { workspace = true, default-features = false }
opentelemetry-otlp = { workspace = true, features = [
Expand All @@ -64,6 +74,7 @@ opentelemetry-otlp = { workspace = true, features = [
opentelemetry-semantic-conventions = { workspace = true }
opentelemetry-stdout = { workspace = true }
opentelemetry_sdk = { workspace = true, features = ["rt-tokio", "logs"] }
reqwest = "0.11.27"
tracing = { workspace = true }
tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = { workspace = true }
Expand Down
Loading