Skip to content

Commit

Permalink
CCIP-4616 cs_ccip_home chain config validation (#16007)
Browse files Browse the repository at this point in the history
  • Loading branch information
bukata-sa authored Jan 21, 2025
1 parent 6a8b51d commit b51f131
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion deployment/ccip/changeset/cs_ccip_home.go
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ func (p SetCandidatePluginInfo) Validate(state CCIPOnChainState, homeChain uint6

chainConfig, err := state.Chains[homeChain].CCIPHome.GetChainConfig(nil, chainSelector)
if err != nil {
return fmt.Errorf("get all chain configs: %w", err)
return fmt.Errorf("can't get chain config for %d: %w", chainSelector, err)
}
// FChain should never be zero if a chain config is set in CCIPHome
if chainConfig.FChain == 0 {
Expand All @@ -476,6 +476,13 @@ func (p SetCandidatePluginInfo) Validate(state CCIPOnChainState, homeChain uint6
if len(chainConfig.Readers) == 0 {
return errors.New("readers must be set")
}
decodedChainConfig, err := chainconfig.DecodeChainConfig(chainConfig.Config)
if err != nil {
return fmt.Errorf("can't decode chain config: %w", err)
}
if err := decodedChainConfig.Validate(); err != nil {
return fmt.Errorf("invalid chain config: %w", err)
}
err = params.Validate(chainSelector, feedChain, state)
if err != nil {
return fmt.Errorf("invalid ccip ocr params: %w", err)
Expand Down Expand Up @@ -1247,6 +1254,9 @@ func (c UpdateChainConfigConfig) Validate(e deployment.Environment) error {
if len(ccfg.Readers) == 0 {
return errors.New("Readers must be set")
}
if err := ccfg.EncodableChainConfig.Validate(); err != nil {
return fmt.Errorf("invalid chain config for selector %d: %w", add, err)
}
}
return nil
}
Expand Down

0 comments on commit b51f131

Please sign in to comment.