From 60be25159f6786d5f911502aefdaa7ab7fd3cb6f Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Thu, 4 Feb 2021 15:30:37 -0600 Subject: [PATCH] fix: properly honour FIXME_MAX_CRANKS_PER_BLOCK --- packages/cosmic-swingset/lib/launch-chain.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/cosmic-swingset/lib/launch-chain.js b/packages/cosmic-swingset/lib/launch-chain.js index a96d1228b30..430ad16887a 100644 --- a/packages/cosmic-swingset/lib/launch-chain.js +++ b/packages/cosmic-swingset/lib/launch-chain.js @@ -18,9 +18,9 @@ const log = anylogger('launch-chain'); const SWING_STORE_META_KEY = 'cosmos/meta'; -// This is how many steps we run per block, as per #2299. +// This is how many cranks we run per block, as per #2299. // TODO Make it dependent upon metering instead. -const FIXME_STEPS_PER_BLOCK = 1000; +const FIXME_MAX_CRANKS_PER_BLOCK = 1000; async function buildSwingset( mailboxStorage, @@ -99,14 +99,13 @@ export async function launch( // //////////////////////////// // TODO: This is where we would add the scheduler. async function endBlock(_blockHeight, _blockTime) { - let stepsRemaining = FIXME_STEPS_PER_BLOCK; + let stepsRemaining = FIXME_MAX_CRANKS_PER_BLOCK; let stepped = true; while (stepped && stepsRemaining > 0) { // eslint-disable-next-line no-await-in-loop stepped = await controller.step(); stepsRemaining -= 1; } - await controller.run(); } async function saveChainState() {