Skip to content

Commit

Permalink
Merge pull request #176
Browse files Browse the repository at this point in the history
Release v0.10.0
  • Loading branch information
bsrinivas8687 authored Jan 11, 2023
2 parents 810200f + e511467 commit ff59c35
Show file tree
Hide file tree
Showing 131 changed files with 2,921 additions and 3,384 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v2.3.4
- uses: actions/setup-go@v2.1.3
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.16
go-version: 1.19
- name: Run tests with coverage
run: make test-coverage
- name: Exclude files from coverage report
Expand All @@ -28,6 +28,6 @@ jobs:
echo "Excluding file ${filepath} from coverage report..."
sed -i "/$(echo ${filepath} | sed 's/\//\\\//g')/d" ./coverage.txt
done
- uses: codecov/codecov-action@v1.5.2
- uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
83 changes: 17 additions & 66 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,25 @@
# v1.27.0

run:
concurrency: 16
timeout: 5m
tests: false
allow-parallel-runners: true

linters-settings:
funlen:
lines: 180
statements: 120
gocritic:
enabled-tags:
- diagnostic
- experimental
- performance
- style
gocyclo:
min-complexity: 16
goimports:
local-prefixes: github.com/sentinel-official/hub

linters:
disable-all: true
enable:
- asciicheck
- bodyclose
- deadcode
- depguard
- dogsled
#- dupl
- errcheck
- funlen
#- gochecknoglobals
#- gochecknoinits
#- gocognit
#- goconst
#- gocritic
#- gocyclo
- godot
- godox
#- goerr113
- gofmt
- goimports
- golint
#- gomnd
- gomodguard
- goprintffuncname
- gosec
- gosimple
- govet
- ineffassign
- interfacer
#- lll
- maligned
- misspell
- nakedret
#- nestif
#- nolintlint
- prealloc
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- stylecheck
- testpackage
- typecheck
- unconvert
- unparam
disable:
- gochecknoglobals
- varnamelen
presets:
- bugs
- comment
- complexity
- error
- format
- import
- metalinter
- module
- performance
- sql
- style
- test
- unused
- varcheck
- whitespace
#- wsl
fast: false
20 changes: 5 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,13 @@ LD_FLAGS := -s -w \
benchmark:
@go test -mod=readonly -v -bench ${PACKAGES}

.PHONY: build
build:
GOOS=darwin GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelhub-${VERSION}-darwin-amd64 ./cmd/sentinelhub
GOOS=linux GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelhub-${VERSION}-linux-amd64 ./cmd/sentinelhub
GOOS=windows GOARCH=amd64 go build -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" \
-o ./build/sentinelhub-${VERSION}-windows-amd64.exe ./cmd/sentinelhub

.PHONY: clean
clean:
rm -rf ./bin ./vendor
rm -rf ./vendor

.PHONY: install
install: mod-vendor
go install -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" ./cmd/sentinelhub
install:
go install -mod=readonly -tags="${BUILD_TAGS}" -ldflags="${LD_FLAGS}" -trimpath ./cmd/sentinelhub

.PHONY: go-lint
go-lint:
Expand Down Expand Up @@ -60,7 +51,6 @@ test-coverage:

.PHONY: tools
tools:
@go install github.com/bufbuild/buf/cmd/[email protected]
@go install github.com/golangci/golangci-lint/cmd/[email protected]
@go install github.com/goware/[email protected]
@go install github.com/golangci/golangci-lint/cmd/[email protected]
@go install github.com/goware/[email protected]
@go install github.com/grpc-ecosystem/grpc-gateway/[email protected]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Installation

Requires [Go 1.16+](https://golang.org/dl/)
Requires [Go 1.19+](https://golang.org/dl/)

### Linux

Expand Down
56 changes: 56 additions & 0 deletions ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
package hub

import (
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/errors"
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
ibcante "github.com/cosmos/ibc-go/v3/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v3/modules/core/keeper"
)

type HandlerOptions struct {
authante.HandlerOptions
IBCKeeper *ibckeeper.Keeper
TxCounterStoreKey sdk.StoreKey
WasmConfig wasmtypes.WasmConfig
}

func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
if opts.AccountKeeper == nil {
return nil, errors.Wrap(errors.ErrLogic, "account keeper is required for ante handler")
}
if opts.BankKeeper == nil {
return nil, errors.Wrap(errors.ErrLogic, "bank keeper is required for ante handler")
}
if opts.SignModeHandler == nil {
return nil, errors.Wrap(errors.ErrLogic, "sign mode handler is required for ante handler")
}

var sigGasConsumer = opts.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = authante.DefaultSigVerificationGasConsumer
}

anteDecorators := []sdk.AnteDecorator{
authante.NewSetUpContextDecorator(),
wasmkeeper.NewLimitSimulationGasDecorator(opts.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(opts.TxCounterStoreKey),
authante.NewRejectExtensionOptionsDecorator(),
authante.NewMempoolFeeDecorator(),
authante.NewValidateBasicDecorator(),
authante.NewTxTimeoutHeightDecorator(),
authante.NewValidateMemoDecorator(opts.AccountKeeper),
authante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
authante.NewDeductFeeDecorator(opts.AccountKeeper, opts.BankKeeper, opts.FeegrantKeeper),
authante.NewSetPubKeyDecorator(opts.AccountKeeper),
authante.NewValidateSigCountDecorator(opts.AccountKeeper),
authante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer),
authante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler),
authante.NewIncrementSequenceDecorator(opts.AccountKeeper),
ibcante.NewAnteDecorator(opts.IBCKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
51 changes: 0 additions & 51 deletions ante_handler.go

This file was deleted.

Loading

0 comments on commit ff59c35

Please sign in to comment.