Skip to content

Commit

Permalink
Merge pull request #220 from kroma-network/dev
Browse files Browse the repository at this point in the history
Dev -> Main
  • Loading branch information
seolaoh authored Oct 24, 2023
2 parents 37092a3 + 81f5ed5 commit 503ae2e
Show file tree
Hide file tree
Showing 31 changed files with 5,353 additions and 486 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
2 changes: 1 addition & 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 Expand Up @@ -44,6 +43,7 @@
"governorVotesQuorumFractionPercent": 51,
"timeLockMinDelaySeconds": 2592000,
"l2GovernorVotingPeriodBlocks": 129600,
"l2TimeLockMinDelaySeconds": 604800,
"zkVerifierHashScalar": "0x163b85414bb5a9c97d8249f96b9c4ffd8db3e8081133101a14fc8546b704e2b",
"zkVerifierM56Px": "0x2aa452092865578d9b68a69f053df3db7a563b7cc7d17c9cce524632ccb30d85",
"zkVerifierM56Py": "0xafcccd2c2ebc8ffb530403bb07d4e1bcfc1aa910d4dd08d7cd81fcafef5e556"
Expand Down
2 changes: 1 addition & 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 Expand Up @@ -51,6 +50,7 @@
"governorVotesQuorumFractionPercent": 30,
"timeLockMinDelaySeconds": 300,
"l2GovernorVotingPeriodBlocks": 150,
"l2TimeLockMinDelaySeconds": 300,
"zkVerifierHashScalar": "0x8a18470eb27ae5b84622ad66cc5607a7ce6b876569d2fb9ce5aa32cdda5cfc6",
"zkVerifierM56Px": "0x1b43785e34e12914d2e6fea816de6821f802c1ecf0bbeacba23600352027fcfd",
"zkVerifierM56Py": "0xb8e6f17043e36148aa467bea5a21b670072446b89f9612c229af2709dc83a28"
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/deploy/L2/102-TimeLock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const deployFn: DeployFunction = async (hre) => {
isProxyImpl: true,
initializer: 'initialize(uint256,address[],address[],address)',
initArgs: [
deployConfig.timeLockMinDelaySeconds,
deployConfig.l2TimeLockMinDelaySeconds,
[upgradeGovernorProxyAddress],
[upgradeGovernorProxyAddress],
upgradeGovernorProxyAddress,
Expand All @@ -37,7 +37,7 @@ const deployFn: DeployFunction = async (hre) => {
// Check variable
assert(
(await timeLock.getMinDelay()).toNumber() ===
deployConfig.timeLockMinDelaySeconds
deployConfig.l2TimeLockMinDelaySeconds
)
}

Expand Down
Loading

0 comments on commit 503ae2e

Please sign in to comment.