fix: ignore extrinsicIndex in multiBlockMigrations event #1541
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Closes #1538
Issue
In the
blocks
endpoint, we return a list of extrinsics included in the queried block and under each extrinsic their related event. However, duringmultiBlockMigrations
we encounter cases where events reference extrinsic indexes that do not exist.In the code, this situation is represented by having an event with :
ApplyExtrinsic
here (which means we expect an extrinsic associated with this event)2
but there is no extrinsic in index2
so we return an error msgProposed Solution
During
multiBlockMigrations
:multiblockmigrations / MigrationAdvanced
event (shown in Subscan here) since we cannot associate it with any valid/existing extrinsic.In the code, we do that by :
multiBlockMigrations
This does not break any past logic since the error message will be thrown in all other cases.
Testing
While connected to Shiden network (e.g. through
wss://rpc.shiden.astar.network
), query block 7675808http://127.0.0.1:8080/blocks/7675808
.Before the fix we would get :
After the fix :
The response now returns correctly the 2 extrinsics present in this block and their associated events. There is also the
multiblockmigrations / MigrationAdvanced
event (mentioned earlier) but we chose to ignore it since we cannot attach it to any valid/existing extrinsics.Downside
This solution has the downside that we are not showing an existing event.
Long term Solution
As soon as this PR paritytech/polkadot-sdk#3666 gets merged, I will expect that
multiBlockMigrations
events will have phase set asApplyInherent
so we will not have this issue for future blocks. However this fix needs to be kept for historic blocks.Todos
blocks
endpoint #1542 in Sidecar to track the progress of this polkadot-sdk PR and make the necessary changes as soon as it is applied.