Skip to content

Commit

Permalink
op-chain-ops: update to new devkeys package
Browse files Browse the repository at this point in the history
  • Loading branch information
protolambda committed Aug 23, 2024
1 parent f304a4f commit 2d4f491
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 208 deletions.
4 changes: 4 additions & 0 deletions op-chain-ops/devkeys/devkeys.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ const (
SuperchainConfigGuardianKey SuperchainOperatorRole = 1
// DependencySetManagerKey is the key used to manage the dependency set of a superchain.
DependencySetManagerKey SuperchainOperatorRole = 2
// SuperchainProxyAdminOwner is the key that owns the superchain ProxyAdmin
SuperchainProxyAdminOwner SuperchainOperatorRole = 3
// SuperchainFinalSystemOwner is the key that ownership is transferred to after deployment.
SuperchainFinalSystemOwner SuperchainOperatorRole = 4
)

func (role SuperchainOperatorRole) String() string {
Expand Down
3 changes: 2 additions & 1 deletion op-chain-ops/genesis/withdrawal_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package genesis
import (
"encoding/json"
"fmt"
"github.com/holiman/uint256"
"strconv"

"github.com/holiman/uint256"
)

// WithdrawalNetwork represents the network that withdrawals are sent to.
Expand Down
3 changes: 1 addition & 2 deletions op-chain-ops/genz/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package genz
import (
"errors"
"fmt"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit"
"math/big"

"github.com/ethereum/go-ethereum/common"
Expand All @@ -13,6 +12,7 @@ import (

"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis/beacondeposit"
"github.com/ethereum-optimism/optimism/op-chain-ops/script"
)

Expand Down Expand Up @@ -318,7 +318,6 @@ func deployL2ToL1(l1Host *script.Host, superCfg *SuperchainConfig, superDeployme
L1CrossDomainMessengerProxy: deploymentRegistry.GetAddress("L1CrossDomainMessengerProxy"),
L1ERC721BridgeProxy: deploymentRegistry.GetAddress("L1ERC721BridgeProxy"),
L1StandardBridgeProxy: deploymentRegistry.GetAddress("L1StandardBridgeProxy"),
L2OutputOracleProxy: deploymentRegistry.GetAddress("L2OutputOracleProxy"),
OptimismMintableERC20FactoryProxy: deploymentRegistry.GetAddress("OptimismMintableERC20FactoryProxy"),
OptimismPortalProxy: deploymentRegistry.GetAddress("OptimismPortalProxy"),
SystemConfigProxy: deploymentRegistry.GetAddress("SystemConfigProxy"),
Expand Down
8 changes: 4 additions & 4 deletions op-chain-ops/genz/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ type SuperchainDeployment struct {
}

type L2Proxies struct {
L1CrossDomainMessengerProxy common.Address `json:"L1CrossDomainMessengerProxy"`
L1ERC721BridgeProxy common.Address `json:"L1ERC721BridgeProxy"`
L1StandardBridgeProxy common.Address `json:"L1StandardBridgeProxy"`
L2OutputOracleProxy common.Address `json:"L2OutputOracleProxy"`
L1CrossDomainMessengerProxy common.Address `json:"L1CrossDomainMessengerProxy"`
L1ERC721BridgeProxy common.Address `json:"L1ERC721BridgeProxy"`
L1StandardBridgeProxy common.Address `json:"L1StandardBridgeProxy"`
// L2OutputOracleProxy is no longer used or deployed
OptimismMintableERC20FactoryProxy common.Address `json:"OptimismMintableERC20FactoryProxy"`
OptimismPortalProxy common.Address `json:"OptimismPortalProxy"`
SystemConfigProxy common.Address `json:"SystemConfigProxy"`
Expand Down
112 changes: 0 additions & 112 deletions op-chain-ops/genz/devkeys/devkeys.go

This file was deleted.

68 changes: 0 additions & 68 deletions op-chain-ops/genz/devkeys/hd.go

This file was deleted.

39 changes: 19 additions & 20 deletions op-chain-ops/genz/recipe.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/params"

"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum-optimism/optimism/op-chain-ops/genesis"
"github.com/ethereum-optimism/optimism/op-chain-ops/genz/devkeys"
)

type InteropDevRecipe struct {
Expand All @@ -18,7 +18,7 @@ type InteropDevRecipe struct {
GenesisTimestamp uint64
}

func (r *InteropDevRecipe) Build(addrs devkeys.DevAddresses) (*WorldConfig, error) {
func (r *InteropDevRecipe) Build(addrs devkeys.Addresses) (*WorldConfig, error) {
// L1 genesis
l1Cfg := &L1Config{
ChainID: new(big.Int).SetUint64(r.L1ChainID),
Expand All @@ -28,21 +28,21 @@ func (r *InteropDevRecipe) Build(addrs devkeys.DevAddresses) (*WorldConfig, erro
L1GenesisBlockGasLimit: 30_000_000,
},
}
superchainAddrs := devkeys.Scope(addrs, devkeys.SuperchainKeyDomain, l1Cfg.ChainID)
superchainOps := devkeys.SuperchainOperatorKeys(l1Cfg.ChainID)

superchainDeployer, err := superchainAddrs(devkeys.DeployerRole)
superchainDeployer, err := addrs.Address(superchainOps(devkeys.SuperchainDeployerKey))
if err != nil {
return nil, err
}
finalSystemOwner, err := superchainAddrs(devkeys.FinalSystemOwnerRole)
finalSystemOwner, err := addrs.Address(superchainOps(devkeys.SuperchainFinalSystemOwner))
if err != nil {
return nil, err
}
superchainProxyAdmin, err := superchainAddrs(devkeys.ProxyAdminOwnerRole)
superchainProxyAdmin, err := addrs.Address(superchainOps(devkeys.SuperchainProxyAdminOwner))
if err != nil {
return nil, err
}
superchainConfigGuardian, err := superchainAddrs(devkeys.SuperchainConfigGuardianRole)
superchainConfigGuardian, err := addrs.Address(superchainOps(devkeys.SuperchainConfigGuardianKey))
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -71,40 +71,40 @@ func (r *InteropDevRecipe) Build(addrs devkeys.DevAddresses) (*WorldConfig, erro
return world, nil
}

func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.DevAddresses) (*L2Config, error) {
func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.Addresses) (*L2Config, error) {
// Padded chain ID, hex encoded, prefixed with 0xff like inboxes, then 0x02 to signify devnet.
batchInboxAddress := common.HexToAddress(fmt.Sprintf("0xff02%016x", l2ChainID))
operatorAddrs := devkeys.Scope(addrs, devkeys.L2OperatorKeyDomain, new(big.Int).SetUint64(l2ChainID))
chainOps := devkeys.ChainOperatorKeys(new(big.Int).SetUint64(l2ChainID))

deployer, err := operatorAddrs(devkeys.DeployerRole)
deployer, err := addrs.Address(chainOps(devkeys.DeployerRole))
if err != nil {
return nil, err
}
proxyAdminOwner, err := operatorAddrs(devkeys.ProxyAdminOwnerRole)
l1ProxyAdminOwner, err := addrs.Address(chainOps(devkeys.L1ProxyAdminOwnerRole))
if err != nil {
return nil, err
}
finalSystemOwner, err := operatorAddrs(devkeys.FinalSystemOwnerRole)
l2ProxyAdminOwner, err := addrs.Address(chainOps(devkeys.L2ProxyAdminOwnerRole))
if err != nil {
return nil, err
}
baseFeeVaultRecipient, err := operatorAddrs(devkeys.BaseFeeVaultRecipientRole)
baseFeeVaultRecipient, err := addrs.Address(chainOps(devkeys.BaseFeeVaultRecipientRole))
if err != nil {
return nil, err
}
l1FeeVaultRecipient, err := operatorAddrs(devkeys.L1FeeVaultRecipientRole)
l1FeeVaultRecipient, err := addrs.Address(chainOps(devkeys.L1FeeVaultRecipientRole))
if err != nil {
return nil, err
}
sequencerFeeVaultRecipient, err := operatorAddrs(devkeys.SequencerFeeVaultRecipientRole)
sequencerFeeVaultRecipient, err := addrs.Address(chainOps(devkeys.SequencerFeeVaultRecipientRole))
if err != nil {
return nil, err
}
sequencerP2P, err := operatorAddrs(devkeys.SequencerP2PRole)
sequencerP2P, err := addrs.Address(chainOps(devkeys.SequencerP2PRole))
if err != nil {
return nil, err
}
batcher, err := operatorAddrs(devkeys.BatcherRole)
batcher, err := addrs.Address(chainOps(devkeys.BatcherRole))
if err != nil {
return nil, err
}
Expand All @@ -120,8 +120,8 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.DevAddresses)
L2GenesisBlockBaseFeePerGas: (*hexutil.Big)(big.NewInt(params.InitialBaseFee)),
},
OwnershipDeployConfig: genesis.OwnershipDeployConfig{
ProxyAdminOwner: proxyAdminOwner,
FinalSystemOwner: finalSystemOwner,
ProxyAdminOwner: l2ProxyAdminOwner,
FinalSystemOwner: l1ProxyAdminOwner,
},
L2VaultsDeployConfig: genesis.L2VaultsDeployConfig{
BaseFeeVaultRecipient: baseFeeVaultRecipient,
Expand Down Expand Up @@ -172,7 +172,6 @@ func InteropL2DevConfig(l1ChainID, l2ChainID uint64, addrs devkeys.DevAddresses)
MaxSequencerDrift: 300,
SequencerWindowSize: 200,
ChannelTimeoutBedrock: 120,
ChannelTimeoutGranite: 50, // becoming a constant soon
BatchInboxAddress: batchInboxAddress,
SystemConfigStartBlock: 0,
},
Expand Down
2 changes: 1 addition & 1 deletion op-chain-ops/genz/recipe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (

"github.com/ethereum/go-ethereum/log"

"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
"github.com/ethereum-optimism/optimism/op-chain-ops/foundry"
"github.com/ethereum-optimism/optimism/op-chain-ops/genz/devkeys"
"github.com/ethereum-optimism/optimism/op-service/testlog"
)

Expand Down

0 comments on commit 2d4f491

Please sign in to comment.