Skip to content

Commit

Permalink
fix: e2e cosmos findevent not found (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
viveksharmapoudel authored Jul 31, 2023
1 parent 2689e00 commit 8b3dbac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/chains/cosmos/localnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ func (c *CosmosLocalnet) FindEvent(ctx context.Context, startHeight int64, contr
log.Fatal(err)
}
defer client.Stop()
ctx, cancel := context.WithCancel(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
query := strings.Join([]string{"tm.event = 'Tx'",
fmt.Sprintf("tx.height >= %d ", startHeight),
fmt.Sprintf("message.module = 'wasm'"),
Expand All @@ -262,12 +263,11 @@ func (c *CosmosLocalnet) FindEvent(ctx context.Context, startHeight int64, contr
if err != nil {
log.Fatal(err)
}

select {
case event := <-channel:
cancel()
return &event, nil
case <-time.After(20 * time.Second):
cancel()
case <-ctx.Done():
return nil, fmt.Errorf("failed to find eventLog")
}
}
Expand Down Expand Up @@ -316,7 +316,7 @@ func (c *CosmosLocalnet) QueryContract(ctx context.Context, contractAddress, met

func (c *CosmosLocalnet) ExecuteContract(ctx context.Context, contractAddress, keyName, methodName, param string) (context.Context, error) {
txHash, err := c.getFullNode().ExecTx(ctx, keyName,
"wasm", "execute", contractAddress, `{"`+methodName+`":`+param+`}`)
"wasm", "execute", contractAddress, `{"`+methodName+`":`+param+`}`, "--gas", "auto")
tx, err := c.getTransaction(txHash)
ctx = context.WithValue(ctx, "txResult", tx)
return ctx, err
Expand Down

0 comments on commit 8b3dbac

Please sign in to comment.