Skip to content

[GoodBounty]: Finalize MBPBridge refactor of tx history #270

Open

Description

@L03TJ3

Summary

Pick up the existing AI-generated PR for MPB bridge transaction history reliability, run it locally, validate the full bridge flow, fix implementation gaps, clean up AI-written code, and prepare the PR for human review.

Contributor task

  • Claim the bounty with an ETA.
  • Check out PR Refactor MP bridge history to chunked per-chain log sync #269 and run it locally.
  • Compare the implementation against issue [Bug]: MPB Bridge Transaction History does not load reliably #268, the PR description, and repository patterns.
  • Validate that the bridge history flow works against real or approved test RPCs.
  • Fix concrete bugs in behavior, state handling, tests, typing, performance, or code quality. (specifically related to the transaction history. any other bugs in the flow should be raised as comment/async during testing/finalizig)
  • Review code quality and simplify structure where the current AI-generated implementation is either too monolithic or over-split into low-value helpers.
  • (not done yet): Add narrow bridge-specific curated RPC list support for MPB history reads, without restructuring the existing sdk-v2 provider architecture.
  • Clean up unnecessary AI artifacts, comments, noisy logs, and unrelated changes.
  • Provide a demo video showing the full flow working end-to-end.
  • Leave a handoff comment with what changed, what was tested, evidence links, and remaining risks.

Scope checks

  • The PR solves issue [Bug]: MPB Bridge Transaction History does not load reliably #268 requirements.
  • The implementation follows the issue plan or explains any deviation.
  • Existing SDK and design package boundaries are respected.
  • Cached transactions render immediately on warm load.
  • Empty cache triggers a 30-day backfill without any eth_getLogs request over 500 blocks.
  • Non-empty cache fetches only from each chain cursor forward.
  • Per-chain RPC failures do not block successful chains from rendering and updating cache.
  • Loading, refreshing, empty, and partial-error states are distinct in the UI.
  • A completed bridge action visibly triggers history refresh.
  • Manual refresh works without remounting the hook.
  • Pending vs completed bridge rows still merge correctly across BridgeRequest and ExecutedTransfer.
  • MPB history can use a curated bridge-specific RPC list, with fallback to the existing app-level readOnlyUrls.
  • The curated RPC list is scoped to MPB bridge history reads and does not force a broad sdk-v2 provider architecture rewrite.
  • Hooks/components are reviewed for responsibility boundaries: avoid one hook/component handling too much, but also avoid extracting one-line helpers that are only used once or twice and do not reduce complexity.
  • Spending approval behavior is validated and fixed if stale allowance/approval state can cause skipped approval or stuck bridge execution.
  • Desktop and mobile layouts are usable.
  • PR description links the source issue and includes test evidence.
  • The PR includes a demo video of the full flow.

Initial review notes

The PR appears to implement the intended direction:

  • Replaces useLogs with direct provider.getLogs calls in packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridgeHistory.ts.
  • Adds chunk generation and cache merge helpers in packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridgeHistory.helpers.ts.
  • Adds helper tests in packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridgeHistory.helpers.test.ts.
  • Adds UI refresh/error state in packages/good-design/src/apps/bridge/mpbridge/TransactionHistory.tsx.
  • Calls refreshHistory() after bridge success in packages/good-design/src/apps/bridge/mpbridge/feature/useMPBBridgeViewController.ts.

Known review risks to validate:

  • The 30-day backfill may produce many getLogs calls across four chains and two event types; validate runtime, RPC rate limits, and user-facing loading behavior.
  • The current implementation uses providers from the global usedapp readOnlyUrls; it does not add bridge-specific curated RPC support. (Missing and should add: support for rpcList for the bridge-flow)
  • The PR includes .gitignore changes for local agent artifacts; remove or justify if unrelated.
  • Spending approval behavior was flagged during review: after a previous per-transaction approval is consumed, the next bridge should re-check allowance and request approval when needed.

Additional implementation requirements

Code quality review

Review the AI-generated implementation for structure before requesting human review. The goal is simple, maintainable code:

  • Do not leave one big hook or component responsible for unrelated concerns such as RPC fetching, cache persistence, event matching, UI state shaping, and display rendering.
  • Do not overcorrect by moving trivial one-line expressions into helpers that are only used once or twice and do not clarify the code.
  • Prefer extracting helpers only when they remove real complexity, reduce meaningful duplication, or create a unit that can be tested independently.
  • Keep comments focused on non-obvious behavior; overly commenting is prefered

Bridge-specific curated RPC list

Add support for a curated RPC list used specifically by MPB bridge history reads. Keep this narrowly scoped.

Suggested simple approach:

  • Add an optional prop near the high-level bridge entry point, likely MPBBridgeController, for example bridgeReadOnlyUrls?: Partial<Record<number, string>>.
  • Pass that value through the MPB bridge feature/view hooks only as far as needed by transaction history.
  • Update useMPBBridgeHistory to accept an optional RPC override map, for example useMPBBridgeHistory({ readOnlyUrls }).
  • When an override URL exists for a chain, create the read-only provider for that chain from the override and use it for getLogs; otherwise keep the existing provider from app-level usedapp readOnlyUrls.
  • Keep the change single-purpose: do not redesign Web3Provider, useReadOnlyProvider, or the wider sdk-v2 provider system unless there is no smaller working option.

The implementation should be deterministic enough for validation: the demo video and handoff notes must state exactly which RPC URLs were used for Fuse, Celo, Ethereum mainnet, and XDC.

Required commands

Run the relevant commands and include exact results in the PR handoff comment:

yarn
yarn lint
yarn workspace @gooddollar/web3sdk-v2 test packages/sdk-v2/src/sdk/mpbridge/hooks/useMPBBridgeHistory.helpers.test.ts --runInBand
yarn workspace @gooddollar/web3sdk-v2 build
yarn workspace @gooddollar/good-design build

If a command cannot be run, document the exact command, failure output, environment, and whether the failure is pre-existing or introduced by PR #269.

Manual verification

Validate the MPB bridge screen with a connected wallet and supported source/target route.

  • First open with empty cache performs a 30-day backfill and eventually renders history or a correct empty state.
  • Second open with populated cache shows cached rows immediately (you need to do at least one transaction, funds can be shared once you are at this stage, ping @L03TJ3 ).
  • Background refresh shows a visible refreshing state while keeping cached rows visible.
  • Manual Refresh fetches from cached cursors forward.
  • A new bridge transaction triggers history refresh after success.
  • The new transaction appears as pending and later resolves to completed when the target event is available.
  • One failing RPC/network does not prevent other chains from updating.
  • No eth_getLogs request exceeds 500 blocks.
    -- Note: I have had a test where it was even denied saying 'cannot be more then 50 blocks'. I dont remember or saw clearly what RPC or what chain, but this is where the support for rpcList comes from. Should mainly rely for this flow on more well-known public rpcs per chain)
  • Curated bridge RPC URLs are used when provided, and the existing app-level readOnlyUrls remain the fallback.
  • Approval is requested when current allowance is insufficient for the transaction amount.
  • The flow is usable on desktop and mobile viewport sizes.

Demo video requirement

Attach or link a demo video in the PR handoff comment. The video must show:
A single flow from doing a bridge > confirming the bridge and showing that the transaction history accurately updates.

Handoff comment

Please use the hand-off comment template found here: https://github.com/GoodDollar/GoodWidget/blob/main/docs/contributor-bounty-template.md#handoff-comment

Out of scope

  • Do not redesign the bridge UI beyond what is needed for clear loading, refresh, error, and history states.
  • Do not change bridge contract behavior.
  • Do not broaden the task to unrelated bridge providers or unrelated SDK packages.

Activity

  1. edehvictor commented on Jul 2, 2026

    @edehvictor
    Contributor

    GM @L03TJ. I'm an active contributor on the GoodDollar ecosystem. I have worked on couple of complex issues on projects across the ecosystem. I'd kindly request you assign this issue to be. I would resolve it with critically and submit PR that fixes it within 12-32HRS after assignment. Kindly consider.

  2. L03TJ3 commented on Jul 2, 2026

    @L03TJ3
    CollaboratorAuthor

    Okay, you got assigned @edehvictor

    For testing locally!

    1. you should branch out from the current pull-request (not from main)
    2. to test this locally you have to use yalc
      -- First you run yarn install --immutable
      -- Then you go into sdk-v2 and run yarn build
      -- then you go into good-design and do: yarn install && yalc add -D "@"gooddollar/web3sdk-v2 (without quotes) && yarn build
    3. you clone GoodProtocolUI on master branch.
      -- you ran yarn install --immutable
      -- you run `yalc add "@gooddollar/good-design "@gooddollar/web3sdk-v2"

    and run yarn install again.

    You have already worked on GoodProtocolUI so I assume you have an .env file with approriate keys.
    if something is not working, please let me know!

  3. edehvictor commented on Jul 3, 2026

    @edehvictor
    Contributor

    Contributor: @edehvictor
    PR: #271
    Commit: c95b0f3

    Fixed:

    • Stabilized MPB bridge transaction history reads by using direct provider.getLogs calls with max 500-block chunks.
    • Added account-indexed BridgeRequest / ExecutedTransfer filters, log deduplication, cursor-based cache refresh, and 30-day cold-cache backfill.
    • Added per-chain partial error handling so one failing RPC does not block successful chains from rendering cached or refreshed history.
    • Added narrow bridge-specific bridgeReadOnlyUrls support for MPB history reads, without redesigning the wider sdk-v2 provider architecture.
    • Scoped GoodDesign history refreshes to the selected source/target chains and refreshed history after successful bridge completion.
    • Added helper tests for chunking, account topics, dedupe, and cache merge behavior.

    Verified:

    • node .yarn\releases\yarn-3.2.1.cjs workspace @gooddollar/web3sdk-v2 exec tsc --noEmit: Passed
    • node .yarn\releases\yarn-3.2.1.cjs workspace @gooddollar/good-design exec tsc --noEmit: Passed
    • ..\..\node_modules\.bin\jest.cmd src/sdk/mpbridge/hooks/useMPBBridgeHistory.helpers.test.ts --runInBand: Passed, 5 tests
    • node_modules\.bin\eslint.cmd --quiet <changed MPB history/design files>: Passed
    • Manual GoodProtocolUI flow: connected wallet on Celo, bridged 10 G$ from Celo to XDC via LayerZero, and Recent Transactions rendered the completed Celo -> XDC history row.
    • Manual bridge transaction hash: 0x866075b684c5c9babd57501a99a25d60a36bb3072d054b2b9f53299417c0cc76

    Evidence:

    • Local GoodProtocolUI validation used REACT_APP_NETWORK=production-celo with Celo RPCs tested/configured as https://forno.celo.org, https://rpc.ankr.com/celo, and https://celo.drpc.org.
    • The successful bridge history row showed Bridged via LayerZero, Celo -> XDC, and +10.00 G$.
    • Tests cover the core helper behavior needed to keep history reads bounded and cache-safe: 500-block chunking, account topics, fallback topics, log dedupe, and cache merge/state.

    Remaining risks:

    • Demo video https://www.loom.com/share/ca5ef9ad275245fea142ffee278f6f68
    • Full package build should be rerun in Git Bash, WSL, or CI where rm and yalc are available. In this Windows PowerShell environment the package build scripts fail before compiling because dev:clean calls Unix rm.
    • Full yarn lint is noisy in this Windows checkout because of repo-wide CRLF/prettier warnings across existing files; targeted lint on changed source files passed.
    • Approval behavior was not deeply changed in this patch. The tested bridge flow completed successfully, but stale allowance edge cases may need a separate focused pass if reviewers still suspect an approval-state bug.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions