Skip to content
This repository was archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
fixes, imports
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed Jan 17, 2024
1 parent 987d4e3 commit 2a3f086
Show file tree
Hide file tree
Showing 8 changed files with 1,129 additions and 425 deletions.
1,513 changes: 1,104 additions & 409 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 11 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,27 @@ redis = { version = "0.23.3", features = [
] }

dotenv = "0.15.0"
avail-subxt = { git = "https://github.com/availproject/avail.git", rev = "df16508" }
avail-subxt = { git = "https://github.com/availproject/avail.git", rev = "e976c56" }
subxt = { version = "0.29" }
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0", default-features = false }
sha2 = { version = "0.10.8", default-features = false }
sp-core = { version = "21.0.0", default-features = false }
codec = { package = "parity-scale-codec", version = "3", default-features = false, features = [
"derive",
"full",
"bit-vec",
] }
alloy-sol-types = "0.4.2"
alloy-primitives = "0.4.2"
subxt = "0.29"
anyhow = "1.0.68"
clap = "4.4.9"
rs_merkle = "1.4.1"
[dev-dependencies]
anyhow = "1.0.68"

# Dependency `subxt` uses it's own 'version' of sp-core so we need to patch it :)
[patch.crates-io]
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-io = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-runtime = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-std = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
sp-core-hashing = { git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v1.0.0" }
2 changes: 1 addition & 1 deletion bin/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
use std::env;

use avail_subxt::config::Header;
use clap::Parser;
use log::info;
use subxt::config::Header;
use vectorx::input::RpcDataFetcher;

#[derive(Parser, Debug, Clone)]
Expand Down
7 changes: 5 additions & 2 deletions bin/indexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use std::ops::Deref;

use avail_subxt::api;
use avail_subxt::config::Header as HeaderTrait;
use avail_subxt::subxt_rpc::RpcParams;
use codec::Encode;
use log::debug;
use plonky2x::frontend::ecc::curve25519::ed25519::eddsa::DUMMY_SIGNATURE;
use sp_core::ed25519::{self};
use sp_core::{blake2_256, Pair, H256};
use subxt::rpc::RpcParams;
use vectorx::input::types::{GrandpaJustification, SignerMessage, StoredJustificationData};
use vectorx::input::RpcDataFetcher;

Expand All @@ -35,7 +35,10 @@ pub async fn main() {
);

let mut fetcher = RpcDataFetcher::new().await;
let sub: Result<avail_subxt::rpc::Subscription<GrandpaJustification>, subxt::Error> = fetcher
let sub: Result<
avail_subxt::subxt_rpc::Subscription<GrandpaJustification>,
subxt::error::Error,
> = fetcher
.client
.rpc()
.deref()
Expand Down
5 changes: 2 additions & 3 deletions circuits/builder/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,7 @@ impl<L: PlonkParameters<D>, const D: usize> DecodingMethods for CircuitBuilder<L
.zip(header_hashes.as_vec().iter())
.map(|(header, header_hash)| self.decode_header::<S>(header, header_hash))
.collect::<Vec<HeaderVariable>>()
.try_into()
.unwrap()
.into()
}

/// Decode a header into its components. header_hash is used for the RLC challenge.
Expand Down Expand Up @@ -324,7 +323,7 @@ pub mod tests {
let header_len = header.len();
header.resize(MAX_HEADER_SIZE, 0);
EncodedHeader {
header_bytes: header.as_slice().try_into().unwrap(),
header_bytes: header.as_slice().into(),
header_size: header_len as u32,
}
})
Expand Down
5 changes: 2 additions & 3 deletions circuits/builder/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ impl<L: PlonkParameters<D>, const D: usize> HeaderMethods for CircuitBuilder<L,
.iter()
.map(|x| self.hash_encoded_header::<MAX_HEADER_SIZE, MAX_CHUNK_SIZE>(x))
.collect::<Vec<Bytes32Variable>>()
.try_into()
.unwrap()
.into()
}
}

Expand Down Expand Up @@ -187,7 +186,7 @@ mod tests {
let header_len = header.len();
header.resize(MAX_HEADER_SIZE, 0);
EncodedHeader {
header_bytes: header.as_slice().try_into().unwrap(),
header_bytes: header.as_slice().into(),
header_size: header_len as u32,
}
})
Expand Down
2 changes: 1 addition & 1 deletion circuits/dummy_step.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use avail_subxt::config::Header;
use rustx::program::Program;
use subxt::config::Header;

use crate::input::RpcDataFetcher;

Expand Down
6 changes: 3 additions & 3 deletions circuits/input/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::time::Duration;
use avail_subxt::avail::Client;
use avail_subxt::config::substrate::DigestItem;
use avail_subxt::primitives::Header;
use avail_subxt::rpc::RpcParams;
use avail_subxt::subxt_rpc::RpcParams;
use avail_subxt::{api, build_client};
use codec::{Compact, Decode, Encode};
use ed25519_dalek::{PublicKey, Signature, Verifier};
Expand Down Expand Up @@ -222,7 +222,7 @@ impl RpcDataFetcher {
let client = build_client(url.as_str(), false).await.unwrap();
let redis_client = RedisClient::new().await;
RpcDataFetcher {
client,
client: client.0,
avail_url: url,
redis_client,
save: None,
Expand All @@ -235,7 +235,7 @@ impl RpcDataFetcher {
Ok(_) => return Ok(()),
Err(_) => match build_client(self.avail_url.as_str(), false).await {
Ok(new_client) => {
self.client = new_client;
self.client = new_client.0;
return Ok(());
}
Err(_) => {
Expand Down

0 comments on commit 2a3f086

Please sign in to comment.