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
53e4cae8
Unverified
Commit
53e4cae8
authored
Oct 05, 2021
by
Maurelian
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(contracts): hard code address manager owner as gas burn admin
parent
bc6756c5
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
43 additions
and
57 deletions
+43
-57
docker-compose-nobuild.yml
ops/docker-compose-nobuild.yml
+0
-2
docker-compose.yml
ops/docker-compose.yml
+0
-2
deploy.ts
packages/contracts/bin/deploy.ts
+1
-3
CanonicalTransactionChain.sol
...ntracts/contracts/L1/rollup/CanonicalTransactionChain.sol
+2
-2
000-Lib_AddressManager.deploy.ts
packages/contracts/deploy/000-Lib_AddressManager.deploy.ts
+0
-6
deploy.ts
packages/contracts/tasks/deploy.ts
+0
-6
CanonicalTransactionChain.spec.ts
...est/contracts/L1/rollup/CanonicalTransactionChain.spec.ts
+40
-36
No files found.
ops/docker-compose-nobuild.yml
View file @
53e4cae8
...
...
@@ -34,8 +34,6 @@ services:
# these keys are hardhat's first 2 accounts, DO NOT use in production
DEPLOYER_PRIVATE_KEY
:
"
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
SEQUENCER_PRIVATE_KEY
:
"
0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
# this address is hardhat's third accounts, DO NOT use in production
BURN_ADMIN_ADDRESS
:
"
0xD1D84F0e28D6fedF03c73151f98dF95139700aa7"
# skip compilation when run in docker-compose, since the contracts
# were already compiled in the builder step
NO_COMPILE
:
1
...
...
ops/docker-compose.yml
View file @
53e4cae8
...
...
@@ -34,8 +34,6 @@ services:
# these keys are hardhat's first 2 accounts, DO NOT use in production
DEPLOYER_PRIVATE_KEY
:
"
0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"
SEQUENCER_PRIVATE_KEY
:
"
0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"
# this address is hardhat's third accounts, DO NOT use in production.
BURN_ADMIN_ADDRESS
:
"
0xD1D84F0e28D6fedF03c73151f98dF95139700aa7"
GAS_PRICE_ORACLE_OWNER
:
"
0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"
# setting the whitelist owner to address(0) disables the whitelist
WHITELIST_OWNER
:
"
0x0000000000000000000000000000000000000000"
...
...
packages/contracts/bin/deploy.ts
View file @
53e4cae8
import
{
Wallet
,
utils
}
from
'
ethers
'
import
{
Wallet
}
from
'
ethers
'
import
path
from
'
path
'
import
dirtree
from
'
directory-tree
'
import
fs
from
'
fs
'
...
...
@@ -17,7 +17,6 @@ import hre from 'hardhat'
const
sequencer
=
new
Wallet
(
process
.
env
.
SEQUENCER_PRIVATE_KEY
)
const
deployer
=
new
Wallet
(
process
.
env
.
DEPLOYER_PRIVATE_KEY
)
const
burnAdminAddress
=
utils
.
getAddress
(
process
.
env
.
BURN_ADMIN_ADDRESS
)
const
parseEnv
=
()
=>
{
const
ensure
=
(
env
,
type
)
=>
{
...
...
@@ -55,7 +54,6 @@ const main = async () => {
sccSequencerPublishWindow
:
config
.
sccFraudProofWindow
,
ovmSequencerAddress
:
sequencer
.
address
,
ovmProposerAddress
:
sequencer
.
address
,
ovmBurnAdmin
:
burnAdminAddress
,
ovmAddressManagerOwner
:
deployer
.
address
,
noCompile
:
process
.
env
.
NO_COMPILE
?
true
:
false
,
})
...
...
packages/contracts/contracts/L1/rollup/CanonicalTransactionChain.sol
View file @
53e4cae8
...
...
@@ -87,12 +87,12 @@ contract CanonicalTransactionChain is ICanonicalTransactionChain, Lib_AddressRes
**********************/
/**
* Modifier to enforce that
only the OVM_BurnAdmin
contract may
* Modifier to enforce that
, if configured, only the OVM_Sequencer
contract may
* successfully call a method.
*/
modifier onlyBurnAdmin() {
require(
msg.sender ==
resolve("OVM_BurnAdmin"
),
msg.sender ==
libAddressManager.owner(
),
"Only callable by the Burn Admin."
);
_;
...
...
packages/contracts/deploy/000-Lib_AddressManager.deploy.ts
View file @
53e4cae8
...
...
@@ -39,12 +39,6 @@ const deployFn: DeployFunction = async (hre) => {
name
:
'
OVM_Proposer
'
,
address
:
(
hre
as
any
).
deployConfig
.
ovmProposerAddress
,
})
await
registerAddress
({
hre
,
name
:
'
OVM_BurnAdmin
'
,
address
:
(
hre
as
any
).
deployConfig
.
ovmBurnAdmin
,
})
}
deployFn
.
tags
=
[
'
Lib_AddressManager
'
]
...
...
packages/contracts/tasks/deploy.ts
View file @
53e4cae8
...
...
@@ -65,12 +65,6 @@ task('deploy')
undefined
,
types
.
string
)
.
addOptionalParam
(
'
ovmBurnAdmin
'
,
'
Address that can update gas burn parameters in the CTC. Must be provided or this deployment will fail.
'
,
undefined
,
types
.
string
)
.
setAction
(
async
(
args
,
hre
:
any
,
runSuper
)
=>
{
// Necessary because hardhat doesn't let us attach non-optional parameters to existing tasks.
const
validateAddressArg
=
(
argName
:
string
)
=>
{
...
...
packages/contracts/test/contracts/L1/rollup/CanonicalTransactionChain.spec.ts
View file @
53e4cae8
...
...
@@ -63,11 +63,11 @@ const appendSequencerBatch = async (
}
describe
(
'
CanonicalTransactionChain
'
,
()
=>
{
let
sig
ner
:
Signer
let
addressManagerOw
ner
:
Signer
let
sequencer
:
Signer
let
burnAdmin
:
Signer
let
otherSigner
:
Signer
before
(
async
()
=>
{
;[
signer
,
sequencer
,
burnAdmin
]
=
await
ethers
.
getSigners
()
;[
addressManagerOwner
,
sequencer
,
otherSigner
]
=
await
ethers
.
getSigners
()
})
let
AddressManager
:
Contract
...
...
@@ -79,11 +79,6 @@ describe('CanonicalTransactionChain', () => {
await
sequencer
.
getAddress
()
)
await
AddressManager
.
setAddress
(
'
OVM_BurnAdmin
'
,
await
burnAdmin
.
getAddress
()
)
Mock__StateCommitmentChain
=
await
smockit
(
await
ethers
.
getContractFactory
(
'
StateCommitmentChain
'
)
)
...
...
@@ -143,17 +138,17 @@ describe('CanonicalTransactionChain', () => {
describe
(
'
Gas param setters
'
,
()
=>
{
describe
(
'
setGasDivisor
'
,
async
()
=>
{
it
(
'
should revert when not called by the
Burn Admin
'
,
async
()
=>
{
it
(
'
should revert when not called by the
sequencer
'
,
async
()
=>
{
await
expect
(
CanonicalTransactionChain
.
connect
(
s
igner
).
setGasDivisor
(
32
)
CanonicalTransactionChain
.
connect
(
otherS
igner
).
setGasDivisor
(
32
)
).
to
.
be
.
revertedWith
(
'
Only callable by the Burn Admin.
'
)
})
it
(
'
should update the l2GasDiscountDivisor and enqueueL2GasPrepaid correctly
'
,
async
()
=>
{
const
newGasDivisor
=
19
await
CanonicalTransactionChain
.
connect
(
burnAdmin
).
setGasDivisor
(
newGasDiviso
r
)
await
CanonicalTransactionChain
.
connect
(
addressManagerOwne
r
)
.
setGasDivisor
(
newGasDivisor
)
const
enqueueGasCost
=
await
CanonicalTransactionChain
.
enqueueGasCost
()
const
enqueueL2GasPrepaid
=
...
...
@@ -163,23 +158,27 @@ describe('CanonicalTransactionChain', () => {
it
(
'
should emit an L2GasParamsUpdated event
'
,
async
()
=>
{
await
expect
(
CanonicalTransactionChain
.
connect
(
burnAdmin
).
setGasDivisor
(
88
)
CanonicalTransactionChain
.
connect
(
addressManagerOwner
).
setGasDivisor
(
88
)
).
to
.
emit
(
CanonicalTransactionChain
,
'
L2GasParamsUpdated
'
)
})
})
describe
(
'
setEnqueueGasCost
'
,
async
()
=>
{
it
(
'
should revert when not called by the
Burn Admin
'
,
async
()
=>
{
it
(
'
should revert when not called by the
sequencer
'
,
async
()
=>
{
await
expect
(
CanonicalTransactionChain
.
connect
(
signer
).
setEnqueueGasCost
(
60000
)
CanonicalTransactionChain
.
connect
(
otherSigner
).
setEnqueueGasCost
(
60000
)
).
to
.
be
.
revertedWith
(
'
Only callable by the Burn Admin.
'
)
})
it
(
'
should update the enqueueGasCost and enqueueL2GasPrepaid correctly
'
,
async
()
=>
{
const
newEnqueueGasCost
=
31113
await
CanonicalTransactionChain
.
connect
(
burnAdmin
).
setEnqueueGasCost
(
newEnqueueGasCost
)
await
CanonicalTransactionChain
.
connect
(
addressManagerOwner
)
.
setEnqueueGasCost
(
newEnqueueGasCost
)
const
l2GasDiscountDivisor
=
await
CanonicalTransactionChain
.
l2GasDiscountDivisor
()
...
...
@@ -192,7 +191,9 @@ describe('CanonicalTransactionChain', () => {
it
(
'
should emit an L2GasParamsUpdated event
'
,
async
()
=>
{
await
expect
(
CanonicalTransactionChain
.
connect
(
burnAdmin
).
setEnqueueGasCost
(
31514
)
CanonicalTransactionChain
.
connect
(
addressManagerOwner
).
setEnqueueGasCost
(
31514
)
).
to
.
emit
(
CanonicalTransactionChain
,
'
L2GasParamsUpdated
'
)
})
})
...
...
@@ -342,7 +343,7 @@ describe('CanonicalTransactionChain', () => {
await
setEthTime
(
ethers
.
provider
,
timestamp
)
const
transactionHash
=
getTransactionHash
(
await
sig
ner
.
getAddress
(),
await
addressManagerOw
ner
.
getAddress
(),
target
,
gasLimit
,
data
...
...
@@ -386,7 +387,7 @@ describe('CanonicalTransactionChain', () => {
await
setEthTime
(
ethers
.
provider
,
timestamp
)
transactionHash
=
getTransactionHash
(
await
sig
ner
.
getAddress
(),
await
addressManagerOw
ner
.
getAddress
(),
target
,
gasLimit
,
data
...
...
@@ -429,7 +430,7 @@ describe('CanonicalTransactionChain', () => {
await
setEthTime
(
ethers
.
provider
,
timestamp
)
transactionHash
=
getTransactionHash
(
await
sig
ner
.
getAddress
(),
await
addressManagerOw
ner
.
getAddress
(),
target
,
gasLimit
,
data
...
...
@@ -507,7 +508,9 @@ describe('CanonicalTransactionChain', () => {
it
(
'
should revert if not called by the sequencer
'
,
async
()
=>
{
await
expect
(
appendSequencerBatch
(
CanonicalTransactionChain
.
connect
(
signer
),
{
appendSequencerBatch
(
CanonicalTransactionChain
.
connect
(
addressManagerOwner
),
{
transactions
:
[
'
0x1234
'
],
contexts
:
[
{
...
...
@@ -519,7 +522,8 @@ describe('CanonicalTransactionChain', () => {
],
shouldStartAtElement
:
0
,
totalElementsToAppend
:
1
,
})
}
)
).
to
.
be
.
revertedWith
(
'
Function can only be called by the Sequencer.
'
)
})
...
...
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