4 Commits

Author SHA1 Message Date
Luke Parker
fd50192ba1 clippy 2025-10-05 09:09:52 -04:00
Luke Parker
3fd12a8910 Merge branch 'develop' into develop-polkadot-sdk 2025-10-05 06:15:06 -04:00
Luke Parker
74296a0775 Fix timeline for incrementing providers
e1671dd71b incremented the providers for every
single transaction's sender before execution, noting the solution was fragile
but it worked for us at this time. It did not work for us at this time.

The new solution replaces `inc_providers` with direct access to the `Account`
`StorageMap` to increment the providers, achieving the desired goal, _without_
emitting an event (which is ordered, and the disparate order between building
and execution was causing mismatches of the state root).

This solution is also fragile and may also be insufficient. None of this code
exists anymore on `next` however. It just has to work sufficiently for now.
2025-10-05 05:48:47 -04:00
Luke Parker
55ed33d2d1 Update to a version of Substrate which no longer cites our fork of substrate-bip39 2025-09-30 19:30:40 -04:00

View File

@@ -383,9 +383,11 @@ sp_api::impl_runtime_apis! {
fn execute_block(block: Block) {
for tx in &block.extrinsics {
if let Some(signer) = tx.signer() {
let signer = signer.0.into();
if System::providers(&signer) == 0 {
System::inc_providers(&signer);
let signer = PublicKey::from(signer.0);
let mut info = frame_system::Account::<Runtime>::get(signer);
if info.providers == 0 {
info.providers = 1;
frame_system::Account::<Runtime>::set(signer, info);
}
}
}
@@ -401,9 +403,11 @@ sp_api::impl_runtime_apis! {
impl sp_block_builder::BlockBuilder<Block> for Runtime {
fn apply_extrinsic(extrinsic: <Block as BlockT>::Extrinsic) -> ApplyExtrinsicResult {
if let Some(signer) = extrinsic.signer() {
let signer = signer.0.into();
if System::providers(&signer) == 0 {
System::inc_providers(&signer);
let signer = PublicKey::from(signer.0);
let mut info = frame_system::Account::<Runtime>::get(signer);
if info.providers == 0 {
info.providers = 1;
frame_system::Account::<Runtime>::set(signer, info);
}
}
Executive::apply_extrinsic(extrinsic)
@@ -432,9 +436,11 @@ sp_api::impl_runtime_apis! {
block_hash: <Block as BlockT>::Hash,
) -> TransactionValidity {
if let Some(signer) = tx.signer() {
let signer = signer.0.into();
if System::providers(&signer) == 0 {
System::inc_providers(&signer);
let signer = PublicKey::from(signer.0);
let mut info = frame_system::Account::<Runtime>::get(signer);
if info.providers == 0 {
info.providers = 1;
frame_system::Account::<Runtime>::set(signer, info);
}
}
Executive::validate_transaction(source, tx, block_hash)