Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 24, 2024
1 parent 1c80740 commit 2774b3c
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 31 deletions.
8 changes: 3 additions & 5 deletions chain/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"github.com/ava-labs/avalanchego/snow/choices"
"github.com/ava-labs/avalanchego/snow/consensus/snowman"
"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
"github.com/ava-labs/avalanchego/snow/validators"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/avalanchego/x/merkledb"
"go.opentelemetry.io/otel/attribute"
Expand Down Expand Up @@ -100,8 +99,7 @@ type StatelessBlock struct {
bytes []byte
txsSet set.Set[ids.ID]

bctx *block.Context
vdrState validators.State
bctx *block.Context

results []*Result
feeManager *fees.Manager
Expand Down Expand Up @@ -257,7 +255,7 @@ func (b *StatelessBlock) initializeBuilt(
func (b *StatelessBlock) ID() ids.ID { return b.id }

// implements "block.WithVerifyContext"
func (b *StatelessBlock) ShouldVerifyWithContext(context.Context) (bool, error) {
func (*StatelessBlock) ShouldVerifyWithContext(context.Context) (bool, error) {
return false, nil
}

Expand Down Expand Up @@ -451,7 +449,7 @@ func (b *StatelessBlock) innerVerify(ctx context.Context, vctx VerifyContext) er
feeKey := FeeKey(b.vm.StateManager().FeeKey())
feeRaw, err := parentView.GetValue(ctx, feeKey)
if err != nil {
return err //nolint:spancheck
return err
}
parentFeeManager := fees.NewManager(feeRaw)
feeManager, err := parentFeeManager.ComputeNext(parentTimestamp, b.Tmstmp, r)
Expand Down
14 changes: 7 additions & 7 deletions examples/tokenvm/cmd/token-cli/cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ var fundFaucetCmd = &cobra.Command{
if err != nil {
return err
}
if _, err = sendAndWait(ctx, &actions.Transfer{
if err = sendAndWait(ctx, &actions.Transfer{
To: addr,
Asset: ids.Empty,
Value: amount,
Expand Down Expand Up @@ -119,7 +119,7 @@ var transferCmd = &cobra.Command{
}

// Generate transaction
_, err = sendAndWait(ctx, &actions.Transfer{
err = sendAndWait(ctx, &actions.Transfer{
To: recipient,
Asset: assetID,
Value: amount,
Expand Down Expand Up @@ -162,7 +162,7 @@ var createAssetCmd = &cobra.Command{
}

// Generate transaction
_, err = sendAndWait(ctx, &actions.CreateAsset{
err = sendAndWait(ctx, &actions.CreateAsset{
Symbol: []byte(symbol),
Decimals: uint8(decimals), // already constrain above to prevent overflow
Metadata: []byte(metadata),
Expand Down Expand Up @@ -226,7 +226,7 @@ var mintAssetCmd = &cobra.Command{
}

// Generate transaction
_, err = sendAndWait(ctx, &actions.MintAsset{
err = sendAndWait(ctx, &actions.MintAsset{
Asset: assetID,
To: recipient,
Value: amount,
Expand Down Expand Up @@ -263,7 +263,7 @@ var closeOrderCmd = &cobra.Command{
}

// Generate transaction
_, err = sendAndWait(ctx, &actions.CloseOrder{
err = sendAndWait(ctx, &actions.CloseOrder{
Order: orderID,
Out: outAssetID,
}, cli, scli, tcli, factory, true)
Expand Down Expand Up @@ -349,7 +349,7 @@ var createOrderCmd = &cobra.Command{
}

// Generate transaction
_, err = sendAndWait(ctx, &actions.CreateOrder{
err = sendAndWait(ctx, &actions.CreateOrder{
In: inAssetID,
InTick: inTick,
Out: outAssetID,
Expand Down Expand Up @@ -466,7 +466,7 @@ var fillOrderCmd = &cobra.Command{
if err != nil {
return err
}
_, err = sendAndWait(ctx, &actions.FillOrder{
err = sendAndWait(ctx, &actions.FillOrder{
Order: order.ID,
Owner: owner,
In: inAssetID,
Expand Down
15 changes: 7 additions & 8 deletions examples/tokenvm/cmd/token-cli/cmd/resolutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"fmt"
"reflect"

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/hypersdk/chain"
"github.com/ava-labs/hypersdk/cli"
"github.com/ava-labs/hypersdk/codec"
Expand All @@ -23,27 +22,27 @@ import (
func sendAndWait(
ctx context.Context, action chain.Action, cli *rpc.JSONRPCClient,
scli *rpc.WebSocketClient, tcli *trpc.JSONRPCClient, factory chain.AuthFactory, printStatus bool,
) (ids.ID, error) {
) error {
parser, err := tcli.Parser(ctx)
if err != nil {
return ids.Empty, err
return err
}
_, tx, _, err := cli.GenerateTransaction(ctx, parser, action, factory)
if err != nil {
return ids.Empty, err
return err
}

if err := scli.RegisterTx(tx); err != nil {
return ids.Empty, err
return err
}
var res *chain.Result
for {
txID, dErr, result, err := scli.ListenTx(ctx)
if dErr != nil {
return ids.Empty, dErr
return dErr
}
if err != nil {
return ids.Empty, err
return err
}
if txID == tx.ID() {
res = result
Expand All @@ -54,7 +53,7 @@ func sendAndWait(
if printStatus {
handler.Root().PrintStatus(tx.ID(), res.Success)
}
return tx.ID(), nil
return nil
}

func handleTx(c *trpc.JSONRPCClient, tx *chain.Transaction, result *chain.Result) {
Expand Down
3 changes: 1 addition & 2 deletions examples/tokenvm/cmd/token-cli/cmd/spam.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ var runSpamCmd = &cobra.Command{
},
func(cli *rpc.JSONRPCClient, priv *cli.PrivateKey) func(context.Context, uint64) error { // submitDummy
return func(ictx context.Context, count uint64) error {
_, err := sendAndWait(ictx, &actions.Transfer{
return sendAndWait(ictx, &actions.Transfer{
To: priv.Address,
Value: count, // prevent duplicate txs
}, cli, sclient, tclient, auth.NewED25519Factory(ed25519.PrivateKey(priv.Bytes)), false)
return err
}
},
)
Expand Down
1 change: 0 additions & 1 deletion examples/tokenvm/cmd/token-wallet/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ func (b *Backend) collectBlocks() {
consumed = nconsumed

tx := blk.Txs[i]
actor := tx.Auth.Actor()
if !result.Success {
failTxs++
}
Expand Down
8 changes: 0 additions & 8 deletions vm/resolutions.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,6 @@ func (vm *VM) GetAuthBatchVerifier(authTypeID uint8, cores int, count int) (chai
return bv.GetBatchVerifier(cores, count), ok
}

func (vm *VM) cacheAuth(auth chain.Auth) {
bv, ok := vm.authEngine[auth.GetTypeID()]
if !ok {
return
}
bv.Cache(auth)
}

func (vm *VM) RecordBlockVerify(t time.Duration) {
vm.metrics.blockVerify.Observe(float64(t))
}
Expand Down

0 comments on commit 2774b3c

Please sign in to comment.