Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
1e933b9
feat: reusable offchain workers
palozano Oct 9, 2024
9fc8be8
chore: add receive lib abi
palozano Oct 9, 2024
9d720c5
chore: fix overall flow
palozano Oct 10, 2024
9e1c1ee
chore: preparing for deployment, lacking correct header
palozano Oct 10, 2024
1b02a1e
chore: ordering
palozano Oct 11, 2024
d4b3c53
refactor: more modular for later executor
palozano Oct 15, 2024
a9508f8
chore: clean up
palozano Oct 15, 2024
af548f8
refactor: dotenv -> dotenvy
palozano Oct 15, 2024
f825036
chore: remove Cargo.lock
palozano Oct 15, 2024
131c351
refactor: move config to `config-rs` crate
palozano Oct 15, 2024
4a5cc5c
refactor: move to manual decoding
palozano Oct 16, 2024
4894f4a
chore: modularize
palozano Oct 17, 2024
290bb85
chore: address pr comments on the worker
palozano Oct 17, 2024
263cb0e
chore: move some files to lib imports
palozano Oct 17, 2024
b9b81fb
chore: remove unused tests for now
palozano Oct 17, 2024
62994a8
chore: reorder imports
palozano Oct 17, 2024
5da950a
wip: fix dockerfile so it doesn't break current indexer
serrrfirat Oct 16, 2024
58d2454
wip: fix docker compose for setups
serrrfirat Oct 16, 2024
c5359dc
wip: big cargo clean up
serrrfirat Oct 16, 2024
f1624fd
chore: remove unused
palozano Oct 17, 2024
5bf79ef
chore: add tests to manual decoding
palozano Oct 17, 2024
90c0e70
chore: use const instead of magic number
palozano Oct 17, 2024
1433aac
chore: comments
palozano Oct 17, 2024
9293854
chore: address pr comments
palozano Oct 17, 2024
ce2d6e6
chore: address pr comments
palozano Oct 18, 2024
2d9d590
Update indexer/Dockerfile
palozano Oct 18, 2024
ed43e71
chore: fix after refactor
palozano Oct 18, 2024
0ed696f
chore: bls bn254 signature takes two uint256
palozano Oct 18, 2024
ec06783
chore: remove v1 contract, leaving only v2 (without version suffix)
palozano Oct 18, 2024
20a711c
chore: address comments
palozano Oct 20, 2024
b19f68e
chore: address pr comments
palozano Oct 21, 2024
1c9a7d9
Implement /state-root endpoint specifically for serving state root me…
Fly-Style Oct 21, 2024
7fe1ce9
WIP: Verifier and integration test for a verifier
Fly-Style Oct 22, 2024
20ef139
chore: remove alloy-json-abi as external dep
palozano Oct 22, 2024
fbedff6
chore: broken test to share
palozano Oct 22, 2024
2931fee
chore: fix after rebase
palozano Oct 22, 2024
69eae56
WIP: Verifier and integration test for a verifier
Fly-Style Oct 21, 2024
5cbfb64
refactor: manual encode/decode
palozano Oct 22, 2024
22af924
chore: remove unused
palozano Oct 23, 2024
c3bcb04
Merge branch 'palozano/feat/workers' of https://github.com/palozano/n…
Fly-Style Oct 23, 2024
0dc5dfa
WIP: Verifier V1 according to algorithm
Fly-Style Oct 23, 2024
90b5f5c
Fix test
Fly-Style Oct 24, 2024
d0fdf0a
Small notes
Fly-Style Oct 24, 2024
e2957b1
Merge branch 'main' into feat/nuf-176
Fly-Style Oct 24, 2024
2b42a24
Get rid of fastnear, should be added as separate PR
Fly-Style Oct 24, 2024
60509bf
Dont change gitignore
Fly-Style Oct 24, 2024
14916fc
Cleanup
Fly-Style Oct 24, 2024
f8cbb1f
AI review comments
Fly-Style Oct 24, 2024
f61cb8b
Fixes compilation error in `block_listener` test suite
Fly-Style Oct 2, 2024
cdd1714
AI review comments-2
Fly-Style Oct 24, 2024
6336376
Try to make CI happier
Fly-Style Oct 24, 2024
2aa63d2
Revert changes, fix them in a separate PR
Fly-Style Oct 24, 2024
c8d6e36
Tokio :)
Fly-Style Oct 24, 2024
46cd2b4
Another review round
Fly-Style Oct 24, 2024
93f4434
Timeout handling
Fly-Style Oct 25, 2024
65e544f
Revert back
Fly-Style Oct 25, 2024
1359374
Add tests
Fly-Style Oct 25, 2024
d417889
Timeout test
Fly-Style Oct 25, 2024
4372826
Update verifier.rs
Fly-Style Oct 28, 2024
5296a3f
Review comments
Fly-Style Oct 28, 2024
cecfd88
Merge branch 'feat/nuf-176' of https://github.com/Fly-Style/nffl into…
Fly-Style Oct 28, 2024
39317dd
Revert "Implement /state-root endpoint specifically for serving state…
Fly-Style Oct 28, 2024
1195060
Review comments-2
Fly-Style Oct 28, 2024
8a8538a
Format
Fly-Style Oct 28, 2024
0e9752a
Renamed the method according to the actual object
Fly-Style Oct 28, 2024
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
5,968 changes: 1,039 additions & 4,929 deletions Cargo.lock

Large diffs are not rendered by default.

27 changes: 12 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ resolver = "2"
members = [
"indexer",
"contracts/evm/test/ffi/bls-utils",
"relayer-rs",
"operator-rs",
"core-rs",
"workers",
]

Expand All @@ -19,26 +16,26 @@ repository = "https://github.com/NethermindEth/near-sffl"
[workspace.dependencies]
alloy = { version = "0.4.2", features = ["full", "node-bindings", "rpc-types-debug", "rpc-types-trace", "json-rpc", "rpc-client", "serde", "json-abi"] }
alloy-primitives = "0.8.3"
alloy-rlp = "0.3.8"
alloy-rpc-client = "0.4.2"
alloy-rpc-types = "0.4.2"
alloy-transport-ws = "0.4.2"
alloy-rlp = "0.3.8"
tokio = { version = "1.0", features = ["full"] }
anyhow = "1.0.79"
async-trait = "0.1"
bincode = "1.3"
clap = "4.5.18"
eyre = "0.6"
futures-util = "0.3.30"
log = "0.4"
prometheus = "0.13"
reqwest = "0.12.8"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
anyhow = "1.0"
tracing = "0.1"
tracing-subscriber = "0.3"
futures-util = "0.3.30"
eyre = "0.6"
bincode = "1.3"
serde_yaml = "0.9"
clap = "4.5.18"
tempfile = "3.10.0"
async-trait = "0.1"
log = "0.4"
core-rs = { path = "core-rs" }
tokio = { version = "1", features = ["full"] }
tracing = "0.1"
tracing-subscriber = "0.3"

[patch.crates-io]
parity-secp256k1 = { git = 'https://github.com/paritytech/rust-secp256k1.git' }
3 changes: 3 additions & 0 deletions indexer/src/block_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ mod tests {
gas: 100,
deposit: 100,
}],
priority_fee: 0,
signature: Signature::default(),
hash: CryptoHash::default(),
},
Expand All @@ -355,6 +356,7 @@ mod tests {
nonce: 0,
receiver_id: da_contract_id,
actions: vec![ActionView::CreateAccount],
priority_fee: 0,
signature: Signature::default(),
hash: CryptoHash::default(),
},
Expand Down Expand Up @@ -415,6 +417,7 @@ mod tests {
nonce: 0,
receiver_id: da_contract_id.clone(),
actions,
priority_fee: 0,
signature: Signature::default(),
hash: CryptoHash::hash_bytes(b"test_tx_id"),
},
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions workers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,12 @@ bytes = "1.7.2"
config = { version = "0.14.0", features = ["toml"] }
eyre.workspace = true
futures = "0.3.31"
reqwest.workspace = true
serde.workspace = true
serde_json.workspace = true
tokio.workspace = true
tracing.workspace = true
tracing-subscriber = {workspace = true, features = ["env-filter"] }

[dev-dependencies]
wiremock = "0.6.2"
16 changes: 13 additions & 3 deletions workers/src/bin/dvn.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
//! Main offchain workflow for Nuff DVN.
//! Main off-chain workflow for Nuff DVN.

use alloy::primitives::U256;
use eyre::{OptionExt, Result};
use futures::stream::StreamExt;
use tracing::{debug, error, info, warn};
use tracing_subscriber::EnvFilter;
use workers::data::dvn::Dvn;
use workers::verifier::NFFLVerifier;
use workers::{
abi::{L0V2EndpointAbi::PacketSent, SendLibraryAbi::DVNFeePaid},
chain::{
connections::{build_subscriptions, get_abi_from_path, get_http_provider},
contracts::{create_contract_instance, query_already_verified, query_confirmations, verify},
},
data::dvn::Dvn,
};

#[tokio::main]
Expand All @@ -23,6 +24,7 @@ async fn main() -> Result<()> {
.init();

let mut dvn_data = Dvn::new_from_env()?;
let verifier = NFFLVerifier::new_from_config(&dvn_data.config).await?;

// Create the WS subscriptions for listening to the events.
let (_provider, mut endpoint_stream, mut sendlib_stream) = build_subscriptions(&dvn_data.config).await?;
Expand Down Expand Up @@ -92,7 +94,15 @@ async fn main() -> Result<()> {
dvn_data.verifying();
debug!("Packet NOT verified. Calling verification.");

// FIXME: logic for NFFL verification
if log.block_number.is_none() {
error!("Block number is None, can't verify Packet.");
continue;
}

if !verifier.verify(log.block_number.unwrap()).await? {
error!("Failed to verify the state root.");
continue;
}

verify(
&receivelib_contract,
Expand Down
2 changes: 2 additions & 0 deletions workers/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ pub struct DVNConfig {
pub network_eid: u64,
/// Own DVN address. Used to check when the DVN is assigned to a task.
pub dvn_addr: Address,
/// NFFL Aggregator URL
pub aggregator_url: String,
}

impl DVNConfig {
Expand Down
1 change: 1 addition & 0 deletions workers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pub mod abi;
pub mod chain;
pub mod config;
pub mod data;
pub mod verifier;
Loading