Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix LH prover #5065

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
SparseMerkleTree,
jsonifyError,
domainToChainId,
EMPTY_ROOT,
} from "@connext/nxtp-utils";
import { BigNumber } from "ethers";

Expand All @@ -26,7 +27,6 @@ export type ExtraPropagateParam = {
_fee: string;
_encodedData: string;
};
const EMPTY_ROOT = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757";

export const proposeHub = async () => {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
RelayerTaskStatus,
ModeType,
Snapshot,
EMPTY_ROOT,
} from "@connext/nxtp-utils";

import {
Expand Down Expand Up @@ -231,16 +232,22 @@ 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;
messageRootIndex = _baseAggregateRootCount + domainIndex;
}

// 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);
}
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/constants/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from "./abi";
export * from "./gas";
export * from "./router";
export * from "./lighthouse";
1 change: 1 addition & 0 deletions packages/utils/src/constants/lighthouse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const EMPTY_ROOT = "0x27ae5ba08d7291c96c8cbddcc148bf48a6d68c7974b94356f53754ef6171d757";