Skip to content

Commit

Permalink
apply some comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lumtis committed Jun 26, 2024
1 parent da9a7f5 commit fff4353
Show file tree
Hide file tree
Showing 7 changed files with 5 additions and 41 deletions.
1 change: 1 addition & 0 deletions zetaclient/authz/authz_signer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Package authz provides a signer object for transactions using grants
// grants are used to allow a hotkey to sign transactions on behalf of the observers
package authz

import (
Expand Down
1 change: 0 additions & 1 deletion zetaclient/chains/bitcoin/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const (
var _ interfaces.ChainObserver = &Observer{}

// Logger contains list of loggers used by Bitcoin chain observer
// TODO(revamp): Merge this logger with the one in evm
// https://github.com/zeta-chain/node/issues/2022
type Logger struct {
// Chain is the parent logger for the chain
Expand Down
4 changes: 2 additions & 2 deletions zetaclient/chains/bitcoin/observer/outbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ func (ob *Observer) refreshPendingNonce() {
}
}

// getOutboundIDByNonce gets the outbound ID from the nonce of the outbound transaction.
// test is true for unit test only.
// getOutboundIDByNonce gets the outbound ID from the nonce of the outbound transaction
// test is true for unit test only
func (ob *Observer) getOutboundIDByNonce(nonce uint64, test bool) (string, error) {

// There are 2 types of txids an observer can trust
Expand Down
2 changes: 1 addition & 1 deletion zetaclient/chains/evm/observer/observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ func (ob *Observer) PostGasPrice() error {
}

// TransactionByHash query transaction by hash via JSON-RPC
// TODO(revamp): move to a tx file
// TODO(revamp): update this method as a pure RPC method that takes two parameters (jsonRPC, and txHash) and move to upper package to file rpc.go
func (ob *Observer) TransactionByHash(txHash string) (*ethrpc.Transaction, bool, error) {
tx, err := ob.evmJSONRPC.EthGetTransactionByHash(txHash)
if err != nil {
Expand Down
13 changes: 0 additions & 13 deletions zetaclient/zetacore/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,19 +270,6 @@ func (c *Client) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) {
return nil, err
}

// GetLastBlockHeightByChain returns the last block height by chain
func (c *Client) GetLastBlockHeightByChain(chain chains.Chain) (*crosschaintypes.LastBlockHeight, error) {
client := crosschaintypes.NewQueryClient(c.grpcConn)
resp, err := client.LastBlockHeight(
context.Background(),
&crosschaintypes.QueryGetLastBlockHeightRequest{Index: chain.ChainName.String()},
)
if err != nil {
return nil, err
}
return resp.LastBlockHeight, nil
}

// GetBlockHeight returns the block height
func (c *Client) GetBlockHeight() (int64, error) {
client := crosschaintypes.NewQueryClient(c.grpcConn)
Expand Down
24 changes: 0 additions & 24 deletions zetaclient/zetacore/query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -461,30 +461,6 @@ func TestZetacore_GetNodeInfo(t *testing.T) {
require.Equal(t, expectedOutput, *resp)
}

func TestZetacore_GetLastBlockHeightByChain(t *testing.T) {
index := chains.BscMainnet
expectedOutput := crosschainTypes.QueryGetLastBlockHeightResponse{
LastBlockHeight: &crosschainTypes.LastBlockHeight{
Index: index.ChainName.String(),
Chain: "7000",
LastOutboundHeight: 2134123,
LastInboundHeight: 1234333,
},
}
input := crosschainTypes.QueryGetLastBlockHeightRequest{Index: index.ChainName.String()}
method := "/zetachain.zetacore.crosschain.Query/LastBlockHeight"
server := setupMockServer(t, crosschainTypes.RegisterQueryServer, method, input, expectedOutput)
server.Serve()
defer closeMockServer(t, server)

client, err := setupZetacoreClient()
require.NoError(t, err)

resp, err := client.GetLastBlockHeightByChain(index)
require.NoError(t, err)
require.Equal(t, expectedOutput.LastBlockHeight, resp)
}

func TestZetacore_GetZetaBlockHeight(t *testing.T) {
expectedOutput := crosschainTypes.QueryLastZetaHeightResponse{Height: 12345}
input := crosschainTypes.QueryLastZetaHeightRequest{}
Expand Down
1 change: 1 addition & 0 deletions zetaclient/zetacore/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ func GasPriceMultiplier(chainID int64) (float64, error) {
}

// WrapMessageWithAuthz wraps a message with an authz message
// used since a hotkey is used to broadcast the transactions, instead of the operator
func (c *Client) WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, clientauthz.Signer, error) {
msgURL := sdk.MsgTypeURL(msg)

Expand Down

0 comments on commit fff4353

Please sign in to comment.