fuels-ts icon indicating copy to clipboard operation
fuels-ts copied to clipboard

chore: support RPC consistency mechanism

Open nedsalk opened this issue 10 months ago • 3 comments

  • Closes #3443

Release notes

In this release, we:

  • added support for required_fuel_block_height to fix RPC consistency issues

Summary

flowchart TD
    Initialize[init: currentBlockHeight = 0] --> prepareRequest[prepare request]
    
    prepareRequest --> isRequestBlockSensitive[is request block height sensitive]

    isRequestBlockSensitive --> isSensitive[yes]
    isRequestBlockSensitive --> isNotSensitive[no]

    isSensitive --> addBlockHeight[inform required block height]

    addBlockHeight --> sendRequest[send request]

    isNotSensitive --> sendRequest[send request]


    sendRequest --> response[response has block height error?]

    response --> blockHeightError(yes)
    response --> noBlockHeightError(no)

    blockHeightError --> shouldRetry(should retry?)

    shouldRetry --> retry(yes)
    shouldRetry --> noRetry(no)

    retry --> wait(wait)
    wait --> sendRequest

    noRetry --> throwError(throw error)

    noBlockHeightError --> extractBlockHeight(extract block height from response)

    extractBlockHeight --> isHigher

    isHigher[is value higher than current?]

    isHigher --> higher[yes]
    isHigher --> nonHigher[no]

    higher --> updateBlockHeight[set new value]
    updateBlockHeight --> End[end]
    
    nonHigher --> End

Checklist

  • [x] All changes are covered by tests (or not applicable)
  • [x] All changes are documented (or not applicable)
  • [x] I reviewed the entire PR myself (preferably, on GH UI)
  • [x] I described all Breaking Changes (or there's none)

nedsalk avatar Feb 27 '25 14:02 nedsalk

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2025 10:47am
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2025 10:47am
ts-docs-api ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 25, 2025 10:47am

vercel[bot] avatar Feb 27 '25 14:02 vercel[bot]

E2E tests are failing. IIRC, pre-confs should not be in 0.42.0. Please, clarify what's going on, work around it, and report back.

@arboleya I did the fix upstream in #3749, specifically here. We can continue this topic there if need be.

We need this finalized, green, and out of the way ASAP.

All green now. Finalization is pending closure of https://github.com/FuelLabs/fuels-ts/pull/3741#discussion_r1998393041.

nedsalk avatar Mar 19 '25 14:03 nedsalk

Temporary PR

This PR is published in AWS CodeArtifact with version: next

Install using the below commands — create-fuels variations are commented out.

PNPM

pnpm config set registry https://npm-packages.fuel.network/ --global
pnpm install fuels@next
# pnpm create fuels@next

NPM

npm --registry=https://npm-packages.fuel.network/ install fuels@next
# npm --registry=https://npm-packages.fuel.network/ create fuels@next

Bun

npm_config_registry=https://npm-packages.fuel.network/ bun install fuels@next
# npm_config_registry=https://npm-packages.fuel.network/ bun create fuels@next

github-actions[bot] avatar Mar 28 '25 13:03 github-actions[bot]

Coverage Report:

Lines Branches Functions Statements
77.57%(+0.17%) 70.77%(+0.19%) 75.84%(+0.18%) 77.57%(+0.16%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/provider.ts 72.14%
(+2.35%)
66.8%
(+2.45%)
75%
(+2.19%)
71.89%
(+2.37%)
🔴 packages/account/src/providers/generated/operations.ts 93.9%
(+0.61%)
100%
(+0%)
81.81%
(+1.81%)
94.38%
(+0.56%)
🔴 packages/account/src/providers/utils/handle-gql-error-message.ts 87.5%
(-0.5%)
76.47%
(+0%)
75%
(-5%)
84%
(-1.18%)
✨ packages/account/src/providers/utils/parse-graphql-response.ts 100%
(+100%)
100%
(+100%)
100%
(+100%)
100%
(+100%)

github-actions[bot] avatar Apr 25 '25 11:04 github-actions[bot]