Skip to content

Commit

Permalink
Merge branch 'son/timeout_height_time_based' of https://github.com/co…
Browse files Browse the repository at this point in the history
…smos/cosmos-sdk into son/timeout_height_time_based
  • Loading branch information
sontrinh16 committed Jul 29, 2024
2 parents 4c6c03f + 48c0c5f commit ff273d1
Show file tree
Hide file tree
Showing 183 changed files with 2,928 additions and 703 deletions.
3 changes: 2 additions & 1 deletion .github/.codespellignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ keypair
pastTime
hasTables
Nam
EyT
EyT
upTo
67 changes: 29 additions & 38 deletions .github/workflows/sims-052.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ concurrency:

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout to fetch code
runs-on: large-sdk-runner
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v4
Expand All @@ -25,26 +27,9 @@ jobs:
check-latest: true
- run: make build

install-runsim:
permissions:
contents: none
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary

test-sim-import-export:
runs-on: ubuntu-latest
needs: [build, install-runsim]
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
Expand All @@ -54,17 +39,14 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-import-export
run: |
make test-sim-import-export
test-sim-after-import:
runs-on: ubuntu-latest
needs: [build, install-runsim]
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -73,17 +55,14 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: test-sim-after-import
run: |
make test-sim-after-import
test-sim-multi-seed-short:
runs-on: ubuntu-latest
needs: [build, install-runsim]
test-sim-deterministic:
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -92,18 +71,30 @@ jobs:
with:
go-version: "1.22"
check-latest: true
- uses: actions/cache@v4
- name: test-sim-nondeterminism-streaming
run: |
make test-sim-nondeterminism-streaming
test-sim-multi-seed-short:
runs-on: large-sdk-runner
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
with:
ref: "release/v0.52.x"
- uses: actions/setup-go@v5
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
go-version: "1.22"
check-latest: true
- name: test-sim-multi-seed-short
run: |
make test-sim-multi-seed-short
sims-notify-success:
needs:
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
runs-on: ubuntu-latest
runs-on: large-sdk-runner
if: ${{ success() }}
steps:
- uses: actions/checkout@v4
Expand All @@ -130,7 +121,7 @@ jobs:
contents: none
needs:
[test-sim-multi-seed-short, test-sim-after-import, test-sim-import-export]
runs-on: ubuntu-latest
runs-on: large-sdk-runner
if: ${{ failure() }}
steps:
- name: Notify Slack on failure
Expand Down
30 changes: 20 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -357,14 +357,6 @@ jobs:
run: |
cd core/testing
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./...
- name: sonarcloud
if: ${{ env.GIT_DIFF && !github.event.pull_request.draft && env.SONAR_TOKEN != null }}
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
projectBaseDir: core/testing/
test-depinject:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -544,7 +536,7 @@ jobs:
if: env.GIT_DIFF
run: |
cd simapp
go test -mod=readonly -timeout 30m -coverprofile=coverage.out -covermode=atomic -tags='norace ledger test_ledger_mock' ./...
go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./...
- name: tests simapp v1
if: env.GIT_DIFF
run: |
Expand All @@ -570,10 +562,28 @@ jobs:
go.sum
**/go.mod
**/go.sum
- name: tests simapp
if: env.GIT_DIFF
run: |
cd simapp/v2
go test -mod=readonly -timeout 30m -tags='norace ledger test_ledger_mock' ./...
- name: simapp-v2-smoke-test
if: env.GIT_DIFF
run: |
./scripts/simapp-v2-init.sh
COSMOS_BUILD_OPTIONS=v2 make install
./scripts/init-simapp-v2.sh
simdv2 start &
SIMD_PID=$!
cnt=0
while ! simdv2 query block --type=height 5; do
cnt=$((cnt + 1))
if [ $cnt -gt 30 ]; then
kill -9 "$SIMD_PID"
exit 1
fi
sleep 1
done
kill -9 "$SIMD_PID"
test-collections:
runs-on: ubuntu-latest
Expand Down
36 changes: 30 additions & 6 deletions .github/workflows/v2-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: v2 core Tests
name: v2 core Tests
on:
pull_request:
merge_group:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cd server/v2 && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock'
cd server/v2 && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock'
stf:
runs-on: ubuntu-latest
strategy:
Expand All @@ -60,9 +60,9 @@ jobs:
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cd server/v2/stf && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock'
appamanger:
cd server/v2/stf && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock'
appmanager:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -84,4 +84,28 @@ jobs:
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -covermode=atomic -tags='ledger test_ledger_mock'
cd server/v2/appmanager && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock'
cometbft:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
check-latest: true
cache: true
cache-dependency-path: go.sum
- uses: technote-space/get-diff-action@v6.1.2
id: git_diff
with:
PATTERNS: |
server/v2/cometbft/**/*.go
server/v2/cometbft/go.mod
server/v2/cometbft/go.sum
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
cd server/v2/cometbft && go test -mod=readonly -race -timeout 30m -tags='ledger test_ledger_mock'
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i

### Features

* (baseapp) [#20291](https://github.com/cosmos/cosmos-sdk/pull/20291) Simulate nested messages.
* (tests) [#20013](https://github.com/cosmos/cosmos-sdk/pull/20013) Introduce system tests to run multi node local testnet in CI
* (runtime) [#19953](https://github.com/cosmos/cosmos-sdk/pull/19953) Implement `core/transaction.Service` in runtime.
* (client) [#19905](https://github.com/cosmos/cosmos-sdk/pull/19905) Add grpc client config to `client.toml`.
Expand Down
35 changes: 34 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,39 @@ Note, always read the **SimApp** section for more information on application wir

## [Unreleased]

### BaseApp

#### Nested Messages Simulation

Now it is possible to simulate the nested messages of a message, providing developers with a powerful tool for
testing and predicting the behavior of complex transactions. This feature allows for a more comprehensive
evaluation of gas consumption, state changes, and potential errors that may occur when executing nested
messages. However, it's important to note that while the simulation can provide valuable insights, it does not
guarantee the correct execution of the nested messages in the future. Factors such as changes in the
blockchain state or updates to the protocol could potentially affect the actual execution of these nested
messages when the transaction is finally processed on the network.

For example, consider a governance proposal that includes nested messages to update multiple protocol
parameters. At the time of simulation, the blockchain state may be suitable for executing all these nested
messages successfully. However, by the time the actual governance proposal is executed (which could be days or
weeks later), the blockchain state might have changed significantly. As a result, while the simulation showed
a successful execution, the actual governance proposal might fail when it's finally processed.

By default, when simulating transactions, the gas cost of nested messages is not calculated. This means that
only the gas cost of the top-level message is considered. However, this behavior can be customized using the
`SetIncludeNestedMsgsGas` option when building the BaseApp. By providing a list of message types to this option,
you can specify which messages should have their nested message gas costs included in the simulation. This
allows for more accurate gas estimation for transactions involving specific message types that contain nested
messages, while maintaining the default behavior for other message types.

Here is an example on how `SetIncludeNestedMsgsGas` option could be set to calculate the gas of a gov proposal
nested messages:
```go
baseAppOptions = append(baseAppOptions, baseapp.SetIncludeNestedMsgsGas([]sdk.Message{&gov.MsgSubmitProposal{}}))
// ...
app.App = appBuilder.Build(db, traceStore, baseAppOptions...)
```

### SimApp

In this section we describe the changes made in Cosmos SDK' SimApp.
Expand Down Expand Up @@ -1262,4 +1295,4 @@ message MsgSetWithdrawAddress {
}
```

When clients interact with a node they are required to set a codec in in the grpc.Dial. More information can be found in this [doc](https://docs.cosmos.network/v0.46/run-node/interact-node.html#programmatically-via-go).
When clients interact with a node they are required to set a codec in the grpc.Dial. More information can be found in this [doc](https://docs.cosmos.network/v0.46/run-node/interact-node.html#programmatically-via-go).
Loading

0 comments on commit ff273d1

Please sign in to comment.