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
bd907f6c
Unverified
Commit
bd907f6c
authored
Dec 19, 2022
by
mergify[bot]
Committed by
GitHub
Dec 19, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4520 from ethereum-optimism/feat/p2p-sequencer-addr
feat: p2p sequencer addr
parents
48f3f508
2273c323
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
168 additions
and
57 deletions
+168
-57
systemconfig.go
op-bindings/bindings/systemconfig.go
+68
-16
systemconfig_more.go
op-bindings/bindings/systemconfig_more.go
+2
-2
layer_one.go
op-chain-ops/genesis/layer_one.go
+11
-4
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+5
-4
.storage-layout
packages/contracts-bedrock/.storage-layout
+23
-21
SystemConfig.sol
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
+27
-7
SystemDictator.sol
...contracts-bedrock/contracts/deployment/SystemDictator.sol
+3
-1
SystemConfig.t.sol
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
+22
-2
017-SystemConfigImpl.ts
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
+6
-0
019-SystemDictatorInit.ts
packages/contracts-bedrock/deploy/019-SystemDictatorInit.ts
+1
-0
No files found.
op-bindings/bindings/systemconfig.go
View file @
bd907f6c
This diff is collapsed.
Click to expand it.
op-bindings/bindings/systemconfig_more.go
View file @
bd907f6c
This diff is collapsed.
Click to expand it.
op-chain-ops/genesis/layer_one.go
View file @
bd907f6c
...
...
@@ -82,9 +82,10 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
uint642Big
(
config
.
GasPriceOracleScalar
),
config
.
BatchSenderAddress
.
Hash
(),
gasLimit
,
config
.
P2PSequencerAddress
,
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot abi encode initialize for SystemConfig: %w"
,
err
)
}
if
_
,
err
:=
upgradeProxy
(
backend
,
...
...
@@ -106,7 +107,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
uint642Big
(
uint64
(
config
.
L1GenesisBlockTimestamp
)),
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot abi encode initialize for L2OutputOracle: %w"
,
err
)
}
if
_
,
err
:=
upgradeProxy
(
backend
,
...
...
@@ -124,7 +125,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
}
data
,
err
=
portalABI
.
Pack
(
"initialize"
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot abi encode initialize for OptimismPortal: %w"
,
err
)
}
if
_
,
err
:=
upgradeProxy
(
backend
,
...
...
@@ -144,7 +145,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {
config
.
FinalSystemOwner
,
)
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"cannot abi encode initialize for L1CrossDomainMessenger: %w"
,
err
)
}
if
_
,
err
:=
upgradeProxy
(
backend
,
...
...
@@ -268,6 +269,7 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend)
uint642Big
(
config
.
GasPriceOracleScalar
),
config
.
BatchSenderAddress
.
Hash
(),
// left-padded 32 bytes value, version is zero anyway
gasLimit
,
config
.
P2PSequencerAddress
,
},
},
{
...
...
@@ -329,6 +331,7 @@ func l1Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
deployment
.
Args
[
2
]
.
(
*
big
.
Int
),
deployment
.
Args
[
3
]
.
(
common
.
Hash
),
deployment
.
Args
[
4
]
.
(
uint64
),
deployment
.
Args
[
5
]
.
(
common
.
Address
),
)
case
"L2OutputOracle"
:
_
,
tx
,
_
,
err
=
bindings
.
DeployL2OutputOracle
(
...
...
@@ -397,6 +400,10 @@ func l1Deployer(backend *backends.SimulatedBackend, opts *bind.TransactOpts, dep
}
}
if
err
!=
nil
{
err
=
fmt
.
Errorf
(
"cannot deploy %s: %w"
,
deployment
.
Name
,
err
)
}
return
tx
,
err
}
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
bd907f6c
...
...
@@ -379,7 +379,8 @@ SequencerFeeVault_Test:test_minWithdrawalAmount_succeeds() (gas: 5420)
SequencerFeeVault_Test:test_receive_succeeds() (gas: 17336)
SequencerFeeVault_Test:test_withdraw_notEnough_reverts() (gas: 9309)
SequencerFeeVault_Test:test_withdraw_succeeds() (gas: 159816)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61707)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10501)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10576)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10592)
SystemConfig_Initialize_TestFail:test_initialize_lowGasLimit_reverts() (gas: 61952)
SystemConfig_Setters_TestFail:test_setBatcherHash_notOwner_reverts() (gas: 10523)
SystemConfig_Setters_TestFail:test_setGasConfig_notOwner_reverts() (gas: 10510)
SystemConfig_Setters_TestFail:test_setGasLimit_notOwner_reverts() (gas: 10614)
SystemConfig_Setters_TestFail:test_setUnsafeBlockSigner_notOwner_reverts() (gas: 10638)
packages/contracts-bedrock/.storage-layout
View file @
bd907f6c
...
...
@@ -104,27 +104,29 @@
➡ contracts/L1/SystemConfig.sol:SystemConfig
=======================
+---------------+-------------+------+--------+-------+--------------------------------------------+
| Name | Type | Slot | Offset | Bytes | Contract |
+==================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| _initializing | bool | 0 | 1 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[50] | 1 | 0 | 1600 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| _owner | address | 51 | 0 | 20 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[49] | 52 | 0 | 1568 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| overhead | uint256 | 101 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| scalar | uint256 | 102 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| batcherHash | bytes32 | 103 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|---------------+-------------+------+--------+-------+--------------------------------------------|
| gasLimit | uint64 | 104 | 0 | 8 | contracts/L1/SystemConfig.sol:SystemConfig |
+---------------+-------------+------+--------+-------+--------------------------------------------+
+-------------------+-------------+------+--------+-------+--------------------------------------------+
| Name | Type | Slot | Offset | Bytes | Contract |
+======================================================================================================+
| _initialized | uint8 | 0 | 0 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| _initializing | bool | 0 | 1 | 1 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[50] | 1 | 0 | 1600 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| _owner | address | 51 | 0 | 20 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| __gap | uint256[49] | 52 | 0 | 1568 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| overhead | uint256 | 101 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| scalar | uint256 | 102 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| unsafeBlockSigner | address | 103 | 0 | 20 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| batcherHash | bytes32 | 104 | 0 | 32 | contracts/L1/SystemConfig.sol:SystemConfig |
|-------------------+-------------+------+--------+-------+--------------------------------------------|
| gasLimit | uint64 | 105 | 0 | 8 | contracts/L1/SystemConfig.sol:SystemConfig |
+-------------------+-------------+------+--------+-------+--------------------------------------------+
=======================
➡ contracts/legacy/DeployerWhitelist.sol:DeployerWhitelist
...
...
packages/contracts-bedrock/contracts/L1/SystemConfig.sol
View file @
bd907f6c
...
...
@@ -16,14 +16,17 @@ contract SystemConfig is OwnableUpgradeable, Semver {
/**
* @notice Enum representing different types of updates.
*
* @custom:value BATCHER Represents an update to the batcher hash.
* @custom:value GAS_CONFIG Represents an update to txn fee config on L2.
* @custom:value GAS_LIMIT Represents an update to gas limit on L2.
* @custom:value BATCHER Represents an update to the batcher hash.
* @custom:value GAS_CONFIG Represents an update to txn fee config on L2.
* @custom:value GAS_LIMIT Represents an update to gas limit on L2.
* @custom:value UNSAFE_BLOCK_SIGNER Represents an update to the signer key for unsafe
* block distrubution.
*/
enum UpdateType {
BATCHER,
GAS_CONFIG,
GAS_LIMIT
GAS_LIMIT,
UNSAFE_BLOCK_SIGNER
}
/**
...
...
@@ -48,6 +51,13 @@ contract SystemConfig is OwnableUpgradeable, Semver {
*/
uint256 public scalar;
/**
* @notice Address corresponding to the key that can propagate unsafe blocks
* across the p2p network. This value should not be tightly packed
* into a storage slot with another value to make state proofs more simple.
*/
address public unsafeBlockSigner;
/**
* @notice Identifier for the batcher. For version 1 of this configuration, this is represented
* as an address left-padded with zeros to 32 bytes.
...
...
@@ -82,9 +92,10 @@ contract SystemConfig is OwnableUpgradeable, Semver {
uint256 _overhead,
uint256 _scalar,
bytes32 _batcherHash,
uint64 _gasLimit
uint64 _gasLimit,
address _unsafeBlockSigner
) Semver(1, 0, 0) {
initialize(_owner, _overhead, _scalar, _batcherHash, _gasLimit);
initialize(_owner, _overhead, _scalar, _batcherHash, _gasLimit
, _unsafeBlockSigner
);
}
/**
...
...
@@ -101,7 +112,8 @@ contract SystemConfig is OwnableUpgradeable, Semver {
uint256 _overhead,
uint256 _scalar,
bytes32 _batcherHash,
uint64 _gasLimit
uint64 _gasLimit,
address _unsafeBlockSigner
) public initializer {
require(_gasLimit >= MINIMUM_GAS_LIMIT, "SystemConfig: gas limit too low");
__Ownable_init();
...
...
@@ -110,6 +122,7 @@ contract SystemConfig is OwnableUpgradeable, Semver {
scalar = _scalar;
batcherHash = _batcherHash;
gasLimit = _gasLimit;
unsafeBlockSigner = _unsafeBlockSigner;
}
/**
...
...
@@ -139,6 +152,13 @@ contract SystemConfig is OwnableUpgradeable, Semver {
emit ConfigUpdate(VERSION, UpdateType.GAS_CONFIG, data);
}
function setUnsafeBlockSigner(address _unsafeBlockSigner) external onlyOwner {
unsafeBlockSigner = _unsafeBlockSigner;
bytes memory data = abi.encode(_unsafeBlockSigner);
emit ConfigUpdate(VERSION, UpdateType.UNSAFE_BLOCK_SIGNER, data);
}
/**
* @notice Updates the L2 gas limit.
*
...
...
packages/contracts-bedrock/contracts/deployment/SystemDictator.sol
View file @
bd907f6c
...
...
@@ -78,6 +78,7 @@ contract SystemDictator is OwnableUpgradeable {
uint256 scalar;
bytes32 batcherHash;
uint64 gasLimit;
address unsafeBlockSigner;
}
/**
...
...
@@ -353,7 +354,8 @@ contract SystemDictator is OwnableUpgradeable {
config.systemConfigConfig.overhead,
config.systemConfigConfig.scalar,
config.systemConfigConfig.batcherHash,
config.systemConfigConfig.gasLimit
config.systemConfigConfig.gasLimit,
config.systemConfigConfig.unsafeBlockSigner
)
)
);
...
...
packages/contracts-bedrock/contracts/test/SystemConfig.t.sol
View file @
bd907f6c
...
...
@@ -13,7 +13,8 @@ contract SystemConfig_Init is CommonTest {
_overhead: 2100,
_scalar: 1000000,
_batcherHash: bytes32(hex"abcd"),
_gasLimit: 9_000_000
_gasLimit: 9_000_000,
_unsafeBlockSigner: address(1)
});
}
}
...
...
@@ -29,7 +30,8 @@ contract SystemConfig_Initialize_TestFail is CommonTest {
_overhead: 0,
_scalar: 0,
_batcherHash: bytes32(hex""),
_gasLimit: MINIMUM_GAS_LIMIT - 1
_gasLimit: MINIMUM_GAS_LIMIT - 1,
_unsafeBlockSigner: address(1)
});
}
}
...
...
@@ -49,6 +51,11 @@ contract SystemConfig_Setters_TestFail is SystemConfig_Init {
vm.expectRevert("Ownable: caller is not the owner");
sysConf.setGasLimit(0);
}
function test_setUnsafeBlockSigner_notOwner_reverts() external {
vm.expectRevert("Ownable: caller is not the owner");
sysConf.setUnsafeBlockSigner(address(0x20));
}
}
contract SystemConfig_Setters_Test is SystemConfig_Init {
...
...
@@ -94,4 +101,17 @@ contract SystemConfig_Setters_Test is SystemConfig_Init {
sysConf.setGasLimit(newGasLimit);
assertEq(sysConf.gasLimit(), newGasLimit);
}
function testFuzz_setUnsafeBlockSigner_succeeds(address newUnsafeSigner) external {
vm.expectEmit(true, true, true, true);
emit ConfigUpdate(
0,
SystemConfig.UpdateType.UNSAFE_BLOCK_SIGNER,
abi.encode(newUnsafeSigner)
);
vm.prank(sysConf.owner());
sysConf.setUnsafeBlockSigner(newUnsafeSigner);
assertEq(sysConf.unsafeBlockSigner(), newUnsafeSigner);
}
}
packages/contracts-bedrock/deploy/017-SystemConfigImpl.ts
View file @
bd907f6c
...
...
@@ -17,6 +17,7 @@ const deployFn: DeployFunction = async (hre) => {
hre
.
deployConfig
.
gasPriceOracleScalar
,
batcherHash
,
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
hre
.
deployConfig
.
p2pSequencerAddress
,
],
postDeployAction
:
async
(
contract
)
=>
{
await
assertContractVariable
(
...
...
@@ -35,6 +36,11 @@ const deployFn: DeployFunction = async (hre) => {
hre
.
deployConfig
.
gasPriceOracleScalar
)
await
assertContractVariable
(
contract
,
'
batcherHash
'
,
batcherHash
)
await
assertContractVariable
(
contract
,
'
unsafeBlockSigner
'
,
hre
.
deployConfig
.
p2pSequencerAddress
)
},
})
}
...
...
packages/contracts-bedrock/deploy/019-SystemDictatorInit.ts
View file @
bd907f6c
...
...
@@ -99,6 +99,7 @@ const deployFn: DeployFunction = async (hre) => {
32
),
gasLimit
:
hre
.
deployConfig
.
l2GenesisBlockGasLimit
,
unsafeBlockSigner
:
hre
.
deployConfig
.
p2pSequencerAddress
,
},
}
...
...
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