Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Merge branch 'master' into pg/trace_call
Browse files Browse the repository at this point in the history
  • Loading branch information
pgherveou committed Aug 23, 2023
2 parents 8bdfe8d + 1631c8e commit 986fe10
Show file tree
Hide file tree
Showing 20 changed files with 163 additions and 80 deletions.
103 changes: 62 additions & 41 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,7 @@ impl pallet_contracts::Config for Runtime {
type MaxDelegateDependencies = ConstU32<32>;
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type Debug = ();
type Environment = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down
18 changes: 11 additions & 7 deletions client/consensus/manual-seal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ pub async fn run_manual_seal<B, BI, CB, E, C, TP, SC, CS, CIDP, P>(
SC: SelectChain<B> + 'static,
TP: TransactionPool<Block = B>,
CIDP: CreateInherentDataProviders<B, ()>,
P: Send + Sync + 'static,
P: codec::Encode + Send + Sync + 'static,
{
while let Some(command) = commands_stream.next().await {
match command {
Expand Down Expand Up @@ -231,7 +231,7 @@ pub async fn run_instant_seal<B, BI, CB, E, C, TP, SC, CIDP, P>(
SC: SelectChain<B> + 'static,
TP: TransactionPool<Block = B>,
CIDP: CreateInherentDataProviders<B, ()>,
P: Send + Sync + 'static,
P: codec::Encode + Send + Sync + 'static,
{
// instant-seal creates blocks as soon as transactions are imported
// into the transaction pool.
Expand Down Expand Up @@ -281,7 +281,7 @@ pub async fn run_instant_seal_and_finalize<B, BI, CB, E, C, TP, SC, CIDP, P>(
SC: SelectChain<B> + 'static,
TP: TransactionPool<Block = B>,
CIDP: CreateInherentDataProviders<B, ()>,
P: Send + Sync + 'static,
P: codec::Encode + Send + Sync + 'static,
{
// Creates and finalizes blocks as soon as transactions are imported
// into the transaction pool.
Expand Down Expand Up @@ -459,7 +459,8 @@ mod tests {
needs_justification: false,
bad_justification: false,
is_new_best: true,
}
},
proof_size: 0
}
);
// assert that there's a new block in the db.
Expand Down Expand Up @@ -549,7 +550,8 @@ mod tests {
needs_justification: false,
bad_justification: false,
is_new_best: true,
}
},
proof_size: created_block.proof_size
}
);
// assert that there's a new block in the db.
Expand Down Expand Up @@ -625,7 +627,8 @@ mod tests {
needs_justification: false,
bad_justification: false,
is_new_best: true,
}
},
proof_size: 0
}
);
// assert that there's a new block in the db.
Expand Down Expand Up @@ -711,7 +714,8 @@ mod tests {
needs_justification: false,
bad_justification: false,
is_new_best: true
}
},
proof_size: 0
}
);

Expand Down
2 changes: 2 additions & 0 deletions client/consensus/manual-seal/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ pub struct CreatedBlock<Hash> {
pub hash: Hash,
/// some extra details about the import operation
pub aux: ImportedAux,
/// uncompacted storage proof size (zero mean that there is no proof)
pub proof_size: usize,
}

impl<Hash> ManualSeal<Hash> {
Expand Down
10 changes: 7 additions & 3 deletions client/consensus/manual-seal/src/seal_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub async fn seal_block<B, BI, SC, C, E, TP, CIDP, P>(
TP: TransactionPool<Block = B>,
SC: SelectChain<B>,
CIDP: CreateInherentDataProviders<B, ()>,
P: Send + Sync + 'static,
P: codec::Encode + Send + Sync + 'static,
{
let future = async {
if pool.status().ready == 0 && !create_empty {
Expand Down Expand Up @@ -131,6 +131,7 @@ pub async fn seal_block<B, BI, SC, C, E, TP, CIDP, P>(

let (header, body) = proposal.block.deconstruct();
let proof = proposal.proof;
let proof_size = proof.encoded_size();
let mut params = BlockImportParams::new(BlockOrigin::Own, header.clone());
params.body = Some(body);
params.finalized = finalize;
Expand All @@ -149,8 +150,11 @@ pub async fn seal_block<B, BI, SC, C, E, TP, CIDP, P>(
post_header.digest_mut().logs.extend(params.post_digests.iter().cloned());

match block_import.import_block(params).await? {
ImportResult::Imported(aux) =>
Ok(CreatedBlock { hash: <B as BlockT>::Header::hash(&post_header), aux }),
ImportResult::Imported(aux) => Ok(CreatedBlock {
hash: <B as BlockT>::Header::hash(&post_header),
aux,
proof_size,
}),
other => Err(other.into()),
}
};
Expand Down
7 changes: 6 additions & 1 deletion frame/asset-conversion/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ pub mod pallet {

/// Type that identifies either the native currency or a token class from `Assets`.
/// `Ord` is added because of `get_pool_id`.
///
/// The pool's `AccountId` is derived from this type. Any changes to the type may
/// necessitate a migration.
type MultiAssetId: AssetId + Ord + From<Self::AssetId>;

/// Type to convert an `AssetId` into `MultiAssetId`.
Expand Down Expand Up @@ -1193,7 +1196,9 @@ pub mod pallet {
()
);
} else {
let MultiAssetIdConversionResult::Converted(asset_id) = T::MultiAssetIdConverter::try_convert(asset) else {
let MultiAssetIdConversionResult::Converted(asset_id) =
T::MultiAssetIdConverter::try_convert(asset)
else {
return Err(())
};
let minimal = T::Assets::minimum_balance(asset_id);
Expand Down
6 changes: 5 additions & 1 deletion frame/asset-conversion/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ fn pool_assets() -> Vec<u32> {

fn create_tokens(owner: u128, tokens: Vec<NativeOrAssetId<u32>>) {
for token_id in tokens {
let MultiAssetIdConversionResult::Converted(asset_id) = NativeOrAssetIdConverter::try_convert(&token_id) else { unreachable!("invalid token") };
let MultiAssetIdConversionResult::Converted(asset_id) =
NativeOrAssetIdConverter::try_convert(&token_id)
else {
unreachable!("invalid token")
};
assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, false, 1));
}
}
Expand Down
Loading

0 comments on commit 986fe10

Please sign in to comment.