-
-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: update the block production race (#6241)
* Update the promise race implementation * Update block production race * Fix spelling * Work on feedback * Update the test file name * Update the promise tests * Update util to switch * chore: add early return on censoring builder or 0 builder boost * Update the promise to extended promise * Update the builder flow * Fix the types * Fix lint errors * Simplify logging * Improve log messages for block values * Update the promise to be typesafe * Update the validator implementation * Restructure test file for better review * Fix lint errors * Fix lint error * Make the tyep more flexible * Fix flaky tests * Improve log message * Simplify implementation * Update log message function * chore: add review feedback * chore: fix linter error * chore: address PR comments * Update packages/beacon-node/src/api/impl/validator/index.ts Co-authored-by: Nico Flaig <nflaig@protonmail.com> * chore: address PR comments * chore: clean up selectBlockProductionSource * Fix unit tests * Add support for routes.validator.BuilderSelection.ExecutionOnly * Fix unit tests * Increase the timeout for e2e env * Apply suggestions from code review Co-authored-by: Nico Flaig <nflaig@protonmail.com> * Increase the timeout for e2e env * Revert e2e timeout --------- Co-authored-by: Cayman <caymannava@gmail.com> Co-authored-by: Nico Flaig <nflaig@protonmail.com>
- Loading branch information
1 parent
00dfa63
commit ac4e714
Showing
11 changed files
with
479 additions
and
357 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import {describe, it, expect} from "vitest"; | ||
import {formatBigDecimal} from "../../src/format.js"; | ||
|
||
describe("format", () => { | ||
describe("formatBigDecimal", () => { | ||
const testCases: [bigint, bigint, bigint, string][] = [ | ||
[BigInt("103797739275696858"), BigInt("1000000000000000000"), BigInt("100000"), "0.10379"], | ||
[BigInt("103797739275696858"), BigInt("1000000000000000000"), BigInt("1000"), "0.103"], | ||
[BigInt("10379773927569685"), BigInt("1000000000000000000"), BigInt("1000"), "0.010"], | ||
[BigInt("1037977392756968"), BigInt("1000000000000000000"), BigInt("1000"), "0.001"], | ||
[BigInt("1037977392756968"), BigInt("1000000000000000000"), BigInt("100000"), "0.00103"], | ||
[BigInt("58200000000000000"), BigInt("1000000000000000000"), BigInt("100000"), "0.05820"], | ||
[BigInt("111103797739275696858"), BigInt("1000000000000000000"), BigInt("100000"), "111.10379"], | ||
[BigInt("111103797739275696858"), BigInt("1000000000000000000"), BigInt("1000"), "111.103"], | ||
[BigInt("1037977392756"), BigInt("1000000000000000000"), BigInt("100000"), "0.00000"], | ||
]; | ||
for (const [numerator, denominator, decimalFactor, expectedString] of testCases) { | ||
it(`format ${numerator} / ${denominator} correctly to ${expectedString}`, () => { | ||
expect(formatBigDecimal(numerator, denominator, decimalFactor)).toBe(expectedString); | ||
}); | ||
} | ||
}); | ||
}); |
Oops, something went wrong.