From 44846c53dbefb054e52869ed9b04c99591b6a895 Mon Sep 17 00:00:00 2001 From: Masanori Yoshida Date: Thu, 12 Oct 2023 12:32:17 +0900 Subject: [PATCH] call ChainConfig::Validate and ProverConfig::Validate in ChainProverConfig::Init Signed-off-by: Masanori Yoshida --- core/config.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/config.go b/core/config.go index 79fc0f61..0e2825c8 100644 --- a/core/config.go +++ b/core/config.go @@ -3,6 +3,7 @@ package core import ( "encoding/json" "errors" + "fmt" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/gogoproto/proto" @@ -60,10 +61,14 @@ func (cc *ChainProverConfig) Init(m codec.Codec) error { var chain ChainConfig if err := utils.UnmarshalJSONAny(m, &chain, cc.Chain); err != nil { return err + } else if err := chain.Validate(); err != nil { + return fmt.Errorf("invalid chain config: %v", err) } var prover ProverConfig if err := utils.UnmarshalJSONAny(m, &prover, cc.Prover); err != nil { return err + } else if err := prover.Validate(); err != nil { + return fmt.Errorf("invalid prover config: %v", err) } cc.chain = chain cc.prover = prover