Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: namespace getExpectedWithdrawals benchmark #5530

Merged
merged 1 commit into from
May 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,18 @@ describe("getExpectedWithdrawals", () => {

for (const opts of testCases) {
const caseID = [
`eb ${opts.excessBalance}`,
`eth1 ${opts.eth1Credentials}`,
`we ${opts.withdrawable}`,
`wn ${opts.withdrawn}`,
`eb:${opts.excessBalance}`,
`eth1:${opts.eth1Credentials}`,
`we:${opts.withdrawable}`,
`wn:${opts.withdrawn}`,
opts.cache ? null : "nocache",
`- smpl ${opts.sampled}`,
`smpl:${opts.sampled}`,
]
.filter((str) => str)
.join(" ");
.join(",");

itBench<CachedBeaconStateCapella, CachedBeaconStateCapella>({
id: `vc - ${vc} ${caseID}`,
id: `getExpectedWithdrawals ${vc} ${caseID}`,
yieldEventLoopAfterEach: true, // So SubTree(s)'s WeakRef can be garbage collected https://github.com/nodejs/node/issues/39902
before: () => {
const state = getExpectedWithdrawalsTestData(vc, opts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,18 @@ describe("getExpectedWithdrawals", () => {

for (const opts of testCases) {
const caseID = [
`eb ${opts.excessBalance}`,
`eth1 ${opts.eth1Credentials}`,
`we ${opts.withdrawable}`,
`wn ${opts.withdrawn}`,
`eb:${opts.excessBalance}`,
`eth1:${opts.eth1Credentials}`,
`we:${opts.withdrawable}`,
`wn:${opts.withdrawn}`,
]
.filter((str) => str)
.join(" ");
.join(",");

// Clone true to drop cache
const state = beforeValue(() => getExpectedWithdrawalsTestData(vc, opts).clone(true));

it(`vc - ${vc} ${caseID}`, () => {
it(`getExpectedWithdrawals ${vc} ${caseID}`, () => {
const {sampledValidators, withdrawals} = getExpectedWithdrawals(state.value);
expect(sampledValidators).equals(opts.sampled, "Wrong sampledValidators");
expect(withdrawals.length).equals(opts.withdrawals, "Wrong withdrawals");
Expand Down