Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: e2e cosmos findevent not found #570

Merged
merged 1 commit into from
Jul 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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