-
Notifications
You must be signed in to change notification settings - Fork 3.9k
op-deployer: add intent-config-type #12970
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
bd8f6db
op-deployer: add config-intent-type
bitwiseguy 8c3b177
op-deployer: revert name change of GasLimit
bitwiseguy af222da
op-deployer: add Intent.setStandardValues and Intent.validateStandard…
bitwiseguy c3ad694
op-deployer: improve standard intent-config err messages
bitwiseguy 38bc334
op-deployr: chain intent custom err types
bitwiseguy 552a5a9
op-deployer: add unit test for inent.validateStandardValues
bitwiseguy b5be8cc
linter fix
bitwiseguy 3961576
add intent-config-type custom
bitwiseguy 394810e
add intent-config-type strict
bitwiseguy 745e17c
add intent-config-type standard-overrides,strict-overrides
bitwiseguy c023a1e
refactor intent.ConfigType validation methods, add intent NewIntent* …
bitwiseguy aaa8d60
add TestValidateCustomValues, refactor contract tag check
bitwiseguy 3af7850
remove duplicate chainIntent.Check() code
bitwiseguy 55376b2
fix SuperchainRoles.ProxyAdminOwner for standard chains
bitwiseguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| package state | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "reflect" | ||
|
|
||
| "github.com/ethereum-optimism/optimism/op-chain-ops/genesis" | ||
| "github.com/ethereum/go-ethereum/common" | ||
| ) | ||
|
|
||
| type ChainIntent struct { | ||
| ID common.Hash `json:"id" toml:"id"` | ||
| BaseFeeVaultRecipient common.Address `json:"baseFeeVaultRecipient" toml:"baseFeeVaultRecipient"` | ||
| L1FeeVaultRecipient common.Address `json:"l1FeeVaultRecipient" toml:"l1FeeVaultRecipient"` | ||
| SequencerFeeVaultRecipient common.Address `json:"sequencerFeeVaultRecipient" toml:"sequencerFeeVaultRecipient"` | ||
| Eip1559DenominatorCanyon uint64 `json:"eip1559DenominatorCanyon" toml:"eip1559DenominatorCanyon"` | ||
| Eip1559Denominator uint64 `json:"eip1559Denominator" toml:"eip1559Denominator"` | ||
| Eip1559Elasticity uint64 `json:"eip1559Elasticity" toml:"eip1559Elasticity"` | ||
| Roles ChainRoles `json:"roles" toml:"roles"` | ||
| DeployOverrides map[string]any `json:"deployOverrides" toml:"deployOverrides"` | ||
| DangerousAltDAConfig genesis.AltDADeployConfig `json:"dangerousAltDAConfig,omitempty" toml:"dangerousAltDAConfig,omitempty"` | ||
| } | ||
|
|
||
| type ChainRoles struct { | ||
| L1ProxyAdminOwner common.Address `json:"l1ProxyAdminOwner" toml:"l1ProxyAdminOwner"` | ||
| L2ProxyAdminOwner common.Address `json:"l2ProxyAdminOwner" toml:"l2ProxyAdminOwner"` | ||
| SystemConfigOwner common.Address `json:"systemConfigOwner" toml:"systemConfigOwner"` | ||
| UnsafeBlockSigner common.Address `json:"unsafeBlockSigner" toml:"unsafeBlockSigner"` | ||
| Batcher common.Address `json:"batcher" toml:"batcher"` | ||
| Proposer common.Address `json:"proposer" toml:"proposer"` | ||
| Challenger common.Address `json:"challenger" toml:"challenger"` | ||
| } | ||
|
|
||
| var ErrChainRoleZeroAddress = fmt.Errorf("ChainRole is set to zero address") | ||
| var ErrFeeVaultZeroAddress = fmt.Errorf("chain has a fee vault set to zero address") | ||
| var ErrNonStandardValue = fmt.Errorf("chain contains non-standard config value") | ||
| var ErrEip1559ZeroValue = fmt.Errorf("eip1559 param is set to zero value") | ||
|
|
||
| func (c *ChainIntent) Check() error { | ||
| if c.ID == emptyHash { | ||
| return fmt.Errorf("id must be set") | ||
| } | ||
|
|
||
| if err := c.Roles.CheckNoZeroAddresses(); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| if c.Eip1559DenominatorCanyon == 0 || | ||
| c.Eip1559Denominator == 0 || | ||
| c.Eip1559Elasticity == 0 { | ||
| return fmt.Errorf("%w: chainId=%s", ErrEip1559ZeroValue, c.ID) | ||
| } | ||
| if c.BaseFeeVaultRecipient == emptyAddress || | ||
| c.L1FeeVaultRecipient == emptyAddress || | ||
| c.SequencerFeeVaultRecipient == emptyAddress { | ||
| return fmt.Errorf("%w: chainId=%s", ErrFeeVaultZeroAddress, c.ID) | ||
| } | ||
|
|
||
| if c.DangerousAltDAConfig.UseAltDA { | ||
| return c.DangerousAltDAConfig.Check(nil) | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| // Returns an error if any fields in ChainRoles is set to common.Address{} | ||
| func (cr *ChainRoles) CheckNoZeroAddresses() error { | ||
| val := reflect.ValueOf(*cr) | ||
| typ := reflect.TypeOf(*cr) | ||
|
|
||
| // Iterate through all the fields | ||
| for i := 0; i < val.NumField(); i++ { | ||
| fieldValue := val.Field(i) | ||
| fieldName := typ.Field(i).Name | ||
|
|
||
| if fieldValue.Interface() == (common.Address{}) { | ||
| return fmt.Errorf("%w: %s", ErrChainRoleZeroAddress, fieldName) | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.