diff --git a/contracts/rollup/Rollup.sol b/contracts/rollup/Rollup.sol index 2b952bdb..35223913 100644 --- a/contracts/rollup/Rollup.sol +++ b/contracts/rollup/Rollup.sol @@ -31,6 +31,7 @@ contract Rollup is BatchManager, EIP712, IEIP712 { /** * @dev If this is not being externally consumed, it can be removed. */ + // solhint-disable-next-line var-name-mixedcase bytes32 public immutable ZERO_BYTES32; // External contracts diff --git a/test/slow/rollup.transfer.test.ts b/test/slow/rollup.transfer.test.ts index 495dcc55..9f554770 100644 --- a/test/slow/rollup.transfer.test.ts +++ b/test/slow/rollup.transfer.test.ts @@ -1,21 +1,21 @@ +import chai, { assert } from "chai"; +import chaiAsPromised from "chai-as-promised"; +import { BigNumber } from "ethers"; +import { ethers } from "hardhat"; import { flatten } from "lodash"; import { deployAll } from "../../ts/deploy"; -import { TESTING_PARAMS } from "../../ts/constants"; -import { ethers } from "hardhat"; +import { TESTING_PARAMS, ZERO_BYTES32 } from "../../ts/constants"; import { StateTree } from "../../ts/stateTree"; import { AccountRegistry } from "../../ts/accountTree"; import { getAggregateSig, serialize, TxTransfer } from "../../ts/tx"; import * as mcl from "../../ts/mcl"; import { allContracts } from "../../ts/allContractsInterfaces"; -import chai, { assert } from "chai"; -import chaiAsPromised from "chai-as-promised"; import { getGenesisProof, TransferCommitment } from "../../ts/commitments"; import { float16, USDT } from "../../ts/decimal"; import { hexToUint8Array } from "../../ts/utils"; import { Group, txTransferFactory, User } from "../../ts/factory"; import { deployKeyless } from "../../ts/deployment/deploy"; import { handleNewBatch } from "../../ts/client/batchHandler"; -import { BigNumber } from "ethers"; import { Result } from "../../ts/interfaces"; chai.use(chaiAsPromised); @@ -239,7 +239,7 @@ describe("Rollup Transfer", async function() { expectedResult: Result.BadToIndex } ].forEach(({ description, txsFactory, expectedResult }) => { - it(`dispute and rollback a bad batch with l2 tx(s) with ${description}`, async function() { + it(`dispute and rollback a bad batch with L2 tx(s) with ${description}`, async function() { const { rollup } = contracts; const txs = txsFactory(); diff --git a/ts/stateTree.ts b/ts/stateTree.ts index 84e85356..d0c8baae 100644 --- a/ts/stateTree.ts +++ b/ts/stateTree.ts @@ -114,7 +114,8 @@ export class StateTree implements StateProvider { this.checkSize(stateID); const state = this.states[stateID] || ZERO_STATE; const witness = this.stateTree.witness(stateID).nodes; - return { state, stateHash: state.hash(), witness }; + const stateHash = state === ZERO_STATE ? ZERO_BYTES32 : state.hash(); + return { state, stateHash, witness }; } /** Side effect! */