-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(hardhat-ovm): yarn lint:fix * install hardhat-deploy * refactor: move predeploys to own file * feat: enable hardhat-deploy on hardhat config * feat(contracts): add deployment steps * feat(ops): copy over any additional build files * ops: make scripts wait for more retries hardhat-deploy is slower and requires re-compiling
- Loading branch information
Showing
36 changed files
with
1,198 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ cache | |
cache-ovm | ||
|
||
l2geth/build/bin | ||
|
||
packages/contracts/deployments/custom |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/usr/bin/env ts-node-script | ||
|
||
import { Wallet } from 'ethers' | ||
import path from 'path' | ||
import dirtree from 'directory-tree' | ||
import fs from 'fs' | ||
|
||
// Ensures that all relevant environment vars are properly set. These lines *must* come before the | ||
// hardhat import because importing will load the config (which relies on these vars). Necessary | ||
// because CI currently uses different var names than the ones we've chosen here. | ||
// TODO: Update CI so that we don't have to do this anymore. | ||
process.env.HARDHAT_NETWORK = 'custom' // "custom" here is an arbitrary name. only used for CI. | ||
process.env.CONTRACTS_TARGET_NETWORK = 'custom' | ||
process.env.CONTRACTS_DEPLOYER_KEY = process.env.DEPLOYER_PRIVATE_KEY | ||
process.env.CONTRACTS_RPC_URL = | ||
process.env.L1_NODE_WEB3_URL || 'http://127.0.0.1:8545' | ||
|
||
import hre from 'hardhat' | ||
|
||
const main = async () => { | ||
const sequencer = new Wallet(process.env.SEQUENCER_PRIVATE_KEY) | ||
const deployer = new Wallet(process.env.DEPLOYER_PRIVATE_KEY) | ||
|
||
await hre.run('deploy', { | ||
l1BlockTimeSeconds: process.env.BLOCK_TIME_SECONDS, | ||
ctcForceInclusionPeriodSeconds: process.env.FORCE_INCLUSION_PERIOD_SECONDS, | ||
ctcMaxTransactionGasLimit: process.env.MAX_TRANSACTION_GAS_LIMIT, | ||
emMinTransactionGasLimit: process.env.MIN_TRANSACTION_GAS_LIMIT, | ||
emMaxtransactionGasLimit: process.env.MAX_TRANSACTION_GAS_LIMIT, | ||
emMaxGasPerQueuePerEpoch: process.env.MAX_GAS_PER_QUEUE_PER_EPOCH, | ||
emSecondsPerEpoch: process.env.SECONDS_PER_EPOCH, | ||
emOvmChainId: process.env.CHAIN_ID, | ||
sccFraudProofWindow: parseInt(process.env.FRAUD_PROOF_WINDOW_SECONDS, 10), | ||
sccSequencerPublishWindow: process.env.SEQUENCER_PUBLISH_WINDOW_SECONDS, | ||
ovmSequencerAddress: sequencer.address, | ||
ovmProposerAddress: sequencer.address, | ||
ovmRelayerAddress: sequencer.address, | ||
ovmAddressManagerOwner: deployer.address, | ||
}) | ||
|
||
// Stuff below this line is currently required for CI to work properly. We probably want to | ||
// update our CI so this is no longer necessary. But I'm adding it for backwards compat so we can | ||
// get the hardhat-deploy stuff merged. Woot. | ||
const nicknames = { | ||
'Lib_AddressManager': 'AddressManager', | ||
'mockOVM_BondManager': 'OVM_BondManager' | ||
} | ||
|
||
const contracts = dirtree( | ||
path.resolve(__dirname, `../deployments/custom`) | ||
).children.filter((child) => { | ||
return child.extension === '.json' | ||
}).reduce((contracts, child) => { | ||
const contractName = child.name.replace('.json', '') | ||
const artifact = require(path.resolve(__dirname, `../deployments/custom/${child.name}`)) | ||
contracts[nicknames[contractName] || contractName] = artifact.address | ||
return contracts | ||
}, {}) | ||
|
||
const addresses = JSON.stringify(contracts, null, 2) | ||
const dumpsPath = path.resolve(__dirname, "../dist/dumps") | ||
if (!fs.existsSync(dumpsPath)) { | ||
fs.mkdirSync(dumpsPath) | ||
} | ||
const addrsPath = path.resolve(dumpsPath, 'addresses.json') | ||
fs.writeFileSync(addrsPath, addresses) | ||
} | ||
|
||
main() | ||
.then(() => process.exit(0)) | ||
.catch((error) => { | ||
console.log( | ||
JSON.stringify({ error: error.message, stack: error.stack }, null, 2) | ||
) | ||
process.exit(1) | ||
}) |
51 changes: 51 additions & 0 deletions
51
packages/contracts/deploy/000-Lib_AddressManager.deploy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { registerAddress } from '../src/hardhat-deploy-ethers' | ||
import { predeploys } from '../src/predeploys' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const { deploy } = hre.deployments | ||
const { deployer } = await hre.getNamedAccounts() | ||
|
||
await deploy('Lib_AddressManager', { | ||
from: deployer, | ||
args: [], | ||
log: true, | ||
}) | ||
|
||
await registerAddress({ | ||
hre, | ||
name: 'OVM_L2CrossDomainMessenger', | ||
address: predeploys.OVM_L2CrossDomainMessenger, | ||
}) | ||
|
||
await registerAddress({ | ||
hre, | ||
name: 'OVM_DecompressionPrecompileAddress', | ||
address: predeploys.OVM_SequencerEntrypoint, | ||
}) | ||
|
||
await registerAddress({ | ||
hre, | ||
name: 'OVM_Sequencer', | ||
address: (hre as any).deployConfig.ovmSequencerAddress, | ||
}) | ||
|
||
await registerAddress({ | ||
hre, | ||
name: 'OVM_Proposer', | ||
address: (hre as any).deployConfig.ovmProposerAddress, | ||
}) | ||
|
||
await registerAddress({ | ||
hre, | ||
name: 'OVM_L2BatchMessageRelayer', | ||
address: (hre as any).deployConfig.ovmRelayerAddress, | ||
}) | ||
} | ||
|
||
deployFn.tags = ['Lib_AddressManager', 'required'] | ||
|
||
export default deployFn |
27 changes: 27 additions & 0 deletions
27
packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndRegister, | ||
getDeployedContract, | ||
} from '../src/hardhat-deploy-ethers' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getDeployedContract( | ||
hre, | ||
'Lib_AddressManager' | ||
) | ||
|
||
await deployAndRegister({ | ||
hre, | ||
name: 'OVM_ChainStorageContainer:CTC:batches', | ||
contract: 'OVM_ChainStorageContainer', | ||
args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], | ||
}) | ||
} | ||
|
||
deployFn.dependencies = ['Lib_AddressManager'] | ||
deployFn.tags = ['OVM_ChainStorageContainer_ctc_batches'] | ||
|
||
export default deployFn |
27 changes: 27 additions & 0 deletions
27
packages/contracts/deploy/002-OVM_ChainStorageContainer_ctc_queue.deploy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* Imports: External */ | ||
import { DeployFunction } from 'hardhat-deploy/dist/types' | ||
|
||
/* Imports: Internal */ | ||
import { | ||
deployAndRegister, | ||
getDeployedContract, | ||
} from '../src/hardhat-deploy-ethers' | ||
|
||
const deployFn: DeployFunction = async (hre) => { | ||
const Lib_AddressManager = await getDeployedContract( | ||
hre, | ||
'Lib_AddressManager' | ||
) | ||
|
||
await deployAndRegister({ | ||
hre, | ||
name: 'OVM_ChainStorageContainer:CTC:queue', | ||
contract: 'OVM_ChainStorageContainer', | ||
args: [Lib_AddressManager.address, 'OVM_CanonicalTransactionChain'], | ||
}) | ||
} | ||
|
||
deployFn.dependencies = ['Lib_AddressManager'] | ||
deployFn.tags = ['OVM_ChainStorageContainer_ctc_queue'] | ||
|
||
export default deployFn |
Oops, something went wrong.