File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -48,12 +48,11 @@ func ValidateGenesisCmd(mbm module.BasicManager) *cobra.Command {
4848 }
4949
5050 var genState map [string ]json.RawMessage
51- if err = json .Unmarshal (appGenesis .AppState , & genState ); err != nil {
51+ if err : = json .Unmarshal (appGenesis .AppState , & genState ); err != nil {
5252 if strings .Contains (err .Error (), "unexpected end of JSON input" ) {
5353 return fmt .Errorf ("app_state is missing in the genesis file: %s" , err .Error ())
5454 }
55-
56- return fmt .Errorf ("error unmarshalling genesis doc %s: %s" , genesis , err .Error ())
55+ return fmt .Errorf ("error unmarshalling genesis doc %s: %w" , genesis , err )
5756 }
5857
5958 if err = mbm .ValidateGenesis (cdc , clientCtx .TxConfig , genState ); err != nil {
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ package cli_test
22
33import (
44 "encoding/json"
5+ "fmt"
6+ "io"
57 "os"
68 "testing"
79
@@ -92,18 +94,20 @@ func TestValidateGenesis(t *testing.T) {
9294 }
9395}
9496
97+ var _ module.HasGenesisBasics = mockModule {}
98+
9599type mockModule struct {
96100 module.AppModuleBasic
97101}
98102
99- func (mockModule ) Name () string {
103+ func (m mockModule ) Name () string {
100104 return "mock"
101105}
102106
103- func (mockModule ) DefaultGenesis (codec.JSONCodec ) json.RawMessage {
107+ func (m mockModule ) DefaultGenesis (codec.JSONCodec ) json.RawMessage {
104108 return json .RawMessage (`{"foo": "bar"}` )
105109}
106110
107- func (mockModule ) ValidateGenesis (codec.JSONCodec , client.TxEncodingConfig , json.RawMessage ) error {
108- return nil
111+ func (m mockModule ) ValidateGenesis (codec.JSONCodec , client.TxEncodingConfig , json.RawMessage ) error {
112+ return fmt . Errorf ( "mock section is missing: %w" , io . EOF )
109113}
You can’t perform that action at this time.
0 commit comments