Skip to content
Snippets Groups Projects
Unverified Commit 152675fb authored by bgallois's avatar bgallois
Browse files

fix distance_oracle NEED VALID METADATA TO FINISH

parent c14015ab
No related branches found
No related tags found
No related merge requests found
Pipeline #35466 failed
This diff is collapsed.
......@@ -9,21 +9,22 @@ edition = "2021"
[dependencies]
sp-distance = { path = "../primitives/distance" }
codec = { package = "parity-scale-codec", version = "3.6.5" }
codec = { package = "parity-scale-codec", version = "3.6.9" }
fnv = "1.0.7"
log = "0.4.17"
num-traits = "0.2.15"
rayon = "1.7.0"
simple_logger = "4.2.0"
log = "0.4.20"
num-traits = "0.2.17"
rayon = "1.8.1"
simple_logger = "4.3.3"
sp-core = { git = "https://github.com/bgallois/duniter-polkadot-sdk.git", branch = "duniter-v1.6.0" }
sp-runtime = { git = "https://github.com/bgallois/duniter-polkadot-sdk.git", branch = "duniter-v1.6.0" }
subxt = { git = 'https://github.com/duniter/subxt.git', branch = 'duniter-substrate-v0.9.42', default-features = false, features = ["substrate-compat", "jsonrpsee-ws"] }
time = "<=0.3.23"# required for MSRV
time-macros = "=0.2.10"
subxt = { git = 'https://github.com/paritytech/subxt.git', tag = 'v0.33.0', default-features = false, features = ["substrate-compat", "native"] }
time = "0.3.31"
time-macros = "0.2.16"
# standalone only
clap = { version = "4.0", features = ["derive"], optional = true }
tokio = { version = "1.15.0", features = [
clap = { version = "4.4.18", features = ["derive"], optional = true }
tokio = { version = "1.35.1", features = [
"rt-multi-thread",
"macros",
], optional = true }
......@@ -31,7 +32,7 @@ tokio = { version = "1.15.0", features = [
[dev-dependencies]
bincode = "1.3.3"
dubp-wot = "0.11.1"
flate2 = { version = "1.0", features = [
flate2 = { version = "1.0.28", features = [
"zlib-ng-compat",
], default-features = false }
......
......@@ -18,7 +18,7 @@ use crate::runtime;
use log::debug;
use sp_core::H256;
use subxt::storage::StorageKey;
use subxt::storage::Storage;
pub type Client = subxt::OnlineClient<crate::RuntimeConfig>;
pub type AccountId = subxt::utils::AccountId32;
......@@ -31,7 +31,12 @@ pub async fn client(rpc_url: String) -> Client {
}
pub async fn parent_hash(client: &Client) -> H256 {
client.rpc().block_hash(None).await.unwrap().unwrap()
client
.blocks()
.at_latest()
.await
.expect("Cannot fetch latest block hash")
.hash()
}
pub async fn current_session(client: &Client, parent_hash: H256) -> u32 {
......@@ -93,18 +98,17 @@ pub async fn member_iter(client: &Client, evaluation_block: H256) -> MemberIter
client
.storage()
.at(evaluation_block)
.iter(runtime::storage().membership().membership(0), 100)
.iter(runtime::storage().membership().membership(0))
.await
.expect("Cannot fetch memberships"),
)
}
pub struct MemberIter(
subxt::storage::KeyIter<
crate::RuntimeConfig,
Client,
subxt::backend::StreamOfResults<(
Vec<u8>,
runtime::runtime_types::sp_membership::MembershipData<u32>,
>,
)>,
);
impl MemberIter {
......@@ -128,7 +132,7 @@ pub async fn cert_iter(client: &Client, evaluation_block: H256) -> CertIter {
)
}
pub struct CertIter(subxt::storage::KeyIter<crate::RuntimeConfig, Client, Vec<(IdtyIndex, u32)>>);
pub struct CertIter(subxt::backend::StreamOfResults<(Vec<u8>, Vec<(IdtyIndex, u32)>)>);
impl CertIter {
pub async fn next(
......@@ -142,6 +146,6 @@ impl CertIter {
}
}
fn idty_id_from_storage_key(storage_key: &StorageKey) -> IdtyIndex {
fn idty_id_from_storage_key<T: subxt::Config>(storage_key: &Storage<T, Client>) -> IdtyIndex {
u32::from_le_bytes(storage_key.as_ref()[40..44].try_into().unwrap())
}
......@@ -40,8 +40,6 @@ pub mod runtime {}
pub enum RuntimeConfig {}
impl subxt::config::Config for RuntimeConfig {
type Index = u32;
// type BlockNumber = u32;
type Hash = sp_core::H256;
type Hasher = subxt::config::substrate::BlakeTwo256;
type AccountId = AccountId;
......@@ -49,7 +47,8 @@ impl subxt::config::Config for RuntimeConfig {
type Header =
subxt::config::substrate::SubstrateHeader<u32, subxt::config::substrate::BlakeTwo256>;
type Signature = subxt::ext::sp_runtime::MultiSignature;
type ExtrinsicParams = subxt::config::extrinsic_params::BaseExtrinsicParams<Self, Tip>;
type ExtrinsicParams = subxt::config::substrate::SubstrateExtrinsicParams<Self>;
type AssetId = ();
}
#[derive(Copy, Clone, Debug, Default, Encode)]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment