Skip to content

Commit

Permalink
Merge pull request #211 from kroma-network/chore/replace-securitycoun…
Browse files Browse the repository at this point in the history
…ciltokenowner-config

chore: remove `securityCouncilTokenOwner` from deploy config
  • Loading branch information
seolaoh authored Oct 23, 2023
2 parents 1c574eb + 4623d9e commit 81f5ed5
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 50 deletions.
24 changes: 12 additions & 12 deletions e2e/actions/system_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ func TestBatcherKeyRotation(gt *testing.T) {
sysCfgContract, err := bindings.NewSystemConfig(sd.RollupCfg.L1SystemConfigAddress, miner.EthClient())
require.NoError(t, err)

sysCfgOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.SysCfgOwner, sd.RollupCfg.L1ChainID)
proxyAdminOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.ProxyAdminOwner, sd.RollupCfg.L1ChainID)
require.NoError(t, err)

// Change the batch sender key to Bob!
tx, err := sysCfgContract.SetBatcherHash(sysCfgOwner, dp.Addresses.Bob.Hash())
tx, err := sysCfgContract.SetBatcherHash(proxyAdminOwner, dp.Addresses.Bob.Hash())
require.NoError(t, err)
t.Logf("batcher changes in L1 tx %s", tx.Hash())
miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(dp.Addresses.SysCfgOwner)(t)
miner.ActL1IncludeTx(dp.Addresses.ProxyAdminOwner)(t)
miner.ActL1EndBlock(t)
cfgChangeL1BlockNum := miner.l1Chain.CurrentBlock().Number.Uint64()

Expand Down Expand Up @@ -225,18 +225,18 @@ func TestGPOParamsChange(gt *testing.T) {
sysCfgContract, err := bindings.NewSystemConfig(sd.RollupCfg.L1SystemConfigAddress, miner.EthClient())
require.NoError(t, err)

sysCfgOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.SysCfgOwner, sd.RollupCfg.L1ChainID)
proxyAdminOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.ProxyAdminOwner, sd.RollupCfg.L1ChainID)
require.NoError(t, err)

// overhead changes from 2100 (default) to 1000
// scalar changes from 1_000_000 (default) to 2_300_000
// e.g. if system operator determines that l2 txs need to be more expensive, but small ones less
_, err = sysCfgContract.SetGasConfig(sysCfgOwner, big.NewInt(1000), big.NewInt(2_300_000))
_, err = sysCfgContract.SetGasConfig(proxyAdminOwner, big.NewInt(1000), big.NewInt(2_300_000))
require.NoError(t, err)

// include the GPO change tx in L1
miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(dp.Addresses.SysCfgOwner)(t)
miner.ActL1IncludeTx(dp.Addresses.ProxyAdminOwner)(t)
miner.ActL1EndBlock(t)
basefeeGPOUpdate := miner.l1Chain.CurrentBlock().BaseFee

Expand Down Expand Up @@ -320,15 +320,15 @@ func TestGasLimitChange(gt *testing.T) {
sysCfgContract, err := bindings.NewSystemConfig(sd.RollupCfg.L1SystemConfigAddress, miner.EthClient())
require.NoError(t, err)

sysCfgOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.SysCfgOwner, sd.RollupCfg.L1ChainID)
proxyAdminOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.ProxyAdminOwner, sd.RollupCfg.L1ChainID)
require.NoError(t, err)

_, err = sysCfgContract.SetGasLimit(sysCfgOwner, oldGasLimit*3)
_, err = sysCfgContract.SetGasLimit(proxyAdminOwner, oldGasLimit*3)
require.NoError(t, err)

// include the gaslimit update on L1
miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(dp.Addresses.SysCfgOwner)(t)
miner.ActL1IncludeTx(dp.Addresses.ProxyAdminOwner)(t)
miner.ActL1EndBlock(t)

// build to latest L1, excluding the block that adopts the L1 block with the gaslimit change
Expand Down Expand Up @@ -379,7 +379,7 @@ func TestValidatorRewardScalarChange(gt *testing.T) {
sysCfgContract, err := bindings.NewSystemConfig(sd.RollupCfg.L1SystemConfigAddress, miner.EthClient())
require.NoError(t, err)

sysCfgOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.SysCfgOwner, sd.RollupCfg.L1ChainID)
proxyAdminOwner, err := bind.NewKeyedTransactorWithChainID(dp.Secrets.ProxyAdminOwner, sd.RollupCfg.L1ChainID)
require.NoError(t, err)

// if the validator reward scalar is not set on SystemConfig contract, the contract must have a value of 0.
Expand All @@ -397,12 +397,12 @@ func TestValidatorRewardScalarChange(gt *testing.T) {

// change validator reward scalar to 5000
newScalar := big.NewInt(int64(5000))
_, err = sysCfgContract.SetValidatorRewardScalar(sysCfgOwner, newScalar)
_, err = sysCfgContract.SetValidatorRewardScalar(proxyAdminOwner, newScalar)
require.NoError(t, err)

// include the validator reward scalar update on L1
miner.ActL1StartBlock(12)(t)
miner.ActL1IncludeTx(dp.Addresses.SysCfgOwner)(t)
miner.ActL1IncludeTx(dp.Addresses.ProxyAdminOwner)(t)
miner.ActL1EndBlock(t)

// build to latest L1, excluding the block that adopts the L1 block with the validator reward scalar change
Expand Down
28 changes: 14 additions & 14 deletions e2e/e2eutils/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ var DefaultMnemonicConfig = &MnemonicConfig{
Alice: "m/44'/60'/0'/0/8",
Bob: "m/44'/60'/0'/0/9",
Mallory: "m/44'/60'/0'/0/10",
SysCfgOwner: "m/44'/60'/0'/0/11",
ProxyAdminOwner: "m/44'/60'/0'/0/11",
}

// MnemonicConfig configures the private keys for the hive testnet.
// It's json-serializable, so we can ship it to e.g. the hardhat script client.
type MnemonicConfig struct {
Mnemonic string

Deployer string
CliqueSigner string
SysCfgOwner string
Deployer string
CliqueSigner string
ProxyAdminOwner string

// rollup actors
TrustedValidator string
Expand Down Expand Up @@ -70,7 +70,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {
if err != nil {
return nil, err
}
sysCfgOwner, err := wallet.PrivateKey(account(m.SysCfgOwner))
proxyAdminOwner, err := wallet.PrivateKey(account(m.ProxyAdminOwner))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -110,7 +110,7 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {
return &Secrets{
Deployer: deployer,
CliqueSigner: cliqueSigner,
SysCfgOwner: sysCfgOwner,
ProxyAdminOwner: proxyAdminOwner,
TrustedValidator: trustedValidator,
Challenger1: challenger1,
Challenger2: challenger2,
Expand All @@ -125,9 +125,9 @@ func (m *MnemonicConfig) Secrets() (*Secrets, error) {

// Secrets bundles secp256k1 private keys for all common rollup actors for testing purposes.
type Secrets struct {
Deployer *ecdsa.PrivateKey
CliqueSigner *ecdsa.PrivateKey
SysCfgOwner *ecdsa.PrivateKey
Deployer *ecdsa.PrivateKey
CliqueSigner *ecdsa.PrivateKey
ProxyAdminOwner *ecdsa.PrivateKey

// rollup actors
TrustedValidator *ecdsa.PrivateKey
Expand Down Expand Up @@ -159,7 +159,7 @@ func (s *Secrets) Addresses() *Addresses {
return &Addresses{
Deployer: crypto.PubkeyToAddress(s.Deployer.PublicKey),
CliqueSigner: crypto.PubkeyToAddress(s.CliqueSigner.PublicKey),
SysCfgOwner: crypto.PubkeyToAddress(s.SysCfgOwner.PublicKey),
ProxyAdminOwner: crypto.PubkeyToAddress(s.ProxyAdminOwner.PublicKey),
TrustedValidator: crypto.PubkeyToAddress(s.TrustedValidator.PublicKey),
Challenger1: crypto.PubkeyToAddress(s.Challenger1.PublicKey),
Challenger2: crypto.PubkeyToAddress(s.Challenger2.PublicKey),
Expand All @@ -173,9 +173,9 @@ func (s *Secrets) Addresses() *Addresses {

// Addresses bundles the addresses for all common rollup addresses for testing purposes.
type Addresses struct {
Deployer common.Address
CliqueSigner common.Address
SysCfgOwner common.Address
Deployer common.Address
CliqueSigner common.Address
ProxyAdminOwner common.Address

// rollup actors
TrustedValidator common.Address
Expand All @@ -194,7 +194,7 @@ func (a *Addresses) All() []common.Address {
return []common.Address{
a.Deployer,
a.CliqueSigner,
a.SysCfgOwner,
a.ProxyAdminOwner,
a.TrustedValidator,
a.Challenger1,
a.Challenger2,
Expand Down
2 changes: 1 addition & 1 deletion e2e/e2eutils/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func MakeDeployParams(t require.TestingT, tp *TestParams) *DeployParams {
DeploymentWaitConfirmations: 1,
ValidatorRewardScalar: 5000,

SecurityCouncilTokenOwner: addresses.SysCfgOwner,
ProxyAdminOwner: addresses.ProxyAdminOwner,
ProtocolVaultRecipient: common.Address{19: 2},
ProposerRewardVaultRecipient: common.Address{19: 3},

Expand Down
2 changes: 1 addition & 1 deletion e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func DefaultSystemConfig(t *testing.T) SystemConfig {
GasPriceOracleScalar: 1_000_000,
ValidatorRewardScalar: 5000,

SecurityCouncilTokenOwner: addresses.SysCfgOwner,
ProxyAdminOwner: addresses.ProxyAdminOwner,
ProtocolVaultRecipient: common.Address{19: 2},
ProposerRewardVaultRecipient: common.Address{19: 3},

Expand Down
2 changes: 1 addition & 1 deletion e2e/system_tob_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestGasPriceOracleFeeUpdates(t *testing.T) {
l1Client := sys.Clients["l1"]
l2Prop := sys.Clients["proposer"]
// l2Sync := sys.Clients["syncer"]
ethPrivKey := cfg.Secrets.SysCfgOwner
ethPrivKey := cfg.Secrets.ProxyAdminOwner

// Bind to the SystemConfig & GasPriceOracle contracts
sysconfig, err := bindings.NewSystemConfig(predeploys.DevSystemConfigAddr, l1Client)
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/deploy-config/devnetL1.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"protocolVaultRecipient": "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
"proposerRewardVaultRecipient": "0x71bE63f3384f5fb98995898A86B02Fb2426c5788",
"proxyAdminOwner": "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
"securityCouncilTokenOwner": "0xBcd4042DE499D14e55001CcbB24a551F3b954096",
"controller": "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
"finalizationPeriodSeconds": 600,
"deploymentWaitConfirmations": 1,
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/deploy-config/mainnet.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"proxyAdminOwner": "0xA03c13C6597a0716D1525b7fDaD2fD95ECb49081",
"securityCouncilTokenOwner": "0xA03c13C6597a0716D1525b7fDaD2fD95ECb49081",
"l1StartingBlockTag": "0xe459c500b760ed52a1ad799bf578b257af2c76f6ebe061a4c62627e9c605bced",
"l1ChainID": 1,
"l2ChainID": 255,
Expand Down
1 change: 0 additions & 1 deletion packages/contracts/deploy-config/sepolia.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"proxyAdminOwner": "0x80e695eceb5bea3b1788c4dfb40b72afc59f60d8",
"securityCouncilTokenOwner": "0x80e695eceb5bea3b1788c4dfb40b72afc59f60d8",
"l1StartingBlockTag": "0x936e490e33e6e136ecd9095090e30ed7def3903ef2bae3e05966b376e493ad76",
"l1ChainID": 11155111,
"l2ChainID": 2358,
Expand Down
8 changes: 0 additions & 8 deletions packages/contracts/src/deploy-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ interface RequiredDeployConfig {
*/
proxyAdminOwner: string

/**
* Owner of the Security Council token.
*/
securityCouncilTokenOwner: string

/**
* L1 recipient of fees accumulated in the ProtocolVault.
*/
Expand Down Expand Up @@ -332,9 +327,6 @@ export const deployConfigSpec: {
proxyAdminOwner: {
type: 'address',
},
securityCouncilTokenOwner: {
type: 'address',
},
protocolVaultRecipient: {
type: 'address',
},
Expand Down
7 changes: 1 addition & 6 deletions utils/chain-ops/genesis/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,8 @@ type DeployConfig struct {
ZKVerifierM56Px *hexutil.Big `json:"zkVerifierM56Px"`
ZKVerifierM56Py *hexutil.Big `json:"zkVerifierM56Py"`

// Owner of the ProxyAdmin predeploy
// Owner of the ProxyAdmin predeploy, but in test it means super admin of the system
ProxyAdminOwner common.Address `json:"proxyAdminOwner"`
// Owner of the Guardian Token
SecurityCouncilTokenOwner common.Address `json:"securityCouncilTokenOwner"`
// L1 recipient of fees accumulated in the ProtocolVault
ProtocolVaultRecipient common.Address `json:"protocolVaultRecipient"`
// L1 recipient of fees accumulated in the ProposerRewardVault
Expand Down Expand Up @@ -195,9 +193,6 @@ func (d *DeployConfig) Check() error {
if d.ProxyAdminOwner == (common.Address{}) {
return fmt.Errorf("%w: ProxyAdminOwner cannot be address(0)", ErrInvalidDeployConfig)
}
if d.SecurityCouncilTokenOwner == (common.Address{}) {
return fmt.Errorf("%w: SecurityCouncilTokenOwner cannot be address(0)", ErrInvalidDeployConfig)
}
if d.ProtocolVaultRecipient == (common.Address{}) {
return fmt.Errorf("%w: ProtocolVaultRecipient cannot be address(0)", ErrInvalidDeployConfig)
}
Expand Down
4 changes: 2 additions & 2 deletions utils/chain-ops/genesis/layer_one.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ func BuildL1DeveloperGenesis(config *DeployConfig) (*core.Genesis, error) {

data, err = sysCfgABI.Pack(
"initialize",
config.SecurityCouncilTokenOwner,
config.ProxyAdminOwner,
uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(),
Expand Down Expand Up @@ -453,7 +453,7 @@ func deployL1Contracts(config *DeployConfig, backend *backends.SimulatedBackend)
{
Name: "SystemConfig",
Args: []interface{}{
config.SecurityCouncilTokenOwner,
config.ProxyAdminOwner,
uint642Big(config.GasPriceOracleOverhead),
uint642Big(config.GasPriceOracleScalar),
config.BatchSenderAddress.Hash(), // left-padded 32 bytes value, version is zero anyway
Expand Down
2 changes: 1 addition & 1 deletion utils/chain-ops/genesis/layer_one_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func TestBuildL1DeveloperGenesis(t *testing.T) {
require.Equal(t, cfg, defaultResourceConfig)
owner, err := sysCfg.Owner(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, owner, config.SecurityCouncilTokenOwner)
require.Equal(t, owner, config.ProxyAdminOwner)
overhead, err := sysCfg.Overhead(&bind.CallOpts{})
require.NoError(t, err)
require.Equal(t, overhead.Uint64(), config.GasPriceOracleOverhead)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"cliqueSignerAddress": "0x0000000000000000000000000000000000000000",
"l1GenesisBlockGasLimit": "0x1c9c380",
"l1GenesisBlockDifficulty": "0x1",
"securityCouncilTokenOwner": "0x0000000000000000000000000000000000000111",
"finalizationPeriodSeconds": 600,
"l1GenesisBlockMixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"l1GenesisBlockCoinbase": "0x0000000000000000000000000000000000000000",
Expand Down

0 comments on commit 81f5ed5

Please sign in to comment.