Skip to content

Commit

Permalink
test: fix the benchmark tests (#6160)
Browse files Browse the repository at this point in the history
* Update the number of validators

* Run the benchmark workflow manually

* Add comments explaining the function side effects
  • Loading branch information
nazarhussain authored Dec 6, 2023
1 parent 836fabf commit f8d3ab0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
branches:
- stable
- unstable
workflow_dispatch:

jobs:
run:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ import {BeaconDb} from "../../../../src/index.js";
import {testLogger} from "../../../utils/logger.js";

const logger = testLogger();
const numberOfValidators = 1024;

describe("produceBlockBody", () => {
const stateOg = generatePerfTestCachedStateAltair({goBackOneSlot: false, vc: numberOfValidators});
const stateOg = generatePerfTestCachedStateAltair({goBackOneSlot: false});

let db: BeaconDb;
let chain: BeaconChain;
Expand Down
4 changes: 4 additions & 0 deletions packages/state-transition/test/perf/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,10 @@ export function cachedStateAltairPopulateCaches(state: CachedBeaconStateAltair):
state.inactivityScores.getAll();
}

/**
* Warning: This function has side effects on the cached state
* The order in which the caches are populated is important and can cause stable tests to fail.
*/
export function generatePerfTestCachedStateAltair(opts?: {
goBackOneSlot: boolean;
vc?: number;
Expand Down

0 comments on commit f8d3ab0

Please sign in to comment.