Skip to content

Commit

Permalink
Merge branch 'main' into feat/update-respective-client-only
Browse files Browse the repository at this point in the history
  • Loading branch information
izyak authored Nov 23, 2023
2 parents e05132e + a166816 commit 9b4690a
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 39 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "Release"
on:
push:
tags:
- 'v*.*.*-alpha.*' # Run release on any tag. Will be marked as draft by default anyway.
- '*' # Run release on any tag. Will be marked as draft by default anyway.

jobs:
goreleaser:
Expand Down
6 changes: 3 additions & 3 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- id: darwin-arm64
main: ./main.go
binary: rly
Expand All @@ -27,7 +27,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- id: linux-amd64
main: ./main.go
binary: rly
Expand All @@ -41,7 +41,7 @@ builds:
flags:
- -mod=readonly
ldflags:
- -s -w -X github.com/icon-project/ibc-relay/v2/cmd.Version={{ .Tag }}
- -s -w -X github.com/cosmos/relayer/v2/cmd.Version={{ .Tag }}
- id: linux-arm64
main: ./main.go
binary: rly
Expand Down
3 changes: 0 additions & 3 deletions relayer/chains/icon/icon_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -357,9 +357,6 @@ loop:
break
}

icp.log.Debug("Verified block ",
zap.Int64("height", int64(processedheight)))

icp.latestBlock = provider.LatestBlock{
Height: uint64(processedheight),
}
Expand Down
8 changes: 4 additions & 4 deletions relayer/chains/icon/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func MptProve(key types.HexInt, proofs [][]byte, hash []byte) ([]byte, error) {

func Base64ToData(encoded string, v interface{}) ([]byte, error) {
if encoded == "" {
return nil, fmt.Errorf("Encoded string is empty ")
return nil, fmt.Errorf("encoded string is empty ")

Check warning on line 52 in relayer/chains/icon/utils.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/icon/utils.go#L52

Added line #L52 was not covered by tests
}

decoded, err := base64.StdEncoding.DecodeString(encoded)
Expand All @@ -63,11 +63,11 @@ func Base64ToData(encoded string, v interface{}) ([]byte, error) {
func HexBytesToProtoUnmarshal(encoded types.HexBytes, v proto.Message) ([]byte, error) {
inputBytes, err := encoded.Value()
if err != nil {
return nil, fmt.Errorf("Error unmarshalling HexByte")
return nil, fmt.Errorf("error unmarshalling HexByte")

Check warning on line 66 in relayer/chains/icon/utils.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/icon/utils.go#L66

Added line #L66 was not covered by tests
}

if bytes.Equal(inputBytes, make([]byte, 0)) {
return nil, fmt.Errorf("Encoded hexbyte is empty ")
return nil, fmt.Errorf("encoded hexbyte is empty ")

Check warning on line 70 in relayer/chains/icon/utils.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/icon/utils.go#L70

Added line #L70 was not covered by tests
}

if err := proto.Unmarshal(inputBytes, v); err != nil {
Expand Down Expand Up @@ -157,7 +157,7 @@ func VerifyBtpProof(decision *types.NetworkTypeSectionDecision, proof [][]byte,
for _, raw_sig := range proof {
sig, err := crypto.ParseSignature(raw_sig)
if err != nil {
return false, err
continue

Check warning on line 160 in relayer/chains/icon/utils.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/icon/utils.go#L160

Added line #L160 was not covered by tests
}
pubkey, err := sig.RecoverPublicKey(decision.Hash())
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion relayer/chains/wasm/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ func (ap *WasmProvider) QueryClientConsensusState(ctx context.Context, chainHeig
if err != nil {
return nil, err
}
consensusState, err := ap.QueryIBCHandlerContractProcessed(ctx, consensusStateParam)
consensusState, err := ap.QueryIBCHandlerContractNoRetry(ctx, consensusStateParam)

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

View check run for this annotation

Codecov / codecov/patch

relayer/chains/wasm/query.go#L324

Added line #L324 was not covered by tests
if err != nil {
return nil, err
}
Expand Down
28 changes: 14 additions & 14 deletions relayer/chains/wasm/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,20 +744,20 @@ func (ap *WasmProvider) SendMessagesToMempool(
return err
}

// if msg.Type() == MethodUpdateClient {
// if err := retry.Do(func() error {
// if err := ap.BroadcastTx(cliCtx, txBytes, []provider.RelayerMessage{msg}, asyncCtx, defaultBroadcastWaitTimeout, asyncCallback, true); err != nil {
// if strings.Contains(err.Error(), sdkerrors.ErrWrongSequence.Error()) {
// ap.handleAccountSequenceMismatchError(err)
// }
// }
// return err
// }, retry.Context(ctx), rtyAtt, retry.Delay(time.Millisecond*time.Duration(ap.PCfg.BlockInterval)), rtyErr); err != nil {
// ap.log.Error("Failed to update client", zap.Any("Message", msg))
// return err
// }
// continue
// }
if msg.Type() == MethodUpdateClient {
if err := retry.Do(func() error {
if err := ap.BroadcastTx(cliCtx, txBytes, []provider.RelayerMessage{msg}, asyncCtx, defaultBroadcastWaitTimeout, asyncCallback, true); err != nil {
if strings.Contains(err.Error(), sdkerrors.ErrWrongSequence.Error()) {
ap.handleAccountSequenceMismatchError(err)
}

Check warning on line 752 in relayer/chains/wasm/tx.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/wasm/tx.go#L747-L752

Added lines #L747 - L752 were not covered by tests
}
return err
}, retry.Context(ctx), rtyAtt, retry.Delay(time.Millisecond*time.Duration(ap.PCfg.BlockInterval)), rtyErr); err != nil {
ap.log.Error("Failed to update client", zap.Any("Message", msg))
return err
}
continue

Check warning on line 759 in relayer/chains/wasm/tx.go

View check run for this annotation

Codecov / codecov/patch

relayer/chains/wasm/tx.go#L754-L759

Added lines #L754 - L759 were not covered by tests
}
if err := ap.BroadcastTx(cliCtx, txBytes, []provider.RelayerMessage{msg}, asyncCtx, defaultBroadcastWaitTimeout, asyncCallback, false); err != nil {
if strings.Contains(err.Error(), sdkerrors.ErrWrongSequence.Error()) {
ap.handleAccountSequenceMismatchError(err)
Expand Down
3 changes: 0 additions & 3 deletions relayer/chains/wasm/wasm_chain_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,9 +444,6 @@ func (ccp *WasmChainProcessor) queryCycle(ctx context.Context, persistence *quer
return err
}

ccp.log.Debug("Verified block ",
zap.Int64("height", lightBlock.Header.Height))

heightUint64 := uint64(i)

ccp.latestBlock = provider.LatestBlock{
Expand Down
14 changes: 6 additions & 8 deletions relayer/processor/message_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,12 +439,9 @@ func (mp *messageProcessor) sendClientUpdate(
msgs := []provider.RelayerMessage{mp.msgUpdateClient}

callback := func(rtr *provider.RelayerTxResponse, err error) {

mp.log.Debug("Executing callback of sendClientUpdate ",
zap.Any("Transaction Status", rtr.Code),
zap.Any("Response", rtr),
zap.Any("LastClientUpdateHeight", dst.lastClientUpdateHeight))

mp.log.Debug("Executing callback of sendClientUpdate",
zap.Any("response", rtr),
zap.Uint64("last_client_update_height", dst.lastClientUpdateHeight))

Check warning on line 444 in relayer/processor/message_processor.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/message_processor.go#L442-L444

Added lines #L442 - L444 were not covered by tests
if IsBTPLightClient(dst.clientState) {
if src.BTPHeightQueue.Size() == 0 {
return
Expand All @@ -453,20 +450,21 @@ func (mp *messageProcessor) sendClientUpdate(
if err != nil {
return
}
if rtr.Code == 0 {

if rtr != nil && rtr.Code == 0 {

Check warning on line 454 in relayer/processor/message_processor.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/message_processor.go#L454

Added line #L454 was not covered by tests
if blockHeightInfo.Height == int64(dst.lastClientUpdateHeight) {
src.BTPHeightQueue.Dequeue()
}
return
}

// this would represent a failure case in that case isProcessing should be false
if blockHeightInfo.Height == int64(dst.lastClientUpdateHeight) {
if blockHeightInfo.RetryCount >= 5 {
// removing btpBLock update
src.BTPHeightQueue.Dequeue()
return
}

src.BTPHeightQueue.ReplaceQueue(zeroIndex, BlockInfoHeight{
Height: int64(dst.lastClientUpdateHeight),
IsProcessing: false,
Expand Down
7 changes: 5 additions & 2 deletions relayer/processor/path_end_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -539,14 +539,17 @@ func (pathEnd *pathEndRuntime) shouldSendPacketMessage(message packetIBCMessage,
pathEnd.log.Debug("Waiting to relay packet message until clientState is updated",
zap.Inline(message),
zap.String("event_type", eventType),
zap.String("client_id", pathEnd.clientState.ClientID),
zap.Uint64("client_height", pathEnd.clientState.ConsensusHeight.RevisionHeight),

Check warning on line 543 in relayer/processor/path_end_runtime.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_end_runtime.go#L542-L543

Added lines #L542 - L543 were not covered by tests
)
return false
}
if counterparty.BTPHeightQueue.ItemExist(int64(message.info.Height)) {

pathEnd.log.Debug("Waiting to relay packet message until clientState is in queue",
pathEnd.log.Debug("Waiting to relay packet message until clientState is in queue since btp height exist",

Check warning on line 548 in relayer/processor/path_end_runtime.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_end_runtime.go#L548

Added line #L548 was not covered by tests
zap.Inline(message),
zap.String("event_type", eventType),
zap.String("client_id", pathEnd.clientState.ClientID),
zap.Uint64("client_height", pathEnd.clientState.ConsensusHeight.RevisionHeight),

Check warning on line 552 in relayer/processor/path_end_runtime.go

View check run for this annotation

Codecov / codecov/patch

relayer/processor/path_end_runtime.go#L551-L552

Added lines #L551 - L552 were not covered by tests
)
return false
}
Expand Down

0 comments on commit 9b4690a

Please sign in to comment.