Track starting blocks for Core deployments (#424)

* Track starting blocks for Core deployments

* Prettier
yorhodes/427
Nam Chu Hoai 3 years ago committed by GitHub
parent 406f0fada7
commit 233d0aa14d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      typescript/infra/scripts/core.ts
  2. 1
      typescript/infra/src/config/agent.ts
  3. 22
      typescript/infra/src/core/deploy.ts

@ -12,10 +12,7 @@ async function main() {
const environment = await getEnvironment();
const config = getCoreEnvironmentConfig(environment) as any;
const multiProvider = await config.getMultiProvider();
const deployer = new AbacusCoreDeployer(
multiProvider,
config.core.validatorManagers,
);
const deployer = new AbacusCoreDeployer(multiProvider, config.core);
const addresses = await deployer.deploy();

@ -243,6 +243,7 @@ export type InboxAddresses = {
export type RustConfig<Networks extends ChainName> = {
environment: DeployEnvironment;
index?: { from: string };
signers: Partial<ChainMap<Networks, RustSigner>>;
inboxes: RemoteChainMap<Networks, any, RustContractBlock<InboxAddresses>>;
outbox: RustContractBlock<OutboxAddresses>;

@ -41,12 +41,28 @@ export class AbacusCoreDeployer<
CoreConfig,
CoreContractAddresses<Networks, any>
> {
// Tracks the block number per network from which contract deployment started
startingBlockNumbers: ChainMap<Networks, number | undefined>;
constructor(
multiProvider: MultiProvider<Networks>,
configMap: ChainMap<Networks, CoreConfig>,
) {
super(multiProvider, configMap);
this.startingBlockNumbers = objMap(configMap, () => undefined);
}
async deployContracts<Local extends Networks>(
network: Local,
config: CoreConfig,
): Promise<CoreContractAddresses<Networks, Local>> {
const dc = this.multiProvider.getDomainConnection(network);
const provider = dc.provider!;
const signer = dc.signer!;
const startingBlockNumber = await provider.getBlockNumber();
this.startingBlockNumbers[network] = startingBlockNumber;
const upgradeBeaconController = await this.deployContract(
network,
'UpgradeBeaconController',
@ -221,6 +237,12 @@ export class AbacusCoreDeployer<
db: 'db_path',
};
const startingBlockNumber = this.startingBlockNumbers[network];
if (startingBlockNumber) {
rustConfig.index = { from: startingBlockNumber.toString() };
}
this.multiProvider.remotes(network).forEach((remote) => {
const inboxAddresses = addresses.inboxes[remote];

Loading…
Cancel
Save