Skip to content

Consider extrinsic status when executing indirect calls #1208

@Kailai-Wang

Description

@Kailai-Wang

We noticed this problem in litentry/heima#1092

Quote:

As far as I experimented, the IndirectCallsExecutor simply iterates over all extrinsics in a parentchain block and handles them, without checking the extrinsic status.

I intentionally misconfigured the parameter so that the extrinsic failed and threw out an error, but this extrinsic was still parsed. This seems incorrect.

We also have a workaround for this: litentry/heima#1193

A bit hacky though as we wanted to have as few changes as possible. We append a status flag to the found extrinsics during parentchain syncing and parse it in the indirect-calls-executor, with customised encoding/decoding of OpaqueExtrinsics:

// `indirect_calls_executor` looks for extrinsics in parentchain blocks without checking their status.
// We believe it's wrong, see https://github.com/litentry/litentry-parachain/issues/1092
//
// One solution is to change the block type to `sp_runtime::generic::Block` or `sp_runtime::generic::SignedBlock`,
// this will however affect many structs or files, like block_importer, block_import_dispatcher, consensus and so on.
//
// We use a hacky workaround here for the least possible changes:
// append an extra `status` flag to `OpaqueExtrinsic` (Vec<u8>) and adjust the codec of it
//
// We intentionally don't drop failed extrinsics to allow any potential (post-)processing of failed extrinsics

Please let us know if you are happy with it, if so we can submit a PR.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions