Skip to content

Commit

Permalink
code refactor
Browse files Browse the repository at this point in the history
* Remove custom types in favor of sdk.DecCoins

* Passing tests

* Update lint action

* More workflow updates

* Push current state

* Disable jailing

* patch keyring-backend issue

* A couple of small fixes

* WIP rc5 update, one additional failing test around slashing/jailing behavior. Regression likely related to crypto changes

* Clean up slashing function, slashing test failure due to jailing being disabled

* rm querier

* update encoding

* client and types

* various fixes

* move slashing and tally to keeper

* test fixes

* v0.40.0-rc6

* params and typos

* fix some lint stuff

* proto changes

* update files

* docker and update deps

* missing file

* codecov golint

Co-authored-by: Federico Kunze <[email protected]>
Co-authored-by: Federico Kunze <[email protected]>
  • Loading branch information
3 people authored Jan 6, 2021
1 parent 5c0dc16 commit b312667
Show file tree
Hide file tree
Showing 83 changed files with 2,135 additions and 4,699 deletions.
116 changes: 116 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
---
Language: Proto
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats:
- Delimiters:
- pb
Language: TextProto
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

32 changes: 25 additions & 7 deletions .codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,38 @@ coverage:
default:
threshold: 1% # allow this much decrease on project
app:
target: 80%
paths: "app/"

target: 70%
flags:
- app
modules:
target: 70%
flags:
- modules
changes: false

comment:
layout: "reach, diff, files"
behavior: default # update if exists else create new
require_changes: true

flags:
app:
paths:
- "app/"
modules:
paths:
- "x/"
- "!x/**/client/" # ignore client package

ignore:
- "docs"
- "*.md"
- "*.rst"
- "cmd/"
- "contrib/"
- "docs/"
- "networks/"
- "**/*.pb.go"
- "types/*.pb.go"
- "tests/*"
- "tests/**/*"
- "x/**/*.pb.go"
- "x/**/test_common.go"
- "scripts/"
- "contrib"
13 changes: 7 additions & 6 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,19 @@ jobs:
golangci:
name: golangci-lint
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
.mod
.sum
**/**.go
go.mod
go.sum
- uses: golangci/golangci-lint-action@master
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.28.3
version: v1.28
args: --timeout 10m
github-token: ${{ secrets.github_token }}
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
24 changes: 12 additions & 12 deletions .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -45,17 +45,17 @@ jobs:
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- name: test nondeterminism
run: |
make test-sim-nondeterminism
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

test-sim-import-export:
runs-on: ubuntu-latest
needs: Build
steps:
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -71,11 +71,11 @@ jobs:
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- name: test-sim-import-export
run: |
make test-sim-import-export
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

test-sim-after-import:
runs-on: ubuntu-latest
Expand All @@ -86,7 +86,7 @@ jobs:
echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -98,11 +98,11 @@ jobs:
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- name: test after import
run: |
make test-sim-after-import
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

test-sim-multi-seed-short:
runs-on: ubuntu-latest
Expand All @@ -112,7 +112,7 @@ jobs:
run: echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -124,8 +124,8 @@ jobs:
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- name: test-sim-multi-seed-short
run: |
make test-sim-multi-seed-short
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -27,7 +27,7 @@ jobs:
- name: test & coverage report creation
run: |
go test ./... -mod=readonly -timeout 12m -race -coverprofile=coverage.txt -covermode=atomic -tags='ledger test_ledger_mock'
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- name: filter out DONTCOVER
run: |
excludelist="$(find ./ -type f -name '*.go' | xargs grep -l 'DONTCOVER')"
Expand All @@ -38,12 +38,12 @@ jobs:
echo "Excluding ${filename} from coverage report..."
sed -i.bak "/$(echo $filename | sed 's/\//\\\//g')/d" coverage.txt
done
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
- uses: codecov/codecov-action@v1
with:
file: ./coverage.txt # optional
fail_ci_if_error: true
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF

integration-tests:
runs-on: ubuntu-latest
Expand All @@ -52,7 +52,7 @@ jobs:
run: echo "::add-path::$(go env GOPATH)/bin"
shell: bash
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- uses: technote-space/get-diff-action@v4
with:
SUFFIX_FILTER: |
.go
Expand All @@ -63,4 +63,4 @@ jobs:
- name: Test CLI integration
run: |
make test-build
if: "env.GIT_DIFF != ''"
if: env.GIT_DIFF
Loading

0 comments on commit b312667

Please sign in to comment.