Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
483ed20a
Unverified
Commit
483ed20a
authored
Oct 26, 2021
by
kf
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(contracts): various cleanup tasks in deploy process
parent
2d2aed15
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
87 additions
and
76 deletions
+87
-76
AddressDictator.sol
...tracts/contracts/libraries/deployment/AddressDictator.sol
+1
-0
001-OVM_ChainStorageContainer_ctc_batches.deploy.ts
...eploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts
+1
-1
002-OVM_ChainStorageContainer_scc_batches.deploy.ts
...eploy/002-OVM_ChainStorageContainer_scc_batches.deploy.ts
+1
-1
003-OVM_CanonicalTransactionChain.deploy.ts
...tracts/deploy/003-OVM_CanonicalTransactionChain.deploy.ts
+1
-1
004-OVM_StateCommitmentChain.deploy.ts
...s/contracts/deploy/004-OVM_StateCommitmentChain.deploy.ts
+1
-1
005-OVM_BondManager.deploy.ts
packages/contracts/deploy/005-OVM_BondManager.deploy.ts
+1
-1
006-OVM_L1CrossDomainMessenger.deploy.ts
...contracts/deploy/006-OVM_L1CrossDomainMessenger.deploy.ts
+1
-1
007-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
...ts/deploy/007-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
+0
-3
009-OVM_L1StandardBridge.deploy.ts
packages/contracts/deploy/009-OVM_L1StandardBridge.deploy.ts
+1
-1
010-AddressDictator.deploy.ts
packages/contracts/deploy/010-AddressDictator.deploy.ts
+8
-3
011-set-addresses.ts
packages/contracts/deploy/011-set-addresses.ts
+59
-56
012-initialize-Proxy__L1CrossDomainMessenger.ts
...ts/deploy/012-initialize-Proxy__L1CrossDomainMessenger.ts
+12
-7
No files found.
packages/contracts/contracts/libraries/deployment/AddressDictator.sol
View file @
483ed20a
...
@@ -5,6 +5,7 @@ import { Lib_AddressManager } from "../resolver/Lib_AddressManager.sol";
...
@@ -5,6 +5,7 @@ import { Lib_AddressManager } from "../resolver/Lib_AddressManager.sol";
/**
/**
* @title AddressDictator
* @title AddressDictator
* @dev (glory to Arstotzka)
*/
*/
contract AddressDictator {
contract AddressDictator {
/*********
/*********
...
...
packages/contracts/deploy/001-OVM_ChainStorageContainer_ctc_batches.deploy.ts
View file @
483ed20a
...
@@ -21,6 +21,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -21,6 +21,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
ChainStorageContainer_ctc_batches
'
]
deployFn
.
tags
=
[
'
ChainStorageContainer_ctc_batches
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/002-OVM_ChainStorageContainer_scc_batches.deploy.ts
View file @
483ed20a
...
@@ -21,6 +21,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -21,6 +21,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
ChainStorageContainer_scc_batches
'
]
deployFn
.
tags
=
[
'
ChainStorageContainer_scc_batches
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/003-OVM_CanonicalTransactionChain.deploy.ts
View file @
483ed20a
...
@@ -25,6 +25,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -25,6 +25,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
CanonicalTransactionChain
'
]
deployFn
.
tags
=
[
'
CanonicalTransactionChain
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/004-OVM_StateCommitmentChain.deploy.ts
View file @
483ed20a
...
@@ -24,6 +24,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -24,6 +24,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
StateCommitmentChain
'
]
deployFn
.
tags
=
[
'
StateCommitmentChain
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/005-OVM_BondManager.deploy.ts
View file @
483ed20a
...
@@ -20,6 +20,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -20,6 +20,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
BondManager
'
]
deployFn
.
tags
=
[
'
BondManager
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/006-OVM_L1CrossDomainMessenger.deploy.ts
View file @
483ed20a
...
@@ -39,6 +39,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -39,6 +39,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
L1CrossDomainMessenger
'
]
deployFn
.
tags
=
[
'
L1CrossDomainMessenger
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/007-Proxy__OVM_L1CrossDomainMessenger.deploy.ts
View file @
483ed20a
...
@@ -15,9 +15,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -15,9 +15,6 @@ const deployFn: DeployFunction = async (hre) => {
'
Lib_AddressManager
'
'
Lib_AddressManager
'
)
)
// todo: this fails when trying to do a fresh deploy, because Lib_ResolvedDelegateProxy
// requires that the implementation has already been set in the Address Manager.
// The revert message is: 'Target address must be initialized'
await
deployAndPostDeploy
({
await
deployAndPostDeploy
({
hre
,
hre
,
name
:
'
Proxy__OVM_L1CrossDomainMessenger
'
,
name
:
'
Proxy__OVM_L1CrossDomainMessenger
'
,
...
...
packages/contracts/deploy/009-OVM_L1StandardBridge.deploy.ts
View file @
483ed20a
...
@@ -135,6 +135,6 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -135,6 +135,6 @@ const deployFn: DeployFunction = async (hre) => {
})
})
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
L1StandardBridg
e
'
]
deployFn
.
tags
=
[
'
L1StandardBridge
'
,
'
upgrad
e
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/010-Address
Sette
r.deploy.ts
→
packages/contracts/deploy/010-Address
Dictato
r.deploy.ts
View file @
483ed20a
...
@@ -64,9 +64,14 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -64,9 +64,14 @@ const deployFn: DeployFunction = async (hre) => {
// Filter out all addresses that will not change, so that the log statement is maximally
// Filter out all addresses that will not change, so that the log statement is maximally
// verifiable and readable.
// verifiable and readable.
namesAndAddresses
=
namesAndAddresses
.
filter
(
async
({
name
,
address
})
=>
{
const
existingAddresses
=
{}
const
existingAddress
=
await
Lib_AddressManager
.
getAddress
(
name
)
for
(
const
pair
of
namesAndAddresses
)
{
return
!
hexStringEquals
(
existingAddress
,
address
)
existingAddresses
[
pair
.
name
]
=
await
Lib_AddressManager
.
getAddress
(
pair
.
name
)
}
namesAndAddresses
=
namesAndAddresses
.
filter
(({
name
,
address
})
=>
{
return
!
hexStringEquals
(
existingAddresses
[
name
],
address
)
})
})
await
deployAndPostDeploy
({
await
deployAndPostDeploy
({
...
...
packages/contracts/deploy/011-set-addresses.ts
View file @
483ed20a
...
@@ -11,65 +11,75 @@ import {
...
@@ -11,65 +11,75 @@ import {
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
addressDictator
=
await
getContractFromArtifact
(
// We use this task to print out the list of addresses that will be updated by the
// AddressDictator contract. The idea here is that the owner of the AddressManager will then
// review these names and addresses before transferring ownership to the AddressDictator.
// Once ownership has been transferred to the AddressDictator, we execute `setAddresses` which
// triggers a series of setAddress calls on the AddressManager and then transfers ownership back
// to the original owner.
// First get relevant contract references.
const
AddressDictator
=
await
getContractFromArtifact
(
hre
,
hre
,
'
AddressDictator
'
,
'
AddressDictator
'
,
{
{
signerOrProvider
:
deployer
,
signerOrProvider
:
deployer
,
}
}
)
)
const
lib
AddressManager
=
await
getContractFromArtifact
(
const
Lib_
AddressManager
=
await
getContractFromArtifact
(
hre
,
hre
,
'
Lib_AddressManager
'
'
Lib_AddressManager
'
)
)
const
namedAddresses
=
await
addressDictator
.
getNamedAddresses
()
const
namedAddresses
:
Array
<
{
name
:
string
;
addr
:
string
}
>
=
const
finalOwner
=
await
addressDictator
.
finalOwner
()
await
AddressDictator
.
getNamedAddresses
()
let
currentOwner
=
await
libAddressManager
.
owner
()
const
finalOwner
=
await
AddressDictator
.
finalOwner
()
const
currentOwner
=
await
Lib_AddressManager
.
owner
()
console
.
log
(
'
\n
'
,
'
An Address Dictator contract has been deployed, with the following name/address pairs:
'
)
for
(
const
namedAddress
of
namedAddresses
)
{
// Set alignment for readability
const
padding
=
'
'
.
repeat
(
40
-
namedAddress
.
name
.
length
)
console
.
log
(
`
${
namedAddress
.
name
}${
padding
}
${
namedAddress
.
addr
}
`
)
}
console
.
log
(
'
\n
'
,
'
Please verify the values above, and the deployment steps up to this point,
'
)
console
.
log
(
` then transfer ownership of the Address Manager at (
${
libAddressManager
.
address
}
)`
)
console
.
log
(
` to the Address Dictator contract at
${
addressDictator
.
address
}
.`
)
// Check if the hardhat runtime environment has the owner of the AddressManager. This will only
// happen in CI. If this is the case, we can skip directly to transferring ownership over to the
// AddressDictator contract.
const
hreSigners
=
await
hre
.
ethers
.
getSigners
()
const
hreSigners
=
await
hre
.
ethers
.
getSigners
()
const
hre
SignerAddresses
=
hreSigners
.
map
((
signer
)
=>
{
const
hre
HasOwner
=
hreSigners
.
some
((
signer
)
=>
{
return
signer
.
address
return
hexStringEquals
(
signer
.
address
,
currentOwner
)
})
})
if
(
hreSignerAddresses
.
some
((
addr
)
=>
{
if
(
hreHasOwner
)
{
return
hexStringEquals
(
addr
,
currentOwner
)
// Hardhat has the owner loaded into it, we can skip directly to transferOwnership.
})
)
{
console
.
log
(
'
Deploy script owns the address manager, this must be CI. Setting addresses...
'
)
const
owner
=
await
hre
.
ethers
.
getSigner
(
currentOwner
)
const
owner
=
await
hre
.
ethers
.
getSigner
(
currentOwner
)
await
libAddressManager
await
Lib_AddressManager
.
connect
(
owner
).
transferOwnership
(
.
connect
(
owner
)
AddressDictator
.
address
.
transferOwnership
(
addressDictator
.
address
)
)
}
else
{
console
.
log
(
`
The AddressDictator contract (glory to Arstotzka) has been deployed.
Name/Address pairs:
${
namedAddresses
.
map
((
namedAddress
)
=>
{
const
padding
=
'
'
.
repeat
(
40
-
namedAddress
.
name
.
length
)
return
`
${
namedAddress
.
name
}${
padding
}
${
namedAddress
.
addr
}
`
})}
Current AddressManager owner:
${
currentOwner
}
Final AddressManager owner:
${
finalOwner
}
Please verify the values above, and the deployment steps up to this point,
then transfer ownership of the AddressManager at
${
Lib_AddressManager
.
address
}
to the AddressDictator contract at
${
AddressDictator
.
address
}
.
`
)
}
}
// Wait for ownership to be transferred to the AddressDictator contract.
await
waitUntilTrue
(
await
waitUntilTrue
(
async
()
=>
{
async
()
=>
{
console
.
log
(
'
Checking ownership of Lib_AddressManager...
'
)
return
hexStringEquals
(
currentOwner
=
await
libAddressManager
.
owner
()
await
Lib_AddressManager
.
owner
(),
console
.
log
(
'
Lib_AddressManager owner is now set to AddressDictator.
'
)
AddressDictator
.
address
return
hexStringEquals
(
currentOwner
,
addressDictator
.
address
)
)
},
},
{
{
// Try every 30 seconds for 500 minutes.
// Try every 30 seconds for 500 minutes.
...
@@ -80,22 +90,15 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -80,22 +90,15 @@ const deployFn: DeployFunction = async (hre) => {
// Set the addresses!
// Set the addresses!
console
.
log
(
'
Ownership successfully transferred. Invoking setAddresses...
'
)
console
.
log
(
'
Ownership successfully transferred. Invoking setAddresses...
'
)
await
a
ddressDictator
.
setAddresses
()
await
A
ddressDictator
.
setAddresses
()
await
waitUntilTrue
(
// Make sure ownership has been correctly sent back to the original owner.
async
()
=>
{
console
.
log
(
'
Verifying final ownership of Lib_AddressManager...
'
)
console
.
log
(
'
Verifying final ownership of Lib_AddressManager
'
)
await
waitUntilTrue
(
async
()
=>
{
currentOwner
=
await
libAddressManager
.
owner
()
return
hexStringEquals
(
await
Lib_AddressManager
.
owner
(),
finalOwner
)
return
hexStringEquals
(
currentOwner
,
finalOwner
)
})
},
{
// Try every 10 seconds
delay
:
10
_000
,
retries
:
1000
,
}
)
}
}
deployFn
.
tags
=
[
'
upgrade
'
,
'
set-addresses
'
]
deployFn
.
tags
=
[
'
set-addresses
'
,
'
upgrade
'
]
export
default
deployFn
export
default
deployFn
packages/contracts/deploy/012-initialize-Proxy__L1CrossDomainMessenger.ts
View file @
483ed20a
...
@@ -11,10 +11,13 @@ import {
...
@@ -11,10 +11,13 @@ import {
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
const
{
deployer
}
=
await
hre
.
getNamedAccounts
()
// There is a risk that on a fresh deployment we could get front-run,
// and the Proxy would be bricked. But that feels unlikely, and we can recover from it.
console
.
log
(
`Initializing Proxy__L1CrossDomainMessenger...`
)
console
.
log
(
`Initializing Proxy__L1CrossDomainMessenger...`
)
const
proxy
=
await
getContractFromArtifact
(
// There's a risk that we could get front-run during a fresh deployment, which would brick this
// contract and require that the proxy be re-deployed. We will not have this risk once we move
// entirely to chugsplash-style deployments. It's unlikely to happen and relatively easy to
// recover from so let's just ignore it for now.
const
Proxy__OVM_L1CrossDomainMessenger
=
await
getContractFromArtifact
(
hre
,
hre
,
'
Proxy__OVM_L1CrossDomainMessenger
'
,
'
Proxy__OVM_L1CrossDomainMessenger
'
,
{
{
...
@@ -22,17 +25,19 @@ const deployFn: DeployFunction = async (hre) => {
...
@@ -22,17 +25,19 @@ const deployFn: DeployFunction = async (hre) => {
signerOrProvider
:
deployer
,
signerOrProvider
:
deployer
,
}
}
)
)
const
libAddressManager
=
await
getContractFromArtifact
(
const
Lib_AddressManager
=
await
getContractFromArtifact
(
hre
,
hre
,
'
Lib_AddressManager
'
'
Lib_AddressManager
'
)
)
await
proxy
.
initialize
(
libAddressManager
.
address
)
await
Proxy__OVM_L1CrossDomainMessenger
.
initialize
(
Lib_AddressManager
.
address
)
console
.
log
(
`Checking that contract was correctly initialized...`
)
console
.
log
(
`Checking that contract was correctly initialized...`
)
await
waitUntilTrue
(
async
()
=>
{
await
waitUntilTrue
(
async
()
=>
{
return
hexStringEquals
(
return
hexStringEquals
(
await
proxy
.
libAddressManager
(),
await
Proxy__OVM_L1CrossDomainMessenger
.
libAddressManager
(),
lib
AddressManager
.
address
Lib_
AddressManager
.
address
)
)
})
})
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment