Skip to content

Commit

Permalink
Merge branch 'main' into fix/btp-block-miss-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
izyak authored Sep 4, 2023
2 parents 87a9477 + cf3dc3e commit 151dd15
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 20 deletions.
3 changes: 3 additions & 0 deletions relayer/chains/icon/icon_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,9 @@ loop:
break
}
time.Sleep(10 * time.Millisecond)
if icp.firstTime {
time.Sleep(4000 * time.Millisecond)
}

Check warning on line 383 in relayer/chains/icon/icon_chain_processor.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/icon/icon_chain_processor.go#L381-L383

Added lines #L381 - L383 were not covered by tests
icp.firstTime = false
if br = nil; len(btpBlockRespCh) > 0 {
br = <-btpBlockRespCh
Expand Down
38 changes: 19 additions & 19 deletions relayer/chains/wasm/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/avast/retry-go/v4"
abci "github.com/cometbft/cometbft/abci/types"
rpcclient "github.com/cometbft/cometbft/rpc/client"
tmtypes "github.com/cometbft/cometbft/types"
Expand All @@ -19,6 +20,7 @@ import (
"github.com/cosmos/gogoproto/proto"
tmclient "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/icon-project/IBC-Integration/libraries/go/common/icon"
"go.uber.org/zap"

querytypes "github.com/cosmos/cosmos-sdk/types/query"
bankTypes "github.com/cosmos/cosmos-sdk/x/bank/types"
Expand Down Expand Up @@ -335,25 +337,23 @@ func (ap *WasmProvider) QueryClientConsensusState(ctx context.Context, chainHeig
}

func (ap *WasmProvider) QueryIBCHandlerContract(ctx context.Context, param wasmtypes.RawContractMessage) (op *wasmtypes.QuerySmartContractStateResponse, err error) {
done := ap.SetSDKContext()
defer done()
return ap.QueryClient.SmartContractState(ctx, &wasmtypes.QuerySmartContractStateRequest{
Address: ap.PCfg.IbcHandlerAddress,
QueryData: param,
})
// return op, retry.Do(func() error {
// op, err =
// return err
// }, retry.Context(ctx), retry.Attempts(latestHeightQueryRetries), retry.Delay(50*time.Millisecond), retry.LastErrorOnly(true), retry.OnRetry(func(n uint, err error) {
// ap.log.Error(
// "Failed to query",
// zap.Uint("attempt", n+1),
// zap.Uint("max_attempts", latestHeightQueryRetries),
// zap.Any("Param", param),
// zap.Error(err),
// )
// }))

return op, retry.Do(func() error {
done := ap.SetSDKContext()
defer done()
op, err = ap.QueryClient.SmartContractState(ctx, &wasmtypes.QuerySmartContractStateRequest{
Address: ap.PCfg.IbcHandlerAddress,
QueryData: param,
})
return err
}, retry.Context(ctx), retry.Attempts(latestHeightQueryRetries), retry.Delay(50*time.Millisecond), retry.LastErrorOnly(true), retry.OnRetry(func(n uint, err error) {
ap.log.Error(
"Failed to query",
zap.Uint("attempt", n+1),
zap.Uint("max_attempts", latestHeightQueryRetries),
zap.Any("Param", param),
zap.Error(err),
)
}))

Check warning on line 356 in relayer/chains/wasm/query.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/wasm/query.go#L339-L356

Added lines #L339 - L356 were not covered by tests
}

func (ap *WasmProvider) QueryIBCHandlerContractProcessed(ctx context.Context, param wasmtypes.RawContractMessage) ([]byte, error) {
Expand Down
2 changes: 1 addition & 1 deletion relayer/chains/wasm/wasm_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
messages := ibcMessagesFromEvents(ccp.log, tx.Events, chainID, heightUint64, ccp.chainProvider.PCfg.IbcHandlerAddress, base64Encoded)

for _, m := range messages {
ccp.log.Info("Detected eventlog", zap.String("eventlog", m.eventType))
ccp.log.Info("Detected eventlog", zap.String("eventlog", m.eventType), zap.Uint64("height", heightUint64))

Check warning on line 472 in relayer/chains/wasm/wasm_chain_processor.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/wasm/wasm_chain_processor.go#L472

Added line #L472 was not covered by tests
ccp.handleMessage(ctx, m, ibcMessagesCache)
}
}
Expand Down

0 comments on commit 151dd15

Please sign in to comment.