Skip to content

Add batch PGAS claims - #75

Draft
georgepisaltu wants to merge 1 commit into
mainfrom
george-batch-claims
Draft

Add batch PGAS claims#75
georgepisaltu wants to merge 1 commit into
mainfrom
george-batch-claims

Conversation

@georgepisaltu

Copy link
Copy Markdown
Contributor

This PR adds batch claims for PGAS in pallet-pgas. There is only one proof, verified in multiple contexts using existing multi io primitives. This is ok since the claim is happening in a single account and each claim will have its own context. The benchmark only measures the worst case for now and always charges the worst case.

For AH, 5 claims should be enough to set an alias account.

Signed-off-by: georgepisaltu <george.pisaltu@parity.io>
@georgepisaltu georgepisaltu self-assigned this Aug 27, 2026
@kianenigma kianenigma moved this from Todo to Optional in Runtime releases Aug 28, 2026
Comment thread pallets/pgas/src/lib.rs
/// Must not exceed [`MAX_PGAS_BATCH_CLAIMS`] or the largest per-collection claim
/// count; both asserted in `integrity_test`.
#[pallet::constant]
type MaxPgasClaimsPerBatch: Get<u32>;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we could add in the doc that this value must be constant for the runtime. As it defines the transaction type and is benchmarked against.

Just so that it doesn't end up in pallet-parameters by mistake.

We could also enhance the code so that it supports run-time change.

ValidTransaction::with_tag_prefix("Pgas:Claim").priority(tx_priority::USER_DEFAULT);
for (ca, slot_index) in cas.iter().zip(slot_indices.iter()) {
let alias = ca.alias;
// Pool-hygiene pre-check; dispatch re-checks authoritatively.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it is more than just a pool hygiene it prevents already claimed alias to spam the chain itself with unpaid failing transactions.

Comment thread pallets/pgas/src/lib.rs

let amount = T::PgasClaimAmount::get();
T::Fungibles::mint_into(T::PgasAssetId::get(), target, amount)
.map_err(|_| Error::<T>::PgasMintFailed)?;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if it fails, then the transaction can be re-submitted on and on. But I think we can assume that it doesn't happen.

PgasClaimAmount should be higher than E.D. and PGAS is sufficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants