@@ -111,7 +111,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
111111 Deposit : minimalDeposit (s .network .GetBaseDenom (), big .NewInt (1 )),
112112 }
113113
114- _ , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , outOfGasCheck )
114+ _ , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , outOfGasCheck )
115115 Expect (err ).To (BeNil ())
116116 })
117117
@@ -122,7 +122,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
122122 }
123123 eventCheck := passCheck .WithExpEvents (& gov.SubmitProposalEvent {})
124124
125- _ , ethRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , eventCheck )
125+ _ , ethRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , eventCheck )
126126 Expect (err ).To (BeNil ())
127127
128128 // unpack return → proposalId
@@ -143,7 +143,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
143143 }
144144 errCheck := defaultLogCheck .WithErrContains ("invalid proposal JSON" )
145145 _ , _ , err := s .factory .CallContractAndCheckLogs (
146- proposerKey , txArgs , callArgs , errCheck )
146+ proposerKey , txArgs , callArgs . Method , errCheck )
147147 Expect (err ).To (BeNil ())
148148 })
149149
@@ -153,7 +153,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
153153 callArgs .Method = & gov.SubmitProposalCall {Proposer : proposerAddr , JsonProposal : jsonBlob , Deposit : invalidDep }
154154 errCheck := defaultLogCheck .WithErrContains ("invalid deposit denom" )
155155 _ , _ , err := s .factory .CallContractAndCheckLogs (
156- proposerKey , txArgs , callArgs , errCheck )
156+ proposerKey , txArgs , callArgs . Method , errCheck )
157157 Expect (err ).To (BeNil ())
158158 })
159159 })
@@ -165,17 +165,16 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
165165 callArgs .Method = & gov.DepositCall {
166166 Depositor : proposerAddr , ProposalId : uint64 (999 ), Amount : minimalDeposit (s .network .GetBaseDenom (), big .NewInt (1 ))}
167167 errCheck := defaultLogCheck .WithErrContains ("not found" )
168- _ , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , errCheck )
168+ _ , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , errCheck )
169169 Expect (err ).To (BeNil ())
170170 })
171171
172172 It ("deposits successfully and emits event" , func () {
173173 jsonBlob := minimalBankSendProposalJSON (proposerAccAddr , s .network .GetBaseDenom (), "1" )
174174 eventCheck := passCheck .WithExpEvents (& gov.SubmitProposalEvent {})
175- callArgs .MethodName = gov .SubmitProposalMethod
176175 minDeposit := minimalDeposit (s .network .GetBaseDenom (), big .NewInt (1 ))
177176 callArgs .Method = & gov.SubmitProposalCall {Proposer : proposerAddr , JsonProposal : jsonBlob , Deposit : minDeposit }
178- _ , evmRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , eventCheck )
177+ _ , evmRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , eventCheck )
179178 Expect (err ).To (BeNil ())
180179 var propOut gov.SubmitProposalReturn
181180 _ , err = propOut .Decode (evmRes .Ret )
@@ -196,22 +195,21 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
196195
197196 callArgs .Method = & gov.DepositCall {Depositor : proposerAddr , ProposalId : propID , Deposit : minimalDeposit (s .network .GetBaseDenom (), big .NewInt (1 ))}
198197 eventCheck = passCheck .WithExpEvents (& gov.DepositEvent {})
199- _ , _ , err = s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , eventCheck )
198+ _ , _ , err = s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , eventCheck )
200199 Expect (err ).To (BeNil ())
201200 Expect (s .network .NextBlock ()).To (BeNil ())
202201 // Update expected total deposit
203202 td [0 ].Amount = td [0 ].Amount .Add (minDepositCoins [0 ].Amount )
204203
205204 // verify via query
206- callArgs .MethodName = gov .GetProposalMethod
207205 callArgs .Method = & gov.GetProposalCall {ProposalId : propOut .ProposalId }
208- _ , ethRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , passCheck )
206+ _ , ethRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , passCheck )
209207 Expect (err ).To (BeNil ())
210208
211- var out gov.ProposalOutput
212- err = s . precompile . UnpackIntoInterface ( & out , gov . GetProposalMethod , ethRes .Ret )
209+ var out gov.GetProposalReturn
210+ _ , err = out . Decode ( ethRes .Ret )
213211 Expect (err ).To (BeNil ())
214- Expect (out .Proposal .Id ).To (Equal (propID ))
212+ Expect (out .Proposal .Id ).To (Equal (propOut . ProposalId ))
215213 Expect (out .Proposal .Status ).To (Equal (uint32 (govv1 .StatusDepositPeriod )))
216214 newTd := out .Proposal .TotalDeposit
217215 Expect (newTd ).To (HaveLen (1 ))
@@ -228,7 +226,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
228226 })
229227
230228 It ("fails when called by a non-proposer" , func () {
231- callArgs .Args = [] interface {}{ proposerAddr , proposalID }
229+ callArgs .Method = & gov. CancelProposalCall { Proposer : proposerAddr , ProposalId : proposalID }
232230 notProposerKey := s .keyring .GetPrivKey (1 )
233231 notProposerAddr := s .keyring .GetAddr (1 )
234232 errCheck := defaultLogCheck .WithErrContains (
@@ -237,7 +235,7 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
237235 proposerAddr .String (),
238236 )
239237
240- _ , _ , err := s .factory .CallContractAndCheckLogs (notProposerKey , txArgs , callArgs , errCheck )
238+ _ , _ , err := s .factory .CallContractAndCheckLogs (notProposerKey , txArgs , callArgs . Method , errCheck )
241239 Expect (err ).To (BeNil ())
242240 })
243241
@@ -246,15 +244,15 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
246244 Expect (err ).To (BeNil ())
247245
248246 // Cancel proposal
249- callArgs .Args = [] interface {}{ proposerAddr , proposal .Id }
250- eventCheck := passCheck .WithExpEvents (gov .EventTypeCancelProposal )
251- _ , evmRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , eventCheck )
247+ callArgs .Method = & gov. CancelProposalCall { Proposer : proposerAddr , ProposalId : proposal .Id }
248+ eventCheck := passCheck .WithExpEvents (& gov.CancelProposalEvent {} )
249+ _ , evmRes , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , eventCheck )
252250 Expect (err ).To (BeNil ())
253251 Expect (s .network .NextBlock ()).To (BeNil ())
254- var succeeded bool
255- err = s . precompile . UnpackIntoInterface ( & succeeded , gov . CancelProposalMethod , evmRes .Ret )
252+ var out gov. CancelProposalReturn
253+ _ , err = out . Decode ( evmRes .Ret )
256254 Expect (err ).To (BeNil ())
257- Expect (succeeded ).To (BeTrue ())
255+ Expect (out . Success ).To (BeTrue ())
258256
259257 // 3. Check that the proposal is not found
260258 _ , err = s .network .App .GetGovKeeper ().Proposals .Get (s .network .GetContext (), proposal .Id )
@@ -284,11 +282,11 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
284282 remaining := proposalDepositAmt .Sub (cancelFee )
285283
286284 // Cancel it
287- callArgs .Args = [] interface {}{ proposerAddr , proposal .Id }
288- eventCheck := passCheck .WithExpEvents (gov .EventTypeCancelProposal )
285+ callArgs .Method = & gov. CancelProposalCall { Proposer : proposerAddr , ProposalId : proposal .Id }
286+ eventCheck := passCheck .WithExpEvents (& gov.CancelProposalEvent {} )
289287 // Balance of proposer
290288 proposalBal := s .network .App .GetBankKeeper ().GetBalance (s .network .GetContext (), proposerAccAddr , s .network .GetBaseDenom ())
291- res , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs , eventCheck )
289+ res , _ , err := s .factory .CallContractAndCheckLogs (proposerKey , txArgs , callArgs . Method , eventCheck )
292290 Expect (err ).To (BeNil ())
293291 Expect (s .network .NextBlock ()).To (BeNil ())
294292 gasCost := math .NewInt (res .GasUsed ).Mul (math .NewInt (txArgs .GasPrice .Int64 ()))
@@ -318,11 +316,11 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
318316
319317 It ("should return error if the provided gasLimit is too low" , func () {
320318 txArgs .GasLimit = 30000
321- callArgs .Args = [] interface {} {
322- s .keyring .GetAddr (0 ), proposalID , option , metadata ,
319+ callArgs .Method = & gov. VoteCall {
320+ Voter : s .keyring .GetAddr (0 ), ProposalId : proposalID , Option : option , Metadata : metadata ,
323321 }
324322
325- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , outOfGasCheck )
323+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , outOfGasCheck )
326324 Expect (err ).To (BeNil ())
327325
328326 // tally result yes count should remain unchanged
@@ -333,24 +331,24 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
333331 })
334332
335333 It ("should return error if the origin is different than the voter" , func () {
336- callArgs .Args = [] interface {} {
337- differentAddr , proposalID , option , metadata ,
334+ callArgs .Method = & gov. VoteCall {
335+ Voter : differentAddr , ProposalId : proposalID , Option : option , Metadata : metadata ,
338336 }
339337
340338 voterSetCheck := defaultLogCheck .WithErrContains (cmn .ErrRequesterIsNotMsgSender , s .keyring .GetAddr (0 ).String (), differentAddr .String ())
341339
342- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , voterSetCheck )
340+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , voterSetCheck )
343341 Expect (err ).To (BeNil ())
344342 })
345343
346344 It ("should vote success" , func () {
347- callArgs .Args = [] interface {} {
348- s .keyring .GetAddr (0 ), proposalID , option , metadata ,
345+ callArgs .Method = & gov. VoteCall {
346+ Voter : s .keyring .GetAddr (0 ), ProposalId : proposalID , Option : option , Metadata : metadata ,
349347 }
350348
351- voterSetCheck := passCheck .WithExpEvents (gov .EventTypeVote )
349+ voterSetCheck := passCheck .WithExpEvents (& gov.VoteEvent {} )
352350
353- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , voterSetCheck )
351+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , voterSetCheck )
354352 Expect (err ).To (BeNil (), "error while calling the precompile" )
355353
356354 // tally result yes count should updated
@@ -371,17 +369,17 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
371369
372370 It ("should return error if the provided gasLimit is too low" , func () {
373371 txArgs .GasLimit = 30000
374- callArgs .Args = [] interface {} {
375- s .keyring .GetAddr (0 ),
376- proposalID ,
377- []gov.WeightedVoteOption {
372+ callArgs .Method = & gov. VoteWeightedCall {
373+ Voter : s .keyring .GetAddr (0 ),
374+ ProposalId : proposalID ,
375+ Options : []gov.WeightedVoteOption {
378376 {Option : 1 , Weight : "0.5" },
379377 {Option : 2 , Weight : "0.5" },
380378 },
381- metadata ,
379+ Metadata : metadata ,
382380 }
383381
384- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , outOfGasCheck )
382+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , outOfGasCheck )
385383 Expect (err ).To (BeNil ())
386384
387385 // tally result should remain unchanged
@@ -392,36 +390,36 @@ func TestPrecompileIntegrationTestSuite(t *testing.T, create network.CreateEvmAp
392390 })
393391
394392 It ("should return error if the origin is different than the voter" , func () {
395- callArgs .Args = [] interface {} {
396- differentAddr ,
397- proposalID ,
398- []gov.WeightedVoteOption {
393+ callArgs .Method = & gov. VoteWeightedCall {
394+ Voter : differentAddr ,
395+ ProposalId : proposalID ,
396+ Options : []gov.WeightedVoteOption {
399397 {Option : 1 , Weight : "0.5" },
400398 {Option : 2 , Weight : "0.5" },
401399 },
402- metadata ,
400+ Metadata : metadata ,
403401 }
404402
405403 voterSetCheck := defaultLogCheck .WithErrContains (cmn .ErrRequesterIsNotMsgSender , s .keyring .GetAddr (0 ).String (), differentAddr .String ())
406404
407- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , voterSetCheck )
405+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , voterSetCheck )
408406 Expect (err ).To (BeNil ())
409407 })
410408
411409 It ("should vote weighted success" , func () {
412- callArgs .Args = [] interface {} {
413- s .keyring .GetAddr (0 ),
414- proposalID ,
415- []gov.WeightedVoteOption {
410+ callArgs .Method = & gov. VoteWeightedCall {
411+ Voter : s .keyring .GetAddr (0 ),
412+ ProposalId : proposalID ,
413+ Options : []gov.WeightedVoteOption {
416414 {Option : 1 , Weight : "0.7" },
417415 {Option : 2 , Weight : "0.3" },
418416 },
419- metadata ,
417+ Metadata : metadata ,
420418 }
421419
422- voterSetCheck := passCheck .WithExpEvents (gov .EventTypeVoteWeighted )
420+ voterSetCheck := passCheck .WithExpEvents (& gov.VoteWeightedEvent {} )
423421
424- _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs , voterSetCheck )
422+ _ , _ , err := s .factory .CallContractAndCheckLogs (s .keyring .GetPrivKey (0 ), txArgs , callArgs . Method , voterSetCheck )
425423 Expect (err ).To (BeNil (), "error while calling the precompile" )
426424
427425 // tally result should be updated
0 commit comments