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
627e0103
Unverified
Commit
627e0103
authored
Dec 21, 2022
by
mergify[bot]
Committed by
GitHub
Dec 21, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4543 from ethereum-optimism/feat/output-tx-calldata
ctb: Live migration utilities
parents
e3a33cdc
f912122e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
148 additions
and
0 deletions
+148
-0
020-SystemDictatorSteps.ts
packages/contracts-bedrock/deploy/020-SystemDictatorSteps.ts
+36
-0
deploy-utils.ts
packages/contracts-bedrock/src/deploy-utils.ts
+13
-0
index.ts
packages/contracts-bedrock/tasks/index.ts
+1
-0
update-dynamic-oracle-config.ts
...s/contracts-bedrock/tasks/update-dynamic-oracle-config.ts
+98
-0
No files found.
packages/contracts-bedrock/deploy/020-SystemDictatorSteps.ts
View file @
627e0103
...
...
@@ -11,6 +11,7 @@ import {
assertContractVariable
,
getContractsFromArtifacts
,
getDeploymentAddress
,
jsonifyTransaction
,
}
from
'
../src/deploy-utils
'
const
deployFn
:
DeployFunction
=
async
(
hre
)
=>
{
...
...
@@ -123,8 +124,14 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Setting AddressManager owner to MSD`
)
await
AddressManager
.
transferOwnership
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
AddressManager
.
populateTransaction
.
transferOwnership
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer AddressManager owner to MSD`
)
console
.
log
(
`AddressManager address:
${
AddressManager
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
// Wait for the ownership transfer to complete.
...
...
@@ -151,8 +158,15 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Setting L1CrossDomainMessenger owner to MSD`
)
await
L1CrossDomainMessenger
.
transferOwnership
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
L1CrossDomainMessenger
.
populateTransaction
.
transferOwnership
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer L1CrossDomainMessenger owner to MSD`
)
console
.
log
(
`L1XDM address:
${
L1CrossDomainMessenger
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
// Wait for the ownership transfer to complete.
...
...
@@ -179,8 +193,16 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Setting L1StandardBridge owner to MSD`
)
await
L1StandardBridgeProxyWithSigner
.
setOwner
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
L1StandardBridgeProxy
.
populateTransaction
.
setOwner
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer L1StandardBridge (proxy) owner to MSD`
)
console
.
log
(
`L1StandardBridgeProxy address:
${
L1StandardBridgeProxy
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
// Wait for the ownership transfer to complete.
...
...
@@ -209,8 +231,14 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Setting L1ERC721Bridge owner to MSD`
)
await
L1ERC721BridgeProxyWithSigner
.
changeAdmin
(
SystemDictator
.
address
)
}
else
{
const
tx
=
await
L1ERC721BridgeProxy
.
populateTransaction
.
changeAdmin
(
SystemDictator
.
address
)
console
.
log
(
`Please transfer L1ERC721Bridge (proxy) owner to MSD`
)
console
.
log
(
`L1ERC721BridgeProxy address:
${
L1ERC721BridgeProxy
.
address
}
`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
// Wait for the ownership transfer to complete.
...
...
@@ -264,7 +292,11 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Executing step
${
opts
.
step
}
...`
)
await
SystemDictator
[
`step
${
opts
.
step
}
`
]()
}
else
{
const
tx
=
await
SystemDictator
.
populateTransaction
[
`step
${
opts
.
step
}
`
]()
console
.
log
(
`Please execute step
${
opts
.
step
}
...`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
// Wait for the step to complete.
...
...
@@ -566,7 +598,11 @@ const deployFn: DeployFunction = async (hre) => {
console
.
log
(
`Finalizing deployment...`
)
await
SystemDictator
.
finalize
()
}
else
{
const
tx
=
await
SystemDictator
.
populateTransaction
.
finalize
()
console
.
log
(
`Please finalize deployment...`
)
console
.
log
(
`MSD address:
${
SystemDictator
.
address
}
`
)
console
.
log
(
`JSON:`
)
console
.
log
(
jsonifyTransaction
(
tx
))
}
await
awaitCondition
(
...
...
packages/contracts-bedrock/src/deploy-utils.ts
View file @
627e0103
...
...
@@ -276,3 +276,16 @@ export const getDeploymentAddress = async (
const
deployment
=
await
hre
.
deployments
.
get
(
name
)
return
deployment
.
address
}
export
const
jsonifyTransaction
=
(
tx
:
ethers
.
PopulatedTransaction
):
string
=>
{
return
JSON
.
stringify
(
{
to
:
tx
.
to
,
data
:
tx
.
data
,
value
:
tx
.
value
,
chainId
:
tx
.
chainId
,
},
null
,
2
)
}
packages/contracts-bedrock/tasks/index.ts
View file @
627e0103
...
...
@@ -7,3 +7,4 @@ import './validate-spacers'
import
'
./solidity
'
import
'
./accounts
'
import
'
./check-l2
'
import
'
./update-dynamic-oracle-config
'
packages/contracts-bedrock/tasks/update-dynamic-oracle-config.ts
0 → 100644
View file @
627e0103
import
readline
from
'
readline
'
import
{
task
,
types
}
from
'
hardhat/config
'
import
{
ethers
,
Wallet
}
from
'
ethers
'
import
{
getContractsFromArtifacts
}
from
'
../src/deploy-utils
'
task
(
'
update-dynamic-oracle-config
'
,
'
Updates the dynamic oracle config.
'
)
.
addParam
(
'
l2OutputOracleStartingTimestamp
'
,
'
Starting timestamp for the L2 output oracle.
'
,
null
,
types
.
int
)
.
addParam
(
'
noSend
'
,
'
Do not send the transaction.
'
,
true
,
types
.
boolean
)
.
addOptionalParam
(
'
privateKey
'
,
'
Private key to send transaction
'
,
process
.
env
.
PRIVATE_KEY
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
)
=>
{
const
{
l2OutputOracleStartingTimestamp
,
noSend
,
privateKey
}
=
args
const
wallet
=
new
Wallet
(
privateKey
,
hre
.
ethers
.
provider
)
const
[
SystemDictator
]
=
await
getContractsFromArtifacts
(
hre
,
[
{
name
:
'
SystemDictatorProxy
'
,
iface
:
'
SystemDictator
'
,
signerOrProvider
:
wallet
,
},
])
const
currStep
=
await
SystemDictator
.
currentStep
()
if
(
currStep
!==
5
)
{
throw
new
Error
(
`Current step is
${
currStep
}
, expected 5`
)
}
if
(
await
SystemDictator
.
dynamicConfigSet
())
{
throw
new
Error
(
'
Dynamic config already set
'
)
}
const
l2OutputOracleStartingBlockNumber
=
hre
.
deployConfig
.
l2OutputOracleStartingBlockNumber
console
.
log
(
`This task will set the L2 output oracle's starting timestamp and block number.`
)
console
.
log
(
`It can only be run once. Please carefully check the values below:`
)
console
.
log
(
`L2OO starting block number:
${
l2OutputOracleStartingBlockNumber
}
`
)
console
.
log
(
`L2OO starting block timestamp:
${
l2OutputOracleStartingTimestamp
}
`
)
await
prompt
(
'
Press enter to continue...
'
)
if
(
noSend
)
{
const
tx
=
await
SystemDictator
.
populateTransaction
.
updateL2OutputOracleDynamicConfig
(
{
l2OutputOracleStartingBlockNumber
,
l2OutputOracleStartingTimestamp
,
}
)
console
.
log
(
`Sending is disabled. Transaction data:`
)
// Need to delete tx.from for Ethers to properly serialize the tx
delete
tx
.
from
console
.
log
(
ethers
.
utils
.
serializeTransaction
(
tx
))
console
.
log
(
`Calldata (for multisigs):`
)
console
.
log
(
tx
.
data
)
}
else
{
console
.
log
(
`Sending transaction...`
)
const
tx
=
await
SystemDictator
.
updateL2OutputOracleDynamicConfig
({
l2OutputOracleStartingBlockNumber
,
l2OutputOracleStartingTimestamp
,
})
console
.
log
(
`Transaction sent with hash
${
tx
.
hash
}
. Waiting for receipt...`
)
const
receipt
=
await
tx
.
wait
(
1
)
console
.
log
(
`Transaction included in block
${
receipt
.
blockNumber
}
`
)
}
})
const
prompt
=
async
(
question
:
string
)
=>
{
const
rl
=
readline
.
createInterface
({
input
:
process
.
stdin
,
output
:
process
.
stdout
,
})
return
new
Promise
<
void
>
((
resolve
)
=>
{
rl
.
question
(
question
,
()
=>
{
rl
.
close
()
resolve
()
})
})
}
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