feat: add finalized tag when querying blocks (#386)
* Import Compact, BlockNumber Types: Create isFinalizedBlock method * Add finalized tag type * Cleanup isFinalizedBlock, add comments, add finalized tag * Run lint --fix * Parallelize rpc query * Update isFinalized to account for fork edgecase * Refactor promises, and lint * Optimize and refactor rpc calls * Update blocks controller to accomodate fetchBlock params * Refactor initial Promise.all() * Update fetchBlock in test suites to fit updated params * Add finalized tag with boolean tru * Mock data for testing queried hashs on forks * Add tests for isFinalizedBlock: (2 tests, one is a queried hash is on a fork, and another to confirm a finalized block) * export mock json data * Run lint --fix * Update grammar * Update src/services/blocks/BlocksService.spec.ts Co-authored-by: David <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: David <[email protected]> * Update src/services/blocks/BlocksService.spec.ts Co-authored-by: David <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: David <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: David <[email protected]> * Resolve comment formatting * Update src/controllers/blocks/BlocksController.ts Co-authored-by: Zeke Mostov <[email protected]> * Update params for fetchBlock to an options object * BlockService resolve merge conflicts * More merge conflicts resolved * Revert changes * Remove BlockNumber * Revert test * fix: Conflicts resolved, and up to date with master * feat: omit finalized tag when running against a PoW chain * update: update the docs * feat: add testing for omiting the finalized tag * DRY test suite * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * fix: lint * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: David <[email protected]> * Update src/controllers/blocks/BlocksController.ts Co-authored-by: David <[email protected]> * fix: omitFinalizeTag => omitFinalizedTag * fix: DRY finalized * fix: check for undefined finalizedHeadBlockNumber * Update docs * fix: docs, and update the finalized description * Update src/controllers/blocks/BlocksController.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * fix: DRY test code * Update src/services/blocks/BlocksService.ts Co-authored-by: Zeke Mostov <[email protected]> * fix: docs on interface * fix: lint * fix: queryFinalized should be false * fix: queryFinalized should be false fix: when querying for blockId and on a PoW chain omit finalized tag * fix: lint Co-authored-by: David <[email protected]> Co-authored-by: Zeke Mostov <[email protected]>
parent
8c621b08
Please register or sign in to comment