-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
CCIP-3552 refactor OP oracle to accept generic DA oracle config #14599
CCIP-3552 refactor OP oracle to accept generic DA oracle config #14599
Conversation
4fc823a
to
f158de6
Compare
948d154
to
2c95e64
Compare
b298388
to
7968c5b
Compare
switch chainType { | ||
case chaintype.ChainOptimismBedrock, chaintype.ChainKroma, chaintype.ChainScroll, chaintype.ChainMantle, chaintype.ChainZircuit: | ||
l1Oracle, err = NewOpStackL1GasOracle(lggr, ethClient, chainType) | ||
case chaintype.ChainArbitrum: | ||
switch daOracle.OracleType() { | ||
case toml.OPOracle: | ||
l1Oracle, err = NewOpStackL1GasOracle(lggr, ethClient, chainType, daOracle) | ||
case toml.ArbitrumOracle: | ||
l1Oracle, err = NewArbitrumL1GasOracle(lggr, ethClient) | ||
case chaintype.ChainZkSync: | ||
case toml.ZKSyncOracle: | ||
l1Oracle = NewZkSyncL1GasOracle(lggr, ethClient) | ||
default: | ||
return nil, fmt.Errorf("received unsupported chaintype %s", chainType) | ||
return nil, fmt.Errorf("unsupported DA oracle type %s", daOracle.OracleType()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was made per @matYang 's suggestion here: #14599 (comment)
The one "gotcha" with this is that now we need to make sure the DAOracle
config is correctly set and non-nil for each of these chains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see how this simplifies this switch but I'm worried about introducing another config for this when ChainType
is already used to group behavior for different chains. Don't think this saves us from making changes either. If we introduce a new ChainType for a new chain, we have to make code changes like this for it anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the idea is that chaintype can deviate from oracle type, e.g if we have the heuristic oracle, many chain types may be able to share the same oracle type
WF: CI Core#8f50535No errors found in this run. 🎉 |
Think we'll also need to update the default tomls for chains that use the the OP oracle. Should be the ones with the ChainType's: |
7968c5b
to
3c74ccc
Compare
@@ -47,21 +49,21 @@ func IsRollupWithL1Support(chainType chaintype.ChainType) bool { | |||
return slices.Contains(supportedChainTypes, chainType) | |||
} | |||
|
|||
func NewL1GasOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType) (L1Oracle, error) { | |||
func NewL1GasOracle(lggr logger.Logger, ethClient l1OracleClient, chainType chaintype.ChainType, daOracle evmconfig.DAOracle) (L1Oracle, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as discussed, we can keep the hardcoded switch statement when daOracle does not exist for backwards-compatibility
3c74ccc
to
4c7d92b
Compare
e33bf1e
to
6ab6540
Compare
…ept-generic-op-l-2-config
Quality Gate passedIssues Measures |
func (d *TestDAOracleConfig) OracleAddress() *types.EIP55Address { | ||
a, err := types.NewEIP55Address("0x420000000000000000000000000000000000000F") | ||
if err != nil { | ||
panic(err) | ||
} | ||
return &a | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks eth specific but the capability generally tries to keep all the chain specific things separated. Might be worth discussing /w @asoliman92 at some point
This PR:
DAOracle
config to theGasEstimator
interface to be set by the chain TOMLSee the CCIP-3551 epic for more details