@@ -7,13 +7,12 @@ import (
7
7
"strconv"
8
8
"time"
9
9
10
+ "github.com/cosmos/cosmos-sdk/client/flags"
10
11
"github.com/cosmos/gaia/v23/tests/e2e/data"
11
12
)
12
13
13
14
const (
14
- proposalStoreWasmLightClientFilename = "proposal_store_wasm_light_client.json"
15
- wasmLightClientStateFilename = "wasm_light_client_state.json"
16
- wasmLightClientConsensusStateFilename = "wasm_light_client_consensus_state.json"
15
+ proposalStoreWasmLightClientFilename = "proposal_store_wasm_light_client.json"
17
16
)
18
17
19
18
func (s * IntegrationTestSuite ) testStoreWasmLightClient () {
@@ -39,7 +38,7 @@ func (s *IntegrationTestSuite) testStoreWasmLightClient() {
39
38
res , err := queryIbcWasmChecksums (chainEndpoint )
40
39
s .Require ().NoError (err )
41
40
s .Require ().NotNil (res )
42
- s .Require ().Equal (len (res ), 1 )
41
+ s .Require ().Equal (1 , len (res ))
43
42
44
43
return true
45
44
},
@@ -52,20 +51,33 @@ func (s *IntegrationTestSuite) testCreateWasmLightClient() {
52
51
ctx , cancel := context .WithTimeout (context .Background (), time .Minute )
53
52
defer cancel ()
54
53
55
- s .writeClientAndConsensusState (s .chainA )
54
+ valIdx := 0
55
+ val := s .chainA .validators [valIdx ]
56
+ address , _ := val .keyInfo .GetAddress ()
57
+ sender := address .String ()
58
+
59
+ clientState := `{"@type":"/ibc.lightclients.wasm.v1.ClientState","data":"ZG9lc250IG1hdHRlcg==","checksum":"O45STPnbLLar4DtFwDx0dE6tuXQW5XTKPHpbjaugun4=","latest_height":{"revision_number":"0","revision_height":"7795583"}}`
60
+ consensusState := `{"@type":"/ibc.lightclients.wasm.v1.ConsensusState","data":"ZG9lc250IG1hdHRlcg=="}`
56
61
57
62
cmd := []string {
58
63
gaiadBinary ,
59
64
txCommand ,
60
65
"ibc" ,
61
66
"client" ,
62
67
"create" ,
63
- wasmLightClientStateFilename ,
64
- wasmLightClientConsensusStateFilename ,
68
+ clientState ,
69
+ consensusState ,
70
+ fmt .Sprintf ("--from=%s" , sender ),
71
+ fmt .Sprintf ("--%s=%s" , flags .FlagFees , standardFees .String ()),
72
+ fmt .Sprintf ("--%s=%s" , flags .FlagChainID , s .chainA .id ),
73
+ "--keyring-backend=test" ,
74
+ "--broadcast-mode=sync" ,
75
+ "--output=json" ,
76
+ "-y" ,
65
77
}
66
78
67
79
s .T ().Logf ("Creating wasm light client on chain %s" , s .chainA .id )
68
- s .executeGaiaTxCommand (ctx , s .chainA , cmd , 0 , s .defaultExecValidation (s .chainA , 0 ))
80
+ s .executeGaiaTxCommand (ctx , s .chainA , cmd , valIdx , s .defaultExecValidation (s .chainA , valIdx ))
69
81
s .T ().Log ("successfully created wasm light client" )
70
82
}
71
83
@@ -92,14 +104,3 @@ func (s *IntegrationTestSuite) writeStoreWasmLightClientProposal(c *chain) {
92
104
err := writeFile (filepath .Join (c .validators [0 ].configDir (), "config" , proposalStoreWasmLightClientFilename ), []byte (propMsgBody ))
93
105
s .Require ().NoError (err )
94
106
}
95
-
96
- func (s * IntegrationTestSuite ) writeClientAndConsensusState (c * chain ) {
97
- clientState := `{"@type":"/ibc.lightclients.wasm.v1.ClientState","data":"ZG9lc250IG1hdHRlcg==","checksum":"O45STPnbLLar4DtFwDx0dE6tuXQW5XTKPHpbjaugun4=","latest_height":{"revision_number":"0","revision_height":"7795583"}}`
98
- consensusState := `{"@type":"/ibc.lightclients.wasm.v1.ConsensusState","data":"ZG9lc250IG1hdHRlcg=="}`
99
-
100
- err := writeFile (filepath .Join (c .validators [0 ].configDir (), "config" , wasmLightClientStateFilename ), []byte (clientState ))
101
- s .Require ().NoError (err )
102
-
103
- err = writeFile (filepath .Join (c .validators [0 ].configDir (), "config" , wasmLightClientConsensusStateFilename ), []byte (consensusState ))
104
- s .Require ().NoError (err )
105
- }
0 commit comments