Skip to content

Commit

Permalink
refactor: just use cometbft bytes. helper lib for now
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Sep 3, 2024
1 parent 12b9bf7 commit 7e8f012
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 90 deletions.
75 changes: 0 additions & 75 deletions client/bytes/bytes.go

This file was deleted.

9 changes: 4 additions & 5 deletions client/cmbft_consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
rpcclient "github.com/cometbft/cometbft/rpc/client"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
tmtypes "github.com/cometbft/cometbft/types"
rbytes "github.com/cosmos/relayer/v2/client/bytes"
)

var _ ConsensusClient = (*CometRPCClient)(nil)
Expand Down Expand Up @@ -111,10 +110,10 @@ func (r CometRPCClient) DoBroadcastTxAsync(ctx context.Context, tx tmtypes.Tx) (
}
return &ResultBroadcastTx{
Code: b.Code,
Data: rbytes.ConvertCometBFTToHexBytes(b.Data),
Data: b.Data,
Log: b.Log,
Codespace: b.Codespace,
Hash: rbytes.ConvertCometBFTToHexBytes(b.Hash),
Hash: b.Hash,
}, nil
}

Expand All @@ -126,10 +125,10 @@ func (r CometRPCClient) DoBroadcastTxSync(ctx context.Context, tx tmtypes.Tx) (*
}
return &ResultBroadcastTx{
Code: b.Code,
Data: rbytes.ConvertCometBFTToHexBytes(b.Data),
Data: b.Data,
Log: b.Log,
Codespace: b.Codespace,
Hash: rbytes.ConvertCometBFTToHexBytes(b.Hash),
Hash: b.Hash,
}, nil
}

Expand Down
14 changes: 6 additions & 8 deletions client/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,10 @@ import (

abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/crypto"
bytes "github.com/cometbft/cometbft/libs/bytes"
rpcclient "github.com/cometbft/cometbft/rpc/client"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
tmtypes "github.com/cometbft/cometbft/types"

bytes "github.com/cometbft/cometbft/libs/bytes"
rbytes "github.com/cosmos/relayer/v2/client/bytes"
)

// TODO(reece): get off cometbft types into internal relayer.
Expand Down Expand Up @@ -89,9 +87,9 @@ type Validator struct {
}

type ResultBroadcastTx struct {
Code uint32 `json:"code"`
Data rbytes.HexBytes `json:"data"`
Log string `json:"log"`
Codespace string `json:"codespace"`
Hash rbytes.HexBytes `json:"hash"`
Code uint32 `json:"code"`
Data bytes.HexBytes `json:"data"`
Log string `json:"log"`
Codespace string `json:"codespace"`
Hash bytes.HexBytes `json:"hash"`
}
4 changes: 2 additions & 2 deletions relayer/chains/cosmos/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"cosmossdk.io/store/rootmulti"
"github.com/avast/retry-go/v4"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/bytes"
"github.com/cometbft/cometbft/light"
client2 "github.com/cometbft/cometbft/rpc/client"
coretypes "github.com/cometbft/cometbft/rpc/core/types"
Expand All @@ -43,7 +44,6 @@ import (
tmclient "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
localhost "github.com/cosmos/ibc-go/v8/modules/light-clients/09-localhost"
rclient "github.com/cosmos/relayer/v2/client"
rbytes "github.com/cosmos/relayer/v2/client/bytes"
strideicqtypes "github.com/cosmos/relayer/v2/relayer/chains/cosmos/stride"
"github.com/cosmos/relayer/v2/relayer/ethermint"
"github.com/cosmos/relayer/v2/relayer/provider"
Expand Down Expand Up @@ -234,7 +234,7 @@ func (cc *CosmosProvider) SubmitTxAwaitResponse(ctx context.Context, msgs []sdk.
}

// Get the TX by hash, waiting for it to be included in a block
func (cc *CosmosProvider) AwaitTx(txHash rbytes.HexBytes, timeout time.Duration) (*txtypes.GetTxResponse, error) {
func (cc *CosmosProvider) AwaitTx(txHash bytes.HexBytes, timeout time.Duration) (*txtypes.GetTxResponse, error) {
var txByHash *txtypes.GetTxResponse
var txLookupErr error
startTime := time.Now()
Expand Down

0 comments on commit 7e8f012

Please sign in to comment.