|
|
@ -1,6 +1,8 @@ |
|
|
|
import { ethers } from "ethers"; |
|
|
|
import { ethers } from 'ethers'; |
|
|
|
import { types } from "@abacus-network/utils"; |
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
|
|
|
|
AbacusConnectionManager, |
|
|
|
|
|
|
|
AbacusConnectionManager__factory, |
|
|
|
InterchainGasPaymaster, |
|
|
|
InterchainGasPaymaster, |
|
|
|
InterchainGasPaymaster__factory, |
|
|
|
InterchainGasPaymaster__factory, |
|
|
|
Outbox, |
|
|
|
Outbox, |
|
|
@ -9,11 +11,11 @@ import { |
|
|
|
TestInbox__factory, |
|
|
|
TestInbox__factory, |
|
|
|
UpgradeBeaconController, |
|
|
|
UpgradeBeaconController, |
|
|
|
UpgradeBeaconController__factory, |
|
|
|
UpgradeBeaconController__factory, |
|
|
|
AbacusConnectionManager, |
|
|
|
} from '@abacus-network/core'; |
|
|
|
AbacusConnectionManager__factory, |
|
|
|
import { types } from '@abacus-network/utils'; |
|
|
|
} from "@abacus-network/core"; |
|
|
|
import { addressToBytes32 } from '@abacus-network/utils/dist/src/utils'; |
|
|
|
import { TestDeploy } from "./TestDeploy"; |
|
|
|
|
|
|
|
import { addressToBytes32 } from "@abacus-network/utils/dist/src/utils"; |
|
|
|
import { TestDeploy } from './TestDeploy'; |
|
|
|
|
|
|
|
|
|
|
|
export type TestAbacusConfig = { |
|
|
|
export type TestAbacusConfig = { |
|
|
|
signer: Record<types.Domain, ethers.Signer>; |
|
|
|
signer: Record<types.Domain, ethers.Signer>; |
|
|
@ -50,7 +52,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
const signer = this.config.signer[domain]; |
|
|
|
const signer = this.config.signer[domain]; |
|
|
|
|
|
|
|
|
|
|
|
const upgradeBeaconControllerFactory = new UpgradeBeaconController__factory( |
|
|
|
const upgradeBeaconControllerFactory = new UpgradeBeaconController__factory( |
|
|
|
signer |
|
|
|
signer, |
|
|
|
); |
|
|
|
); |
|
|
|
const upgradeBeaconController = |
|
|
|
const upgradeBeaconController = |
|
|
|
await upgradeBeaconControllerFactory.deploy(); |
|
|
|
await upgradeBeaconControllerFactory.deploy(); |
|
|
@ -64,18 +66,18 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
await outbox.initialize(upgradeBeaconController.address); |
|
|
|
await outbox.initialize(upgradeBeaconController.address); |
|
|
|
|
|
|
|
|
|
|
|
const abacusConnectionManagerFactory = new AbacusConnectionManager__factory( |
|
|
|
const abacusConnectionManagerFactory = new AbacusConnectionManager__factory( |
|
|
|
signer |
|
|
|
signer, |
|
|
|
); |
|
|
|
); |
|
|
|
const abacusConnectionManager = |
|
|
|
const abacusConnectionManager = |
|
|
|
await abacusConnectionManagerFactory.deploy(); |
|
|
|
await abacusConnectionManagerFactory.deploy(); |
|
|
|
await abacusConnectionManager.setOutbox(outbox.address); |
|
|
|
await abacusConnectionManager.setOutbox(outbox.address); |
|
|
|
|
|
|
|
|
|
|
|
const interchainGasPaymasterFactory = new InterchainGasPaymaster__factory( |
|
|
|
const interchainGasPaymasterFactory = new InterchainGasPaymaster__factory( |
|
|
|
signer |
|
|
|
signer, |
|
|
|
); |
|
|
|
); |
|
|
|
const interchainGasPaymaster = await interchainGasPaymasterFactory.deploy(); |
|
|
|
const interchainGasPaymaster = await interchainGasPaymasterFactory.deploy(); |
|
|
|
await abacusConnectionManager.setInterchainGasPaymaster( |
|
|
|
await abacusConnectionManager.setInterchainGasPaymaster( |
|
|
|
interchainGasPaymaster.address |
|
|
|
interchainGasPaymaster.address, |
|
|
|
); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
const inboxFactory = new TestInbox__factory(signer); |
|
|
|
const inboxFactory = new TestInbox__factory(signer); |
|
|
@ -93,7 +95,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
remote, |
|
|
|
remote, |
|
|
|
upgradeBeaconController.address, |
|
|
|
upgradeBeaconController.address, |
|
|
|
ethers.constants.HashZero, |
|
|
|
ethers.constants.HashZero, |
|
|
|
0 |
|
|
|
0, |
|
|
|
); |
|
|
|
); |
|
|
|
await abacusConnectionManager.enrollInbox(remote, inbox.address); |
|
|
|
await abacusConnectionManager.enrollInbox(remote, inbox.address); |
|
|
|
inboxes[remote] = inbox; |
|
|
|
inboxes[remote] = inbox; |
|
|
@ -104,7 +106,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
await outbox.dispatch( |
|
|
|
await outbox.dispatch( |
|
|
|
remotes.find((_) => _ !== domain)!, |
|
|
|
remotes.find((_) => _ !== domain)!, |
|
|
|
addressToBytes32(ethers.constants.AddressZero), |
|
|
|
addressToBytes32(ethers.constants.AddressZero), |
|
|
|
"0x" |
|
|
|
'0x', |
|
|
|
); |
|
|
|
); |
|
|
|
return { |
|
|
|
return { |
|
|
|
outbox, |
|
|
|
outbox, |
|
|
@ -164,7 +166,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
async processOutboundMessages( |
|
|
|
async processOutboundMessages( |
|
|
|
origin: types.Domain |
|
|
|
origin: types.Domain, |
|
|
|
): Promise<Map<types.Domain, ethers.providers.TransactionResponse[]>> { |
|
|
|
): Promise<Map<types.Domain, ethers.providers.TransactionResponse[]>> { |
|
|
|
const responses: Map<types.Domain, ethers.providers.TransactionResponse[]> = |
|
|
|
const responses: Map<types.Domain, ethers.providers.TransactionResponse[]> = |
|
|
|
new Map(); |
|
|
|
new Map(); |
|
|
@ -193,7 +195,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
for (const dispatch of dispatches) { |
|
|
|
for (const dispatch of dispatches) { |
|
|
|
const destination = dispatch.args.destination; |
|
|
|
const destination = dispatch.args.destination; |
|
|
|
if (destination === origin) |
|
|
|
if (destination === origin) |
|
|
|
throw new Error("Dispatched message to local domain"); |
|
|
|
throw new Error('Dispatched message to local domain'); |
|
|
|
const inbox = this.inbox(origin, destination); |
|
|
|
const inbox = this.inbox(origin, destination); |
|
|
|
const status = await inbox.messages(dispatch.args.messageHash); |
|
|
|
const status = await inbox.messages(dispatch.args.messageHash); |
|
|
|
if (status !== types.MessageStatus.PROCESSED) { |
|
|
|
if (status !== types.MessageStatus.PROCESSED) { |
|
|
@ -203,7 +205,7 @@ export class TestAbacusDeploy extends TestDeploy< |
|
|
|
} |
|
|
|
} |
|
|
|
const response = await inbox.testProcess( |
|
|
|
const response = await inbox.testProcess( |
|
|
|
dispatch.args.message, |
|
|
|
dispatch.args.message, |
|
|
|
dispatch.args.leafIndex.toNumber() |
|
|
|
dispatch.args.leafIndex.toNumber(), |
|
|
|
); |
|
|
|
); |
|
|
|
let destinationResponses = responses.get(destination) || []; |
|
|
|
let destinationResponses = responses.get(destination) || []; |
|
|
|
destinationResponses.push(response); |
|
|
|
destinationResponses.push(response); |
|
|
|