Skip to content

fix: FuelEvent optimistic updates not being applied#40

Merged
fcsondheim merged 5 commits into
mainfrom
wallet-core
Jun 25, 2026
Merged

fix: FuelEvent optimistic updates not being applied#40
fcsondheim merged 5 commits into
mainfrom
wallet-core

Conversation

@fcsondheim

@fcsondheim fcsondheim commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

What

  • Added fuelEventBcs.ts with a BCS struct definition matching the on-chain FuelEvent Move struct (including the Action enum), and decodeFuelEventBcs / fuelEventBcsToParsedJson functions mirroring the inventory BCS decoder pattern
  • Exported BcsObjectId and TenantKey from inventoryEventBcs.ts so both decoders share the same definitions
  • Renamed parseInventoryEventPayloadFromStreamparseEventPayloadFromStream and added an eventType parameter; the BCS fallback now dispatches to the fuel decoder for ::fuel::FuelEvent types and the inventory decoder for all others
  • Bumped wallet-core version to v0.0.4
  • Reverted accidental version bump of dapp-kit back to 0.0.10

Why

Fuel events (::fuel::FuelEvent) from the gRPC checkpoint stream were silently dropped before reaching the onEvents handler in SmartObjectProvider, so the Network Node Monitor never received optimistic updates for fuel quantity or isBurning state.

The cause: parseEventPayloadFromStream attempts to decode event payloads from protobuf JSON first, then falls back to BCS bytes. The BCS fallback was hardcoded to InventoryMoveEvent — passing FuelEvent BCS bytes to that decoder throws, the catch returns null, and extractInventoryEventsFromCheckpoint filters the event out.

Screenshots / Gifs

Where has this been tested?

  • In-game browser
  • External browser

Copilot AI review requested due to automatic review settings June 25, 2026 12:39
@github-actions

github-actions Bot commented Jun 25, 2026

Copy link
Copy Markdown

Coverage Report for @evefrontier/dapp-kit

Status Category Percentage Covered / Total
🔵 Lines 90.87% 737 / 811
🔵 Statements 88.96% 782 / 879
🔵 Functions 88.1% 163 / 185
🔵 Branches 77% 489 / 635
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
packages/libs/dapp-kit/utils/inventory.ts 87.5% 78.57% 100% 93.18% 15, 44, 65, 108, 119, 123
packages/libs/dapp-kit/utils/events/checkpointStream.ts 83.45% 72.56% 92.3% 87.5% 87, 91, 116, 124, 136-137, 141-143, 161, 204, 218-220, 291, 302, 333, 391-392, 403, 409-412
packages/libs/dapp-kit/utils/events/consts.ts 80% 100% 66.66% 75% 4
packages/libs/dapp-kit/utils/events/fuelEventBcs.ts 100% 100% 100% 100%
packages/libs/dapp-kit/utils/events/inventoryEventHandlers.ts 86.81% 79.16% 100% 93.33% 47, 54, 79, 84, 92, 112, 127-128, 150, 190, 242, 245
Generated in workflow #87 for commit 2d2bd98 by the Vitest Coverage Report Action

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes missing optimistic updates for ::fuel::FuelEvent coming from the gRPC checkpoint stream by adding a dedicated BCS decoder for fuel events and dispatching the BCS fallback decoder based on the event type, so fuel events are no longer dropped when protobuf JSON decoding fails.

Changes:

  • Added fuelEventBcs.ts (FuelEvent + Action enum) and routed checkpoint-stream BCS fallback decoding to fuel vs. inventory based on eventType.
  • Deduplicated shared BCS primitives (BcsObjectId, TenantKey) into utils/events/consts.ts and updated imports accordingly.
  • Bumped @evefrontier/wallet-core to 0.0.4 and updated affected lockfile/test expectations.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/libs/dapp-kit/utils/inventory.ts Simplifies adjustInventoryUsedCapacity signature by removing overload declarations.
packages/libs/dapp-kit/utils/events/inventoryEventBcs.ts Switches to shared BCS consts import for object IDs and tenant keys.
packages/libs/dapp-kit/utils/events/fuelEventBcs.ts Adds BCS decoding + parsedJson shaping for on-chain FuelEvent.
packages/libs/dapp-kit/utils/events/consts.ts Introduces shared BcsObjectId + TenantKey definitions for event decoders.
packages/libs/dapp-kit/utils/events/checkpointStream.ts Renames payload parsing helper and dispatches BCS decoding to fuel vs inventory based on type suffix.
packages/libs/dapp-kit/utils/tests/inventoryEventBcs.test.ts Updates test import path to match utils/events/ location.
packages/libs/dapp-kit/utils/tests/constants.test.ts Updates expected EVE coin type for TenantId.STILLNESS (aligned with wallet-core bump).
packages/libs/dapp-kit/providers/SmartObjectProvider.tsx Adds temporary console debug output when processing stream events (needs cleanup before merge).
packages/libs/dapp-kit/package.json Bumps @evefrontier/wallet-core to 0.0.4.
bun.lock Updates workspace package versions and resolved @evefrontier/wallet-core to 0.0.4.
biome.jsonc Updates Biome schema reference from 2.5.0 to 2.5.1.

Comment thread packages/libs/dapp-kit/providers/SmartObjectProvider.tsx Outdated
Comment thread packages/libs/dapp-kit/utils/events/checkpointStream.ts
Comment thread packages/libs/dapp-kit/CHANGELOG.md
Comment thread packages/libs/dapp-kit/package.json

@ccp-bofai ccp-bofai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can you explain the changes I have commented on please.

@ccp-bofai ccp-bofai left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@fcsondheim fcsondheim merged commit a8ea550 into main Jun 25, 2026
3 checks passed
@fcsondheim fcsondheim deleted the wallet-core branch June 25, 2026 13:21
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