Skip to content

Commit

Permalink
fix: fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
shiki-tak committed Jul 20, 2021
1 parent 44f7140 commit 577c2c0
Show file tree
Hide file tree
Showing 10 changed files with 875 additions and 57 deletions.
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,25 @@ require (
github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b
github.com/enigmampc/btcutil v1.0.3-0.20200723161021-e2fb6adb2a25
github.com/go-kit/kit v0.11.0
github.com/go-lintpack/lintpack v0.5.2 // indirect
github.com/gogo/gateway v1.1.0
github.com/gogo/protobuf v1.3.3
github.com/golang/mock v1.4.4
github.com/golang/protobuf v1.5.2
github.com/golangci/errcheck v0.0.0-20181223084120-ef45e06d44b6 // indirect
github.com/golangci/goconst v0.0.0-20180610141641-041c5f2b40f3 // indirect
github.com/golangci/gocyclo v0.0.0-20180528134321-2becd97e67ee // indirect
github.com/golangci/golangci-lint v1.41.1 // indirect
github.com/golangci/ineffassign v0.0.0-20190609212857-42439a7714cc // indirect
github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21 // indirect
github.com/google/gofuzz v1.2.0
github.com/gorilla/handlers v1.5.1
github.com/gorilla/mux v1.8.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/jmoiron/sqlx v1.2.1-0.20190826204134-d7d95172beb5 // indirect
github.com/klauspost/cpuid v1.2.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/line/iavl/v2 v2.0.0-init.1.0.20210602045707-fddfe1f85001
github.com/line/ostracon v0.34.9-0.20210610071151-a52812ac9add
Expand All @@ -47,6 +56,7 @@ require (
github.com/rakyll/statik v0.1.7
github.com/regen-network/cosmos-proto v0.3.1
github.com/rs/zerolog v1.23.0
github.com/shirou/gopsutil v0.0.0-20190901111213-e4ec7b275ada // indirect
github.com/spf13/afero v1.3.4 // indirect
github.com/spf13/cast v1.3.1
github.com/spf13/cobra v1.1.3
Expand All @@ -58,12 +68,15 @@ require (
github.com/tendermint/btcd v0.1.1
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.16.0
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa // indirect
github.com/ugorji/go v1.1.4 // indirect
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c
google.golang.org/grpc v1.39.0
google.golang.org/protobuf v1.27.1
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
gopkg.in/yaml.v2 v2.4.0
sourcegraph.com/sqs/pbtypes v0.0.0-20180604144634-d3ebe8f20ae4 // indirect
)

replace (
Expand Down
401 changes: 384 additions & 17 deletions go.sum

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions x/wasm/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package wasm

import (
"fmt"

"github.com/gogo/protobuf/proto"
"github.com/line/lfb-sdk/x/wasm/keeper"
"github.com/line/lfb-sdk/x/wasm/types"
Expand Down
5 changes: 2 additions & 3 deletions x/wasm/ibc.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
channeltypes "github.com/line/lfb-sdk/x/ibc/core/04-channel/types"
porttypes "github.com/line/lfb-sdk/x/ibc/core/05-port/types"
host "github.com/line/lfb-sdk/x/ibc/core/24-host"
"github.com/line/lfb-sdk/x/wasm/types"
wasmTypes "github.com/line/lfb-sdk/x/wasm/types"
wasmvmtypes "github.com/line/wasmvm/types"
)
Expand All @@ -21,7 +20,7 @@ type IBCHandler struct {
channelKeeper wasmTypes.ChannelKeeper
}

func NewIBCHandler(k wasmTypes.IBCContractKeeper, ck types.ChannelKeeper) IBCHandler {
func NewIBCHandler(k wasmTypes.IBCContractKeeper, ck wasmTypes.ChannelKeeper) IBCHandler {
return IBCHandler{keeper: k, channelKeeper: ck}
}

Expand Down Expand Up @@ -273,7 +272,7 @@ func ValidateChannelParams(channelID string) error {
return err
}
if channelSequence > math.MaxUint32 {
return sdkerrors.Wrapf(types.ErrMaxIBCChannels, "channel sequence %d is greater than max allowed transfer channels %d", channelSequence, math.MaxUint32)
return sdkerrors.Wrapf(wasmTypes.ErrMaxIBCChannels, "channel sequence %d is greater than max allowed transfer channels %d", channelSequence, math.MaxUint32)
}
return nil
}
10 changes: 1 addition & 9 deletions x/wasm/keeper/keeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ func TestCreateWithSimulation(t *testing.T) {

// then try to create it in non-simulation mode (should not fail)
ctx, keepers = CreateTestInput(t, false, SupportedFeatures, nil, nil)
accKeeper, keeper = keepers.AccountKeeper, keepers.WasmKeeper
accKeeper, keeper = keepers.AccountKeeper, keepers.ContractKeeper
contractID, err = keeper.Create(ctx, creator, wasmCode, "https://github.com/line/lfb-sdk/blob/main/x/wasm/keeper/testdata/hackatom.wasm", "any/builder:tag", nil)
require.NoError(t, err)
require.Equal(t, uint64(1), contractID)
Expand Down Expand Up @@ -287,11 +287,7 @@ func TestInstantiate(t *testing.T) {

gasAfter := ctx.GasMeter().GasConsumed()
if types.EnableGasVerification {
<<<<<<< HEAD
require.Equal(t, uint64(0x120ce), gasAfter-gasBefore)
=======
require.Equal(t, uint64(0x114c2), gasAfter-gasBefore)
>>>>>>> b8a676303... fix: apply review
}

// ensure it is stored properly
Expand Down Expand Up @@ -525,11 +521,7 @@ func TestExecute(t *testing.T) {
// make sure gas is properly deducted from ctx
gasAfter := ctx.GasMeter().GasConsumed()
if types.EnableGasVerification {
<<<<<<< HEAD
require.Equal(t, uint64(0x1186a), gasAfter-gasBefore)
=======
require.Equal(t, uint64(0x10c22), gasAfter-gasBefore)
>>>>>>> b8a676303... fix: apply review
}
// ensure bob now exists and got both payments released
bobAcct = accKeeper.GetAccount(ctx, bob)
Expand Down
8 changes: 4 additions & 4 deletions x/wasm/keeper/msg_dispatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
}
result = wasmvmtypes.SubcallResult{
Ok: &wasmvmtypes.SubcallResponse{
Events: sdkEventsToWasmVmEvents(events),
Events: sdkEventsToWasmVMEvents(events),
Data: responseData,
},
}
Expand Down Expand Up @@ -151,18 +151,18 @@ func (d MessageDispatcher) DispatchSubmessages(ctx sdk.Context, contractAddr sdk
return rsp, nil
}

func sdkEventsToWasmVmEvents(events []sdk.Event) []wasmvmtypes.Event {
func sdkEventsToWasmVMEvents(events []sdk.Event) []wasmvmtypes.Event {
res := make([]wasmvmtypes.Event, len(events))
for i, ev := range events {
res[i] = wasmvmtypes.Event{
Type: ev.Type,
Attributes: sdkAttributesToWasmVmAttributes(ev.Attributes),
Attributes: sdkAttributesToWasmVMAttributes(ev.Attributes),
}
}
return res
}

func sdkAttributesToWasmVmAttributes(attrs []abci.EventAttribute) []wasmvmtypes.EventAttribute {
func sdkAttributesToWasmVMAttributes(attrs []abci.EventAttribute) []wasmvmtypes.EventAttribute {
res := make([]wasmvmtypes.EventAttribute, len(attrs))
for i, attr := range attrs {
res[i] = wasmvmtypes.EventAttribute{
Expand Down
11 changes: 0 additions & 11 deletions x/wasm/keeper/proposal_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ import (
"github.com/line/lfb-sdk/x/wasm/types"
)

// governing contains a subset of the wasm keeper used by gov processes
type governing interface {
create(ctx sdk.Context, creator sdk.AccAddress, wasmCode []byte, source string, builder string, instantiateAccess *types.AccessConfig, authZ AuthorizationPolicy) (codeID uint64, err error)
instantiate(ctx sdk.Context, codeID uint64, creator, admin sdk.AccAddress, initMsg []byte, label string, deposit sdk.Coins, authZ AuthorizationPolicy) (sdk.AccAddress, []byte, error)
migrate(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, newCodeID uint64, msg []byte, authZ AuthorizationPolicy) (*sdk.Result, error)
setContractAdmin(ctx sdk.Context, contractAddress, caller, newAdmin sdk.AccAddress, authZ AuthorizationPolicy) error
PinCode(ctx sdk.Context, codeID uint64) error
UnpinCode(ctx sdk.Context, codeID uint64) error
updateContractStatus(ctx sdk.Context, contractAddress sdk.AccAddress, caller sdk.AccAddress, status types.ContractStatus, authZ AuthorizationPolicy) error
}

// NewWasmProposalHandler creates a new governance Handler for wasm proposals
func NewWasmProposalHandler(k decoratedKeeper, enabledProposalTypes []types.ProposalType) govtypes.Handler {
return NewWasmProposalHandlerX(NewGovPermissionKeeper(k), enabledProposalTypes)
Expand Down
Loading

0 comments on commit 577c2c0

Please sign in to comment.