Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

op-deployer: Fee Recipients and Gas Params added to intent #12404

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions op-chain-ops/deployer/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,15 @@ func Init(cfg InitConfig) error {
}

intent := &state.Intent{
L1ChainID: cfg.L1ChainID,
FundDevAccounts: true,
ContractsRelease: "op-contracts/v1.6.0",
ContractArtifactsURL: V160ArtifactsURL,
L1ChainID: cfg.L1ChainID,
FundDevAccounts: true,
ContractsRelease: "op-contracts/v1.6.0",
ContractArtifactsURL: V160ArtifactsURL,
BaseFeeVaultRecipient: common.Address{},
blmalone marked this conversation as resolved.
Show resolved Hide resolved
L1FeeVaultRecipient: common.Address{},
SequencerFeeVaultRecipient: common.Address{},
Eip1559Denominator: 50,
blmalone marked this conversation as resolved.
Show resolved Hide resolved
Eip1559Elasticity: 6,
mds1 marked this conversation as resolved.
Show resolved Hide resolved
}

l1ChainIDBig := intent.L1ChainIDBig()
Expand Down
33 changes: 30 additions & 3 deletions op-chain-ops/deployer/integration_test/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@ import (
"os"
"path"
"runtime"
"strings"
"testing"
"time"

"github.com/ethereum-optimism/optimism/op-service/testutils/anvil"
crypto "github.com/ethereum/go-ethereum/crypto"

"github.com/ethereum-optimism/optimism/op-chain-ops/deployer"
"github.com/holiman/uint256"

Expand All @@ -23,8 +21,11 @@ import (
"github.com/ethereum-optimism/optimism/op-chain-ops/devkeys"
opcrypto "github.com/ethereum-optimism/optimism/op-service/crypto"
"github.com/ethereum-optimism/optimism/op-service/testlog"
"github.com/ethereum-optimism/optimism/op-service/testutils/anvil"
"github.com/ethereum-optimism/optimism/op-service/testutils/kurtosisutil"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -219,6 +220,11 @@ func makeIntent(
},
},
},
BaseFeeVaultRecipient: addrFor(devkeys.BaseFeeVaultRecipientRole.Key(l1ChainID)),
L1FeeVaultRecipient: addrFor(devkeys.L1FeeVaultRecipientRole.Key(l1ChainID)),
SequencerFeeVaultRecipient: addrFor(devkeys.SequencerFeeVaultRecipientRole.Key(l1ChainID)),
Eip1559Denominator: 50,
Eip1559Elasticity: 6,
}
st := &state.State{
Version: 1,
Expand Down Expand Up @@ -261,10 +267,31 @@ func validateOPChainDeployment(t *testing.T, ctx context.Context, l1Client *ethc

t.Run("l2 genesis", func(t *testing.T) {
require.Greater(t, len(chainState.Allocs), 0)
l2Allocs, _ := chainState.UnmarshalAllocs()
alloc := l2Allocs.Copy().Accounts

checkImmutable(t, alloc, "BaseFeeVault", "0xC0d3c0D3c0d3C0D3C0D3C0d3c0D3C0D3c0d30019", st.AppliedIntent.BaseFeeVaultRecipient.Hex())
checkImmutable(t, alloc, "L1FeeVault", "0xc0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3c0d3001a", st.AppliedIntent.L1FeeVaultRecipient.Hex())
checkImmutable(t, alloc, "SequencerFeeVault", "0xC0D3C0d3c0d3c0d3C0D3c0d3C0D3c0d3c0D30011", st.AppliedIntent.SequencerFeeVaultRecipient.Hex())

require.Equal(t, int(st.AppliedIntent.Eip1559Denominator), 50, "EIP1559Denominator should be set")
require.Equal(t, int(st.AppliedIntent.Eip1559Elasticity), 6, "EIP1559Elasticity should be set")
})
}
}

func checkImmutable(t *testing.T, accounts types.GenesisAlloc, vaultName, vaultAddress, recipientHex string) {
account, ok := accounts[common.HexToAddress(vaultAddress)]
require.True(t, ok, "%s at %s not found in allocations", vaultName, vaultAddress)
require.NotEmpty(t, account.Code, "%s Impl should have code", vaultName)
require.Contains(
blmalone marked this conversation as resolved.
Show resolved Hide resolved
t,
strings.ToLower(common.Bytes2Hex(account.Code)),
strings.ToLower(strings.TrimPrefix(recipientHex, "0x")),
"%s Impl should contain %s immutable", vaultName, vaultName+"Recipient",
)
}

func TestApplyExistingOPCM(t *testing.T) {
anvil.Test(t)

Expand Down
11 changes: 7 additions & 4 deletions op-chain-ops/deployer/state/deploy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var (
vaultMinWithdrawalAmount = mustHexBigFromHex("0x8ac7230489e80000")
)

func DefaultDeployConfig() genesis.DeployConfig {
func DefaultDeployConfig(intent *Intent) genesis.DeployConfig {
return genesis.DeployConfig{
L2InitializationConfig: genesis.L2InitializationConfig{
L2GenesisBlockDeployConfig: genesis.L2GenesisBlockDeployConfig{
Expand All @@ -32,6 +32,9 @@ func DefaultDeployConfig() genesis.DeployConfig {
SequencerFeeVaultMinimumWithdrawalAmount: vaultMinWithdrawalAmount,
BaseFeeVaultMinimumWithdrawalAmount: vaultMinWithdrawalAmount,
L1FeeVaultMinimumWithdrawalAmount: vaultMinWithdrawalAmount,
BaseFeeVaultRecipient: intent.BaseFeeVaultRecipient,
L1FeeVaultRecipient: intent.L1FeeVaultRecipient,
SequencerFeeVaultRecipient: intent.SequencerFeeVaultRecipient,
},
GovernanceDeployConfig: genesis.GovernanceDeployConfig{
EnableGovernance: true,
Expand All @@ -43,9 +46,9 @@ func DefaultDeployConfig() genesis.DeployConfig {
GasPriceOracleBlobBaseFeeScalar: 810949,
},
EIP1559DeployConfig: genesis.EIP1559DeployConfig{
EIP1559Denominator: 50,
EIP1559Denominator: intent.Eip1559Denominator,
EIP1559DenominatorCanyon: 250,
EIP1559Elasticity: 6,
EIP1559Elasticity: intent.Eip1559Elasticity,
},
UpgradeScheduleDeployConfig: genesis.UpgradeScheduleDeployConfig{
L2GenesisRegolithTimeOffset: u64UtilPtr(0),
Expand Down Expand Up @@ -76,7 +79,7 @@ func DefaultDeployConfig() genesis.DeployConfig {
}

func CombineDeployConfig(intent *Intent, chainIntent *ChainIntent, state *State, chainState *ChainState) (genesis.DeployConfig, error) {
cfg := DefaultDeployConfig()
cfg := DefaultDeployConfig(intent)

var err error
if len(intent.GlobalDeployOverrides) > 0 {
Expand Down
10 changes: 10 additions & 0 deletions op-chain-ops/deployer/state/intent.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ type Intent struct {
Chains []*ChainIntent `json:"chains" toml:"chains"`

GlobalDeployOverrides map[string]any `json:"globalDeployOverrides" toml:"globalDeployOverrides"`

BaseFeeVaultRecipient common.Address `json:"baseFeeVaultRecipient" toml:"baseFeeVaultRecipient"`

L1FeeVaultRecipient common.Address `json:"l1FeeVaultRecipient" toml:"l1FeeVaultRecipient"`

SequencerFeeVaultRecipient common.Address `json:"sequencerFeeVaultRecipient" toml:"sequencerFeeVaultRecipient"`

Eip1559Denominator uint64 `json:"eip1559Denominator" toml:"eip1559Denominator"`

Eip1559Elasticity uint64 `json:"eip1559Elasticity" toml:"eip1559Elasticity"`
mds1 marked this conversation as resolved.
Show resolved Hide resolved
}

func (c *Intent) L1ChainIDBig() *big.Int {
Expand Down