Skip to content

Commit

Permalink
fix: properly honour FIXME_MAX_CRANKS_PER_BLOCK
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Feb 4, 2021
1 parent 94789a7 commit 60be251
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/cosmic-swingset/lib/launch-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 60be251

Please sign in to comment.