diff --git a/packages/agents/lighthouse/src/tasks/propose/operations/propose.ts b/packages/agents/lighthouse/src/tasks/propose/operations/propose.ts index 568006489e..35da51d12a 100644 --- a/packages/agents/lighthouse/src/tasks/propose/operations/propose.ts +++ b/packages/agents/lighthouse/src/tasks/propose/operations/propose.ts @@ -6,6 +6,7 @@ import { SparseMerkleTree, jsonifyError, domainToChainId, + EMPTY_ROOT, } from "@connext/nxtp-utils"; import { BigNumber } from "ethers"; @@ -26,7 +27,6 @@ export type ExtraPropagateParam = { _fee: string; _encodedData: string; }; -const EMPTY_ROOT = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757"; export const proposeHub = async () => { const { diff --git a/packages/agents/lighthouse/src/tasks/prover/operations/publisher.ts b/packages/agents/lighthouse/src/tasks/prover/operations/publisher.ts index 5878e62eab..6826f82e04 100644 --- a/packages/agents/lighthouse/src/tasks/prover/operations/publisher.ts +++ b/packages/agents/lighthouse/src/tasks/prover/operations/publisher.ts @@ -12,6 +12,7 @@ import { RelayerTaskStatus, ModeType, Snapshot, + EMPTY_ROOT, } from "@connext/nxtp-utils"; import { @@ -231,8 +232,11 @@ export const enqueue = async () => { throw new NoTargetMessageRoot(originDomain); } // Count of leafs in aggregate tree at snapshot baseAggregateRoot. - const _baseAggregateRootCount = await database.getAggregateRootCount(snapshot.baseAggregateRoot); - if (!_baseAggregateRootCount) { + const _baseAggregateRootCount = + snapshot.baseAggregateRoot === EMPTY_ROOT + ? 0 + : await database.getAggregateRootCount(snapshot.baseAggregateRoot); + if (_baseAggregateRootCount === undefined) { throw new NoAggregateRootCount(snapshot.baseAggregateRoot); } aggregateRootCount = snapshot.roots.length + _baseAggregateRootCount; @@ -240,7 +244,10 @@ export const enqueue = async () => { } // Count of leaf nodes in origin domain`s outbound tree with the targetMessageRoot as root - messageRootCount = await database.getMessageRootCount(originDomain, targetMessageRoot); + messageRootCount = + targetMessageRoot === EMPTY_ROOT + ? 0 + : await database.getMessageRootCount(originDomain, targetMessageRoot); if (messageRootCount === undefined) { throw new NoMessageRootCount(originDomain, targetMessageRoot); } diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts index eb980e1a46..1cb7e1f09c 100644 --- a/packages/utils/src/constants/index.ts +++ b/packages/utils/src/constants/index.ts @@ -1,3 +1,4 @@ export * from "./abi"; export * from "./gas"; export * from "./router"; +export * from "./lighthouse"; diff --git a/packages/utils/src/constants/lighthouse.ts b/packages/utils/src/constants/lighthouse.ts new file mode 100644 index 0000000000..a1d0d99d80 --- /dev/null +++ b/packages/utils/src/constants/lighthouse.ts @@ -0,0 +1 @@ +export const EMPTY_ROOT = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757";