Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
1,968 changes: 1,399 additions & 569 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ codec = { package = "parity-scale-codec", version = "3.0.0" }
scale-info = { package = "scale-info", version = "2.10.0" }
clap = { version = "4.4", features = ["derive", "env"] }
tracing-subscriber = { version = "0.3.17", features = ["env-filter"] }
jsonrpsee = { version = "0.16", features = ["ws-client"] }
jsonrpsee = { version = "0.20", features = ["ws-client"] }
log = "0.4"
serde = "1.0"
serde_json = "1.0"
Expand All @@ -19,15 +19,15 @@ tokio = { version = "1.34", features = ["macros", "rt-multi-thread", "sync", "si
pin-project-lite = "0.2"

# subxt
subxt = "0.29"
scale-value = "0.10.0"
subxt = { version = "0.32.1", features = ["substrate-compat"] }
scale-value = "0.12.0"

# polkadot-sdk
frame-election-provider-support = { git = "https://github.com/paritytech/polkadot-sdk" }
pallet-election-provider-multi-phase = { git = "https://github.com/paritytech/polkadot-sdk" }
sp-npos-elections = { git = "https://github.com/paritytech/polkadot-sdk/" }
frame-support = { git = "https://github.com/paritytech/polkadot-sdk" }
sp-runtime = { git = "https://github.com/paritytech/polkadot-sdk" }
frame-election-provider-support = "26.0.0"
pallet-election-provider-multi-phase = "25.0.0"
sp-npos-elections = "24.0.0"
frame-support = "26.0.0"
sp-runtime = "29.0.0"

# prometheus
prometheus = "0.13"
Expand All @@ -37,7 +37,7 @@ once_cell = "1.18"
[dev-dependencies]
anyhow = "1"
assert_cmd = "2.0"
sp-storage = { git = "https://github.com/paritytech/polkadot-sdk" }
sp-storage = "17.0.0"
regex = "1"

[features]
Expand Down
Binary file modified artifacts/metadata.scale
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was forced to update the metadata for the codegen to work

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm interesting, might be worth a subxt issue probably we'd want to keep backwards compatibility between 14 and 15 versions 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I decided not to trim the metadata because of paritytech/subxt#1286

Binary file not shown.
22 changes: 12 additions & 10 deletions src/commands/dry_run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ pub struct DryRunConfig {
pub seed_or_path: Option<String>,
}

pub async fn dry_run_cmd<T>(api: SubxtClient, config: DryRunConfig) -> Result<(), Error>
pub async fn dry_run_cmd<T>(client: Client, config: DryRunConfig) -> Result<(), Error>
where
T: MinerConfig<AccountId = AccountId, MaxVotesPerVoter = static_types::MaxVotesPerVoter>
+ Send
+ Sync
+ 'static,
T::Solution: Send,
{
let storage = storage_at(config.at, &api).await?;
let storage = storage_at(config.at, client.chain_api()).await?;
let round = storage
.fetch_or_default(&runtime::storage().election_provider_multi_phase().round())
.await?;

let miner_solution = epm::fetch_snapshot_and_mine_solution::<T>(
&api,
client.chain_api(),
config.at,
config.solver,
round,
Expand Down Expand Up @@ -106,14 +106,16 @@ where

log::info!(target: LOG_TARGET, "Loaded account {}, {:?}", signer, account_info);

let nonce = api.rpc().system_account_next_index(signer.account_id()).await?;
let nonce = client.rpc_system_account_next_index(signer.account_id()).await?;
let tx = epm::signed_solution(raw_solution)?;
let xt =
api.tx()
.create_signed_with_nonce(&tx, &*signer, nonce, ExtrinsicParams::default())?;
let dry_run_bytes = api.rpc().dry_run(xt.encoded(), config.at).await?;

let dry_run_result = dry_run_bytes.into_dry_run_result(&api.metadata())?;
let xt = client.chain_api().tx().create_signed_with_nonce(
&tx,
&*signer,
nonce,
Default::default(),
)?;
let dry_run_bytes = client.subxt_rpc().dry_run(xt.encoded(), config.at).await?;
let dry_run_result = dry_run_bytes.into_dry_run_result(&client.chain_api().metadata())?;

log::info!(target: LOG_TARGET, "dry-run outcome is {:?}", dry_run_result);
}
Expand Down
8 changes: 4 additions & 4 deletions src/commands/emergency_solution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct EmergencySolutionConfig {
}

pub async fn emergency_solution_cmd<T>(
api: SubxtClient,
client: Client,
config: EmergencySolutionConfig,
) -> Result<(), Error>
where
Expand All @@ -53,14 +53,14 @@ where
static_types::MaxWinners::set(max_winners);
}

let storage = storage_at(config.at, &api).await?;
let storage = storage_at(config.at, client.chain_api()).await?;

let round = storage
.fetch_or_default(&runtime::storage().election_provider_multi_phase().round())
.await?;

let miner_solution = epm::fetch_snapshot_and_mine_solution::<T>(
&api,
client.chain_api(),
config.at,
config.solver,
round,
Expand All @@ -87,7 +87,7 @@ where
}

let call = epm::set_emergency_result(supports.clone())?;
let encoded_call = call.encode_call_data(&api.metadata())?;
let encoded_call = call.encode_call_data(&client.chain_api().metadata())?;
let encoded_supports = supports.encode();

// write results to files.
Expand Down
Loading