Skip to content

Commit

Permalink
DA-608 run linters
Browse files Browse the repository at this point in the history
Signed-off-by: Dzianis Andreyenka <[email protected]>
  • Loading branch information
denisandreenko committed Aug 2, 2024
1 parent 37f0615 commit 5e031ee
Show file tree
Hide file tree
Showing 16 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ func configCommand() *cobra.Command {
Use: "docs",
Short: "Prints the config info as markdown",
Long: "",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
InitConfig()
b, err := config.GenerateConfigMarkdown(context.Background(), "", config.GetKnownKeys())
fmt.Println(string(b))
Expand Down
2 changes: 1 addition & 1 deletion cmd/tezosconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ var rootCmd = &cobra.Command{
Use: "tezosconnect",
Short: "Hyperledger FireFly Connector for Tezos blockchain",
Long: ``,
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
ctx, cancelCtx := context.WithCancel(context.Background())
return run(ctx, cancelCtx)
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func versionCommand() *cobra.Command {
Use: "version",
Short: "Prints the version info",
Long: "",
RunE: func(cmd *cobra.Command, args []string) error {
RunE: func(_ *cobra.Command, _ []string) error {
info := &Info{
Version: BuildVersionOverride,
Date: BuildDate,
Expand Down
10 changes: 5 additions & 5 deletions internal/tezos/blocklistener.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (
"sync"
"time"

"github.com/trilitech/tzgo/rpc"
"github.com/hyperledger/firefly-common/pkg/config"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-common/pkg/log"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/rpc"
)

type blockUpdateConsumer struct {
Expand Down Expand Up @@ -166,7 +166,7 @@ func (bl *blockListener) getNotifyPosition(blockHead *rpc.BlockHeaderLogEntry) *

candidate := bl.reconcileCanonicalChain(blockHead)
// Check this is the lowest position to notify from
if candidate != nil && (notifyPos == nil || candidate.Value.(*minimalBlockInfo).number < notifyPos.Value.(*minimalBlockInfo).number) {
if candidate != nil && (candidate.Value.(*minimalBlockInfo).number < notifyPos.Value.(*minimalBlockInfo).number) {
notifyPos = candidate
}
return notifyPos
Expand Down Expand Up @@ -302,7 +302,7 @@ func (bl *blockListener) rebuildCanonicalChain() *list.Element {
for {
var bi *rpc.Block
var reason ffcapi.ErrorReason
err := bl.c.retry.Do(bl.ctx, "rebuild listener canonical chain", func(attempt int) (retry bool, err error) {
err := bl.c.retry.Do(bl.ctx, "rebuild listener canonical chain", func(_ int) (retry bool, err error) {
bi, reason, err = bl.c.getBlockInfoByNumber(bl.ctx, nextBlockNumber, false, "")
return reason != ffcapi.ErrorReasonNotFound, err
})
Expand Down Expand Up @@ -356,7 +356,7 @@ func (bl *blockListener) trimToLastValidBlock() (lastValidBlock *minimalBlockInf
currentViewBlock := lastElem.Value.(*minimalBlockInfo)
var freshBlockInfo *rpc.Block
var reason ffcapi.ErrorReason
err := bl.c.retry.Do(bl.ctx, "rebuild listener canonical chain", func(attempt int) (retry bool, err error) {
err := bl.c.retry.Do(bl.ctx, "rebuild listener canonical chain", func(_ int) (retry bool, err error) {
freshBlockInfo, reason, err = bl.c.getBlockInfoByNumber(bl.ctx, currentViewBlock.number, false, "")
return reason != ffcapi.ErrorReasonNotFound, err
})
Expand Down Expand Up @@ -401,7 +401,7 @@ func (bl *blockListener) dispatchToConsumers(consumers []*blockUpdateConsumer, u

// getBlockHeightWithRetry keeps retrying attempting to get the initial block height until successful
func (bl *blockListener) establishBlockHeightWithRetry() error {
return bl.c.retry.Do(bl.ctx, "get initial block height", func(attempt int) (retry bool, err error) {
return bl.c.retry.Do(bl.ctx, "get initial block height", func(_ int) (retry bool, err error) {
headBlock, err := bl.c.client.GetHeadBlock(bl.ctx)
if err != nil {
log.L(bl.ctx).Warnf("Block height could not be obtained: %s", err.Error())
Expand Down
8 changes: 4 additions & 4 deletions internal/tezos/deploy_contract_prepare.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"encoding/hex"
"encoding/json"

"github.com/trilitech/tzgo/codec"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/i18n"
"github.com/hyperledger/firefly-common/pkg/log"
"github.com/hyperledger/firefly-tezosconnect/internal/msgs"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/codec"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

func (c *tezosConnector) DeployContractPrepare(ctx context.Context, req *ffcapi.ContractDeployPrepareRequest) (*ffcapi.TransactionPrepareResponse, ffcapi.ErrorReason, error) {
Expand Down
8 changes: 4 additions & 4 deletions internal/tezos/event_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,22 @@ func (c *tezosConnector) EventStreamStopped(ctx context.Context, req *ffcapi.Eve
}

// EventListenerVerifyOptions validates the configuration options for a listener, applying any defaults needed by the connector, and returning the update options for FFTM to persist
func (c *tezosConnector) EventListenerVerifyOptions(ctx context.Context, req *ffcapi.EventListenerVerifyOptionsRequest) (*ffcapi.EventListenerVerifyOptionsResponse, ffcapi.ErrorReason, error) {
func (c *tezosConnector) EventListenerVerifyOptions(_ context.Context, _ *ffcapi.EventListenerVerifyOptionsRequest) (*ffcapi.EventListenerVerifyOptionsResponse, ffcapi.ErrorReason, error) {
return nil, "", nil
}

// EventListenerAdd begins/resumes listening on set of events that must be consistently ordered. Blockchain specific signatures of the events are included, along with initial conditions (initial block number etc.), and the last stored checkpoint (if any)
func (c *tezosConnector) EventListenerAdd(ctx context.Context, req *ffcapi.EventListenerAddRequest) (*ffcapi.EventListenerAddResponse, ffcapi.ErrorReason, error) {
func (c *tezosConnector) EventListenerAdd(_ context.Context, _ *ffcapi.EventListenerAddRequest) (*ffcapi.EventListenerAddResponse, ffcapi.ErrorReason, error) {
return nil, "", nil
}

// EventListenerRemove ends listening on a set of events previous started
func (c *tezosConnector) EventListenerRemove(ctx context.Context, req *ffcapi.EventListenerRemoveRequest) (*ffcapi.EventListenerRemoveResponse, ffcapi.ErrorReason, error) {
func (c *tezosConnector) EventListenerRemove(_ context.Context, _ *ffcapi.EventListenerRemoveRequest) (*ffcapi.EventListenerRemoveResponse, ffcapi.ErrorReason, error) {
return nil, "", nil
}

// EventListenerHWM queries the current high water mark checkpoint for a listener. Called at regular intervals when there are no events in flight for a listener, to ensure checkpoint are written regularly even when there is no activity
func (c *tezosConnector) EventListenerHWM(ctx context.Context, req *ffcapi.EventListenerHWMRequest) (*ffcapi.EventListenerHWMResponse, ffcapi.ErrorReason, error) {
func (c *tezosConnector) EventListenerHWM(_ context.Context, _ *ffcapi.EventListenerHWMRequest) (*ffcapi.EventListenerHWMResponse, ffcapi.ErrorReason, error) {
return nil, "", nil
}

Expand Down
4 changes: 2 additions & 2 deletions internal/tezos/event_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ type eventStream struct {
catchup bool
}

func (es *eventStream) addEventListener(ctx context.Context, req *ffcapi.EventListenerAddRequest) (*listener, error) {
func (es *eventStream) addEventListener(_ context.Context, _ *ffcapi.EventListenerAddRequest) (*listener, error) {
// TODO: impl
return nil, nil
}

func (es *eventStream) startEventListener(l *listener) {
func (es *eventStream) startEventListener(_ *listener) {
// TODO: impl
}

Expand Down
6 changes: 3 additions & 3 deletions internal/tezos/exec_query.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (
"errors"
"strings"

"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-common/pkg/i18n"
"github.com/hyperledger/firefly-tezosconnect/internal/msgs"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

// QueryInvoke executes a method on a blockchain smart contract, which might execute Smart Contract code, but does not affect the blockchain state.
Expand Down
2 changes: 1 addition & 1 deletion internal/tezos/get_address_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package tezos
import (
"context"

"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/tezos"
)

// AddressBalance gets the balance of the specified address
Expand Down
4 changes: 2 additions & 2 deletions internal/tezos/get_block_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"context"
"strconv"

"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-common/pkg/i18n"
"github.com/hyperledger/firefly-common/pkg/log"
"github.com/hyperledger/firefly-tezosconnect/internal/msgs"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

// BlockInfoByNumber gets block information from the specified position (block number/index) in the canonical chain currently known to the local node
Expand Down
2 changes: 1 addition & 1 deletion internal/tezos/get_gas_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
// In Tezos, there is no concept of "gas price" as it exists in EVM chains.
// Tezos uses a different mechanism for handling transaction costs and execution fees.
// Instead of gas and gas prices, Tezos employs a concept known as "transaction fees."
func (c *tezosConnector) GasPriceEstimate(ctx context.Context, _ *ffcapi.GasPriceEstimateRequest) (*ffcapi.GasPriceEstimateResponse, ffcapi.ErrorReason, error) {
func (c *tezosConnector) GasPriceEstimate(_ context.Context, _ *ffcapi.GasPriceEstimateRequest) (*ffcapi.GasPriceEstimateResponse, ffcapi.ErrorReason, error) {
return &ffcapi.GasPriceEstimateResponse{
GasPrice: fftypes.JSONAnyPtr(`"0"`),
}, "", nil
Expand Down
4 changes: 2 additions & 2 deletions internal/tezos/get_next_nonce.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package tezos
import (
"context"

"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

// NextNonceForSigner is used when there are no outstanding transactions for a given signing identity, to determine the next nonce to use for submission of a transaction
Expand Down
6 changes: 3 additions & 3 deletions internal/tezos/get_receipt.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"context"
"encoding/json"

"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-common/pkg/log"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

const _address = "address"
Expand Down
10 changes: 5 additions & 5 deletions internal/tezos/prepare_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ import (
"net/http"
"strings"

"github.com/trilitech/tzgo/codec"
"github.com/trilitech/tzgo/contract"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-common/pkg/i18n"
"github.com/hyperledger/firefly-common/pkg/log"
"github.com/hyperledger/firefly-tezosconnect/internal/msgs"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/codec"
"github.com/trilitech/tzgo/contract"
"github.com/trilitech/tzgo/micheline"
"github.com/trilitech/tzgo/rpc"
"github.com/trilitech/tzgo/tezos"
)

// TransactionPrepare validates transaction inputs against the supplied schema/Michelson and performs any binary serialization required (prior to signing) to encode a transaction from JSON into the native blockchain format
Expand Down
2 changes: 1 addition & 1 deletion internal/tezos/send_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"io"
"net/http"

"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/codec"
"github.com/trilitech/tzgo/tezos"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
)

// TransactionSend combines a previously prepared encoded transaction, with a current gas price, and submits it to the transaction pool of the blockchain for mining
Expand Down
2 changes: 1 addition & 1 deletion internal/tezos/tezos.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"sync"
"time"

"github.com/trilitech/tzgo/rpc"
lru "github.com/hashicorp/golang-lru"
"github.com/hyperledger/firefly-common/pkg/config"
"github.com/hyperledger/firefly-common/pkg/fftypes"
Expand All @@ -14,6 +13,7 @@ import (
"github.com/hyperledger/firefly-common/pkg/retry"
"github.com/hyperledger/firefly-tezosconnect/internal/msgs"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
"github.com/trilitech/tzgo/rpc"
)

type tezosConnector struct {
Expand Down

0 comments on commit 5e031ee

Please sign in to comment.