Skip to content
Snippets Groups Projects
Verified Commit 9b3dea39 authored by Pascal Engélibert's avatar Pascal Engélibert :bicyclist:
Browse files

chore: upgrade to duniter substrate 0.9.32

parent b44c75bd
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
...@@ -12,12 +12,12 @@ clap = { version = "4.0", features = ["derive"] } ...@@ -12,12 +12,12 @@ clap = { version = "4.0", features = ["derive"] }
codec = { package = "parity-scale-codec", version = "3.1.5" } codec = { package = "parity-scale-codec", version = "3.1.5" }
env_logger = "0.10" env_logger = "0.10"
futures = "0.3.25" futures = "0.3.25"
graphql_client = { version = "0.11.0", features = ["reqwest"] } graphql_client = { version = "0.12.0", features = ["reqwest"] }
hex = "0.4.3" hex = "0.4.3"
logs = "0.7" logs = "0.7"
reqwest = "0.11.13" reqwest = "0.11.13"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.89" serde_json = "1.0.89"
sp-core = { git = "https://github.com/duniter/substrate", branch = "duniter-substrate-v0.9.26" } sp-core = { git = "https://github.com/duniter/substrate", branch = "duniter-substrate-v0.9.32" }
subxt = { git = "https://github.com/duniter/subxt.git", branch = "duniter-substrate-v0.9.26" } subxt = { git = "https://github.com/duniter/subxt.git", branch = "duniter-substrate-v0.9.32" }
tokio = { version = "1.23.0", features = ["macros"] } tokio = { version = "1.23.0", features = ["macros"] }
...@@ -53,7 +53,7 @@ impl<'a> IdentityCache<'a> { ...@@ -53,7 +53,7 @@ impl<'a> IdentityCache<'a> {
if let Some(data) = resp.data { if let Some(data) = resp.data {
if let Some(identity) = data.identity_by_pk { if let Some(identity) = data.identity_by_pk {
if let Some(name) = identity.name { if let Some(name) = identity.name {
format!("“ {} ”", name) format!("“ {name} ”")
} else { } else {
pubkey pubkey
} }
......
...@@ -65,7 +65,7 @@ pub async fn monitor_expirations( ...@@ -65,7 +65,7 @@ pub async fn monitor_expirations(
println!("\nAuthority members:"); println!("\nAuthority members:");
for (sessions_left, identity_ids) in must_rotate_keys_before { for (sessions_left, identity_ids) in must_rotate_keys_before {
println!("Must rotate keys before {} sessions:", sessions_left); println!("Must rotate keys before {sessions_left} sessions:");
for identity_id in identity_ids { for identity_id in identity_ids {
println!( println!(
" {} ({})", " {} ({})",
...@@ -115,9 +115,9 @@ pub async fn monitor_expirations( ...@@ -115,9 +115,9 @@ pub async fn monitor_expirations(
("Certifications", basic_certs), ("Certifications", basic_certs),
("Smith certifications", smith_certs), ("Smith certifications", smith_certs),
] { ] {
println!("\n{}:", title); println!("\n{title}:");
for (blocks_left, certs) in certs { for (blocks_left, certs) in certs {
println!("{} blocks before expiration:", blocks_left); println!("{blocks_left} blocks before expiration:");
for (issuer_id, receiver_id) in certs { for (issuer_id, receiver_id) in certs {
println!( println!(
" {} ({}) -> {} ({})", " {} ({}) -> {} ({})",
...@@ -173,9 +173,9 @@ pub async fn monitor_expirations( ...@@ -173,9 +173,9 @@ pub async fn monitor_expirations(
("Memberships", basic_memberships), ("Memberships", basic_memberships),
("Smith memberships", smith_memberships), ("Smith memberships", smith_memberships),
] { ] {
println!("\n{}:", title); println!("\n{title}:");
for (blocks_left, membership) in memberships { for (blocks_left, membership) in memberships {
println!("{} blocks before expiration:", blocks_left); println!("{blocks_left} blocks before expiration:");
for identity_id in membership { for identity_id in membership {
println!( println!(
" {} ({})", " {} ({})",
......
...@@ -47,6 +47,7 @@ pub async fn repart( ...@@ -47,6 +47,7 @@ pub async fn repart(
} }
pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Result<()> { pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Result<()> {
let mut nonce = 0;
let mut pairs = let mut pairs =
Vec::<(PairSigner<GdevConfig, Pair>, AccountId32)>::with_capacity(actual_repart); Vec::<(PairSigner<GdevConfig, Pair>, AccountId32)>::with_capacity(actual_repart);
for i in 0..actual_repart { for i in 0..actual_repart {
...@@ -64,13 +65,15 @@ pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Resu ...@@ -64,13 +65,15 @@ pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Resu
let dest: AccountId32 = pairs[i + 1].1.clone(); let dest: AccountId32 = pairs[i + 1].1.clone();
let watcher = client let watcher = client
.tx() .tx()
.sign_and_submit_then_watch( .create_signed_with_nonce(
&gdev::tx().balances().transfer(MultiAddress::Id(dest), 1), &gdev::tx().balances().transfer(MultiAddress::Id(dest), 1),
&pairs[i].0, &pairs[i].0,
nonce,
BaseExtrinsicParamsBuilder::new(), BaseExtrinsicParamsBuilder::new(),
) )?
.submit_and_watch()
.await?; .await?;
pairs[i].0.increment_nonce(); nonce += 1;
logs::info!("send 1 cent from //{} to //{}", i, i + 1); logs::info!("send 1 cent from //{} to //{}", i, i + 1);
watchers.push(watcher); watchers.push(watcher);
} }
...@@ -83,7 +86,7 @@ pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Resu ...@@ -83,7 +86,7 @@ pub async fn spam_roll(pair: Pair, client: Client, actual_repart: usize) -> Resu
BaseExtrinsicParamsBuilder::new(), BaseExtrinsicParamsBuilder::new(),
) )
.await?; .await?;
pairs[actual_repart - 1].0.increment_nonce(); nonce += 1;
logs::info!("send 1 cent from //{} to //0", actual_repart - 1); logs::info!("send 1 cent from //{} to //0", actual_repart - 1);
watchers.push(watcher); watchers.push(watcher);
......
...@@ -29,7 +29,6 @@ impl subxt::config::Config for GdevConfig { ...@@ -29,7 +29,6 @@ impl subxt::config::Config for GdevConfig {
subxt::ext::sp_runtime::traits::BlakeTwo256, subxt::ext::sp_runtime::traits::BlakeTwo256,
>; >;
type Signature = subxt::ext::sp_runtime::MultiSignature; type Signature = subxt::ext::sp_runtime::MultiSignature;
type Extrinsic = subxt::ext::sp_runtime::OpaqueExtrinsic;
type ExtrinsicParams = subxt::tx::BaseExtrinsicParams<Self, Tip>; type ExtrinsicParams = subxt::tx::BaseExtrinsicParams<Self, Tip>;
} }
...@@ -182,7 +181,7 @@ async fn main() -> Result<()> { ...@@ -182,7 +181,7 @@ async fn main() -> Result<()> {
}; };
if let Some(account_id) = &account_id { if let Some(account_id) = &account_id {
println!("Account address: {}", account_id); println!("Account address: {account_id}");
} }
let client = Client::from_url(&args.url).await.unwrap(); let client = Client::from_url(&args.url).await.unwrap();
......
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