Skip to content

Commit

Permalink
Miguel/ava 405 rpc not working with scripts (#102)
Browse files Browse the repository at this point in the history
* Use custom branch

* Use header extensions

* Fix fmt

* Data Root without hardcode decoding

* Use `avail-core` tag

* Bump `avail-core` dep

* Comment from codereview

* RPC minor fixes

* Use temporay branch for `avail-core`

* RPC `query_data_proof` uses runtime extractor

* Rollback to tagged `avail-core` & disable VTest

* Update `avail-core` deps

* Fix `BlockLength` decodification bug

* Data Proof RPC uses block instead runtime
  • Loading branch information
MiguelDD1 authored Nov 1, 2022
1 parent 857a026 commit 68a67d0
Show file tree
Hide file tree
Showing 31 changed files with 674 additions and 241 deletions.
52 changes: 31 additions & 21 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions fuzzing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ edition = "2021"

[dependencies]
afl = "*"
kate-recovery = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1" }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1" }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
kate-recovery = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2" }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2" }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
hex-literal = "0.3.1"

[[bin]]
Expand Down
4 changes: 2 additions & 2 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ name = "data-avail"

[dependencies]
# Internals
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
da-runtime = { path = "../runtime" }
da-control = { path = "../pallets/dactr" }
kate-rpc = { path = "../rpc/kate-rpc" }
Expand Down
8 changes: 4 additions & 4 deletions node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

use std::sync::Arc;

use da_runtime::{Block, BlockNumber, Hash};
use da_runtime::{Block, BlockNumber, Hash, Runtime};
use sc_consensus_babe::{Config, Epoch};
use sc_consensus_babe_rpc::BabeRpcHandler;
use sc_consensus_epochs::SharedEpochChanges;
Expand Down Expand Up @@ -161,9 +161,9 @@ pub fn create_full(
),
));

io.extend_with(kate_rpc::KateApi::to_delegate(kate_rpc::Kate::new(
client.clone(),
)));
io.extend_with(kate_rpc::KateApi::<Block, Runtime>::to_delegate(
kate_rpc::Kate::new(client.clone()),
));

io.extend_with(sc_sync_state_rpc::SyncStateRpcApi::to_delegate(
sc_sync_state_rpc::SyncStateRpcHandler::new(
Expand Down
4 changes: 2 additions & 2 deletions pallets/dactr/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ description = "Data Avail Control Module"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }

# Substrate
serde = { version = "1.0.126", optional = true, features = ["derive"] }
Expand Down
9 changes: 1 addition & 8 deletions pallets/dactr/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use da_primitives::{
Header,
};
use frame_support::{parameter_types, weights::IdentityFee};
use frame_system::{DRFCallOf, DRFOutput, DataRootFilter};
use pallet_transaction_payment::CurrencyAdapter;
use sp_core::H256;
use sp_runtime::{
Expand Down Expand Up @@ -51,12 +50,6 @@ parameter_types! {
pub static ExistentialDeposit: u64 = 0;
}

impl DataRootFilter for Test {
type UncheckedExtrinsic = UncheckedExtrinsic<Test>;

fn filter(_call: &DRFCallOf<Self::UncheckedExtrinsic>) -> DRFOutput { None }
}

impl frame_system::Config for Test {
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = u64;
Expand All @@ -66,7 +59,6 @@ impl frame_system::Config for Test {
type BlockNumber = BlockNumber;
type BlockWeights = BlockWeights;
type Call = Call;
type DataRootBuilderFilter = Test;
type DbWeight = ();
type Event = Event;
type Hash = H256;
Expand All @@ -82,6 +74,7 @@ impl frame_system::Config for Test {
type PalletInfo = PalletInfo;
type Randomness = frame_system::tests::TestRandomness<Test>;
type SS58Prefix = ();
type SubmittedDataExtractor = ();
type SystemWeightInfo = ();
type Version = ();
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/executive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ readme = "README.md"
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }

codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [
"derive",
Expand Down
2 changes: 1 addition & 1 deletion pallets/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ mod tests {
..Default::default()
});
let state_root =
hex!("162ed31f8ac16b3e297cf35ee950fc6e11dddf90faebdc57f6a8c0e510fa5a9a").into();
hex!("3f1bd581280b838db1f5f16754026f9332e7c526122b764b70106dac450e7992").into();
let extrinsics_root =
hex!("03170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c111314").into();

Expand Down
4 changes: 2 additions & 2 deletions pallets/mocked_runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ repository = ""
description = "Mokend Runtime for Testing"

[dependencies]
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
kate = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
da-control = { path = "../dactr" }

scale-info = { version = "1.0", features = ["derive"] }
Expand Down
11 changes: 2 additions & 9 deletions pallets/mocked_runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use frame_support::{
traits::{Get, Randomness},
weights::{constants::WEIGHT_PER_SECOND, IdentityFee, RuntimeDbWeight, Weight},
};
use frame_system::{CheckEra, CheckNonce, CheckWeight, DRFCallOf, DRFOutput, DataRootFilter};
use frame_system::{CheckEra, CheckNonce, CheckWeight};
use pallet_transaction_payment::CurrencyAdapter;
use sp_runtime::{
generic::Block as SPBlock,
Expand Down Expand Up @@ -124,13 +124,6 @@ thread_local! {

// Runtime
//

impl DataRootFilter for Runtime {
type UncheckedExtrinsic = UncheckedExtrinsic;

fn filter(_call: &DRFCallOf<Self::UncheckedExtrinsic>) -> DRFOutput { None }
}

impl frame_system::Config for Runtime {
type AccountData = pallet_balances::AccountData<Balance>;
type AccountId = AccountId;
Expand All @@ -140,7 +133,6 @@ impl frame_system::Config for Runtime {
type BlockNumber = BlockNumber;
type BlockWeights = BlockWeights;
type Call = Call;
type DataRootBuilderFilter = Runtime;
type DbWeight = ();
type Event = Event;
type Hash = sp_core::H256;
Expand All @@ -156,6 +148,7 @@ impl frame_system::Config for Runtime {
type PalletInfo = PalletInfo;
type Randomness = TestRandomness<Runtime>;
type SS58Prefix = ();
type SubmittedDataExtractor = ();
type SystemWeightInfo = ();
type Version = RuntimeVersion;
}
Expand Down
8 changes: 4 additions & 4 deletions pallets/nomad/da-bridge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
# Our crates
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
nomad-core = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1", default-features = false }
da-primitives = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
nomad-core = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2", default-features = false }
nomad-home = { path = "../home", default-features = false }

# 3rd-party
Expand All @@ -39,8 +39,8 @@ hex-literal = "0.3.4"
frame-executive = { version = "4.0.0-dev" }
pallet-transaction-payment = { version = "4.0.0-dev" }
da-control = { path = "../../dactr" }
nomad-base = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1" }
merkle = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.1" }
nomad-base = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2" }
merkle = { git = "https://github.com/maticnetwork/avail-core.git", tag = "v0.2.2" }
updater-manager = { path = "../updater-manager" }

[features]
Expand Down
10 changes: 2 additions & 8 deletions pallets/nomad/da-bridge/src/mock.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use da_primitives::Header;
use frame_support::traits::GenesisBuild;
use frame_system::{self as system, DRFCallOf, DRFOutput, DataRootFilter};
use frame_system::{self as system};
use nomad_base::NomadBase;
use primitive_types::{H160, H256};
use sp_runtime::{
Expand Down Expand Up @@ -37,12 +37,6 @@ frame_support::parameter_types! {
pub static ExistentialDeposit: u64 = 0;
}

impl DataRootFilter for Test {
type UncheckedExtrinsic = UncheckedExtrinsic;

fn filter(_call: &DRFCallOf<Self::UncheckedExtrinsic>) -> DRFOutput { None }
}

impl system::Config for Test {
type AccountData = ();
type AccountId = AccountId32;
Expand All @@ -52,7 +46,6 @@ impl system::Config for Test {
type BlockNumber = BlockNumber;
type BlockWeights = ();
type Call = Call;
type DataRootBuilderFilter = Test;
type DbWeight = ();
type Event = Event;
type Hash = H256;
Expand All @@ -68,6 +61,7 @@ impl system::Config for Test {
type PalletInfo = PalletInfo;
type Randomness = frame_system::tests::TestRandomness<Test>;
type SS58Prefix = ();
type SubmittedDataExtractor = ();
type SystemWeightInfo = ();
type Version = ();
}
Expand Down
Loading

0 comments on commit 68a67d0

Please sign in to comment.