fix: show a block's events, joined to the extrinsics that caused them
All checks were successful
deploy / build (push) Successful in 9m18s
deploy / deploy-web (push) Successful in 4s
deploy / deploy-api (push) Successful in 14s

The block page listed extrinsics and nothing else. Block 1 holds twenty-eight
indexed events and the route returned none of them — visible from the outside,
because an account page linked to a `Wormhole::NativeTransferred` at block 1 and
block 1 showed no sign of it.

`phase` and `extrinsic_index` were stored for exactly this join and had never
been used. Each extrinsic now carries its own events beneath it, and the block's
own events sit in their phases.

Block 1 is the argument for doing it that way. As extrinsics alone it is a
single `Timestamp::set`. Its events are the entire opening distribution:
twenty-one `Wormhole::NativeTransferred` in `Initialization`, owned by no
extrinsic at all and sent from the minting account — not block zero, and not
anything a transaction did. `Vesting::LaunchMomentSet` fires there too, so
vesting has been exercised despite the call index showing zero `Vesting::*`
dispatched: a pallet the runtime uses looks unused from the call side alone.

Closes #3

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Jp6a8EDar9ueEhAxzep4V5
This commit is contained in:
2026-09-10 09:14:56 +03:00
parent dd8086df0d
commit 88086552cb
10 changed files with 337 additions and 6 deletions

View File

@@ -1,6 +1,7 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
import type { AttributionSource } from "./AttributionSource";
import type { BigUintDec } from "./BigUintDec";
import type { BlockEvent } from "./BlockEvent";
import type { BlockExtrinsic } from "./BlockExtrinsic";
import type { ChainId } from "./ChainId";
import type { MinerId } from "./MinerId";
@@ -89,6 +90,17 @@ seconds_since_parent: number | null,
* been pruned.
*/
extrinsics: number | null,
/**
* The block's events, in the order they fired.
*
* Grouped by a reader rather than here: `phase` says whether an event
* belongs to an extrinsic or to the block itself, and `extrinsic_index`
* says which extrinsic. A block's opening distribution can arrive entirely
* in `Initialization`, owned by no extrinsic at all — which is exactly
* what block 1 on this chain does, and what a page showing only extrinsics
* misses.
*/
events: Array<BlockEvent>,
/**
* The extrinsics themselves, decoded, in body order.
*

View File

@@ -0,0 +1,35 @@
// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually.
/**
* One event in a block, as the runtime named it.
*/
export type BlockEvent = {
/**
* Position in the block's event list.
*/
index: number,
/**
* Emitting pallet.
*/
pallet: string,
/**
* The variant.
*/
variant: string,
/**
* `ApplyExtrinsic`, `Initialization` or `Finalization` — whether this
* belongs to an extrinsic or to the block itself.
*/
phase: string,
/**
* Which extrinsic caused it, when one did.
*/
extrinsic_index: number,
/**
* Its fields, in the runtime's own names.
*/
fields: Record<string, unknown>,
/**
* Accounts it mentions, as `0x hex → SS58`.
*/
addresses: Record<string, string>, };