Skip to content

Commit

Permalink
Merge branch 'main' into migrate_v1_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sontrinh16 authored Jun 1, 2024
2 parents b0dea14 + fda440d commit 75186b5
Show file tree
Hide file tree
Showing 144 changed files with 23,015 additions and 13,831 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/pr-go-mod-tidy-mocks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: "Checks dependencies and mocks generation"
on:
merge_group:
pull_request:
push:
branches:
- main

concurrency:
group: ci-${{ github.ref }}-pr-go-mod-tidy-mocks
cancel-in-progress: true

jobs:
go-mod-tidy:
name: Check go mod tidy
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Run go mod tidy
run: ./scripts/go-mod-tidy-all.sh
- name: Check for diffs
run: |
git diff --exit-code || {
echo "Please run './scripts/go-mod-tidy-all.sh' and commit the changes";
exit 1;
}
generate-mocks:
name: Check up to date mocks
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Generate mocks
run: make mocks
- name: Check for diffs
run: |
git diff --exit-code || {
echo "Please run 'make mocks' and commit the changes";
exit 1;
}
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ jobs:
name: "testnet-setup"
path: ./systemtests/testnet/
retention-days: 3
# - name: system tests v2
# if: env.GIT_DIFF
# run: |
# make test-system
- name: system tests v2
if: env.GIT_DIFF
run: |
make test-system
- uses: actions/upload-artifact@v3
if: failure()
with:
Expand Down
26 changes: 11 additions & 15 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,8 @@
run:
tests: true
timeout: 15m
sort-results: true
allow-parallel-runners: true
exclude-dir: testutil/testdata
skip-files:
- server/grpc/gogoreflection/fix_registration.go
- "fix_registration.go"
- ".*\\.pb\\.go$"
- ".*\\.pb\\.gw\\.go$"
- ".*\\.pulsar\\.go$"
- crypto/keys/secp256k1/internal/*
- types/coin_regex.go

build-tags:
build-tags:
- e2e
- ledger
- test_ledger_mock
Expand Down Expand Up @@ -46,6 +35,16 @@ linters:
- unused

issues:
exclude-dirs:
- testutil/testdata
exclude-files:
- server/grpc/gogoreflection/fix_registration.go
- "fix_registration.go"
- ".*\\.pb\\.go$"
- ".*\\.pb\\.gw\\.go$"
- ".*\\.pulsar\\.go$"
- crypto/keys/secp256k1/internal/*
- types/coin_regex.go
exclude-rules:
- text: "Use of weak random number generator"
linters:
Expand Down Expand Up @@ -141,11 +140,8 @@ linters-settings:
extra-rules: true
dogsled:
max-blank-identifiers: 6
maligned:
suggest-new: true
nolintlint:
allow-unused: false
allow-leading-space: true
require-explanation: true
require-specific: false
gosimple:
Expand Down
28 changes: 17 additions & 11 deletions CODING_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This document is an extension to [CONTRIBUTING](./CONTRIBUTING.md) and provides
* Code must be well structured:
* packages must have a limited responsibility (different concerns can go to different packages),
* types must be easy to compose,
* think about maintainbility and testability.
* think about maintainability and testability.
* "Depend upon abstractions, [not] concretions".
* Try to limit the number of methods you are exposing. It's easier to expose something later than to hide it.
* Take advantage of `internal` package concept.
Expand All @@ -18,11 +18,11 @@ This document is an extension to [CONTRIBUTING](./CONTRIBUTING.md) and provides
* Minimize code duplication.
* Limit third-party dependencies.

Performance:
### Performance

* Avoid unnecessary operations or memory allocations.

Security:
### Security

* Pay proper attention to exploits involving:
* gas usage
Expand All @@ -31,6 +31,12 @@ Security:
* code must be always deterministic
* Thread safety. If some functionality is not thread-safe, or uses something that is not thread-safe, then clearly indicate the risk on each level.

### Documentation

When writing code that is complex or relies on another piece of the code, it is advised to create a diagram or a flowchart to explain the logic. This will help other developers to understand the code and will also help you to understand the logic better.

The Cosmos SDK uses [Mermaid.js](https://mermaid.js.org/), you can find the documentation on how to use it [here](https://mermaid.js.org/intro/).

## Acceptance tests

Start the design by defining Acceptance Tests. The purpose of Acceptance Testing is to
Expand Down Expand Up @@ -108,14 +114,14 @@ The idea is you should be able to see the
error message and figure out exactly what failed.
Here is an example check:

```go
<some table>
for tcIndex, tc := range cases {
<some code>
resp, err := doSomething()
require.NoError(err)
require.Equal(t, tc.expected, resp, "should correctly perform X")
```
```go
<some table>
for tcIndex, tc := range cases {
<some code>
resp, err := doSomething()
require.NoError(err)
require.Equal(t, tc.expected, resp, "should correctly perform X")
```

## Quality Assurance

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ benchmark:
### Linting ###
###############################################################################

golangci_version=v1.56.2
golangci_version=v1.59.0

#? setup-pre-commit: Set pre-commit git hook
setup-pre-commit:
Expand Down
22 changes: 16 additions & 6 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,24 @@ The Cosmos-SDK follows both [0ver](https://0ver.org/) and [Semver](https://semve

Although we adhere to semantic versioning (semver), we have introduced a few modifications to accommodate the unique characteristics of blockchains. One significant divergence is that the major version (Y.x.x) is incremented solely when a consensus-breaking change occurs. On the other hand, the minor version (x.Y.x) is increased when there is a non-consensus-breaking alteration that also results in an incompatible API change. Patch versions will be bumped for all other changes that dont break the API nor Consensus.

<p align="center">
<img src="docs/semver.png?raw=true" alt="Releases Semver decision tree" width="40%" />
</p>
```mermaid
flowchart TD
A[Change] --> B{Consensus Breaking?}
B -->|Yes| C[Increase Major Version]
B -->|No| D{API Breaking?}
D -->|Yes| E[Increase Minor Version]
D -->|No| F[Increase Patch Version]
```

## 0ver Dependencies

In terms of the Cosmos-SDK dependency, we adhere to a simpler versioning approach known as 0ver. This flow differs from the previous Semver flow. Under this system, when a consensus-breaking change or an API-breaking change occurs, the Cosmos-SDK team increments the minor version (x.Y.x). Conversely, when a non-consensus-breaking change and a non-API-breaking change take place, the team bumps the patch version (x.x.Y).

<p align="center">
<img src="docs/0ver.png?raw=true" alt="Releases 0ver decision tree" width="40%" />
</p>
```mermaid
flowchart TD
A[Change] --> B{Consensus Breaking?}
B -->|Yes| C[Increase Minor Version]
B -->|No| D{API Breaking?}
D -->|Yes| E[Increase Minor Version]
D -->|No| F[Increase Patch Version]
```
11 changes: 3 additions & 8 deletions RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ v1.0.0-beta1 → v1.0.0-beta2 → ... → v1.0.0-rc1 → v1.0.0-rc2 → ... →
* create a new annotated git tag (eg `git -a v1.1.0`) in the release branch.
* Create a GitHub release.

Following _semver_ philosophy, point releases after `v1.0`:

* must not break API
* can break consensus

Before `v1.0`, point release can break both point API and consensus.
See the [Releases document](./RELEASES.md) for more information on the versioning scheme.

## Patch Release Procedure

Expand Down Expand Up @@ -82,8 +77,8 @@ Major Release series is maintained in compliance with the **Stable Release Polic

Only the following major release series have a stable release status:

* **0.47** is the previous major release and is supported until the release of **0.51.0**. A fairly strict **bugfix-only** rule applies to pull requests that are requested to be included into a not latest stable point-release.
* **0.50** is the last major release and is supported until the release of **0.52.0**.
* **0.47** is the previous major release and is supported until the release of **0.52.0**. A fairly strict **bugfix-only** rule applies to pull requests that are requested to be included into a not latest stable point-release.
* **0.50** is the last major release and is supported until the release of **0.54.0**.

The SDK team maintains the last two major releases, any other major release is considered to have reached end of life.
The SDK team will not backport any bug fixes to releases that are not supported.
Expand Down
Loading

0 comments on commit 75186b5

Please sign in to comment.