Skip to content

Commit

Permalink
Merge branch 'main' into hy/daemon-name-change
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega authored Feb 6, 2024
2 parents 06b5198 + e46c733 commit dad66fb
Show file tree
Hide file tree
Showing 43 changed files with 1,080 additions and 387 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,24 @@ jobs:
with:
version: latest
args: --timeout 10m --tests=false --skip-dirs="e2e"

protobuf:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/sedaprotocol/vrf-go
GITHUB_TOKEN: ${{ secrets.PAT }}
steps:
- uses: actions/checkout@v4
- name: Install Buf
uses: bufbuild/[email protected]
- name: Lint Proto
run: make proto-lint
- name: clang-format Check
uses: jidicula/[email protected]
with:
clang-format-version: 17
check: true
diff: true
extensions: .proto
path: proto
style: file
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ We also need some dependencies to make protobuf work for cosmos.
The `buf` tool.

- Linux:
- `curl -sSL https://github.com/bufbuild/buf/releases/download/v1.0.0-rc1/buf-Linux-x86_64 -o buf && chmod +x buf && sudo mv buf /usr/local/bin`
- `curl -sSL https://github.com/bufbuild/buf/releases/download/v1.28.1/buf-Linux-x86_64 -o buf && chmod +x buf && sudo mv buf /usr/local/bin`
- Macos:
- Using [brew](https://brew.sh/): `brew install bufbuild/buf/buf`
- Using [macports](https://www.macports.org/): `sudo port install buf`
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ lint:
### Protobuf ###
###############################################################################

proto-all: proto-gen proto-format proto-lint
proto-all: proto-gen proto-fmt proto-lint

proto-dep-install:
@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest
Expand All @@ -171,7 +171,7 @@ proto-update-deps:
@echo "Updating Protobuf dependencies"
@buf mod update ./proto

.PHONY: proto-gen proto-lint proto-update-deps
.PHONY: proto-gen proto-fmt proto-lint proto-update-deps

###############################################################################
## Tests ##
Expand Down
7 changes: 7 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"math/big"
"os"
"path/filepath"
"strconv"

"github.com/spf13/cast"

Expand Down Expand Up @@ -589,6 +590,12 @@ func NewApp(
panic(err)
}

if maxSize := os.Getenv("MAX_WASM_SIZE"); maxSize != "" {
// https://github.com/CosmWasm/wasmd#compile-time-parameters
val, _ := strconv.ParseInt(maxSize, 10, 32)
wasmtypes.MaxWasmSize = int(val) // default 819200 (800 * 1024)
}

/* =================================================== */
/* TRANSFER STACK */
/* =================================================== */
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.1 // indirect
mvdan.cc/gofumpt v0.5.0 // indirect
nhooyr.io/websocket v1.8.6 // indirect
pgregory.net/rapid v1.1.0 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1787,6 +1787,8 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
mvdan.cc/gofumpt v0.5.0 h1:0EQ+Z56k8tXjj/6TQD25BFNKQXpCvT0rnansIc7Ug5E=
mvdan.cc/gofumpt v0.5.0/go.mod h1:HBeVDtMKRZpXyxFciAirzdKklDlGu8aAy1wEbH5Y9js=
nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw=
Expand Down
13 changes: 4 additions & 9 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ github.com/Shopify/goreferrer v0.0.0-20220729165902-8cddb4f5de06/go.mod h1:7erjK
github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o=
github.com/aclements/go-gg v0.0.0-20170118225347-6dbb4e4fefb0/go.mod h1:55qNq4vcpkIuHowELi5C8e+1yUHtoLoOUR9QU5j7Tes=
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY=
github.com/acomagu/bufpipe v1.0.4/go.mod h1:mxdxdup/WdsKVreO5GpW4+M/1CE2sMG4jeGJ2sYmHc4=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
github.com/ajstarks/svgo v0.0.0-20210923152817-c3b6e2f0c527/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw=
Expand All @@ -297,10 +296,8 @@ github.com/alingse/asasalint v0.0.11/go.mod h1:nCaoMhw7a9kSJObvQyVzNTPBDbNpdocqr
github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ashanbrown/forbidigo v1.5.1/go.mod h1:Y8j9jy9ZYAEHXdu723cUlraTqbzjKF1MUyfOKL+AjcU=
github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI=
github.com/aws/aws-sdk-go-v2 v1.21.2/go.mod h1:ErQhvNuEMhJjweavOYhxVkn2RUx7kQXVATHrjKtxIpM=
Expand Down Expand Up @@ -352,8 +349,6 @@ github.com/chromedp/sysutil v1.0.0/go.mod h1:kgWmDdq8fTzXYcKIBqIYvRRTnYb9aNS9moA
github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY=
github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic=
github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/cloudflare/circl v1.1.0/go.mod h1:prBCrKB9DV4poKZY1l9zBXg2QJY7mvgRvtMxxK7fi4I=
github.com/cloudflare/circl v1.3.1/go.mod h1:+CauBF6R70Jqcyl8N2hC8pAXYbWkGIezuSbuGLtRhnw=
github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA=
github.com/cloudflare/cloudflare-go v0.79.0/go.mod h1:gkHQf9xEubaQPEuerBuoinR9P8bf8a05Lq0X6WKy1Oc=
github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
Expand Down Expand Up @@ -444,7 +439,6 @@ github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w
github.com/ghemawat/stream v0.0.0-20171120220530-696b145b53b9/go.mod h1:106OIgooyS7OzLDOpUGgm9fA3bQENb/cFSyyBmMoJDs=
github.com/gin-contrib/sse v0.0.0-20190301062529-5545eab6dad3/go.mod h1:VJ0WA2NBN22VlZ2dKZQPAPnyWw5XTlK1KymzLKsr59s=
github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/3rZdM=
github.com/gliderlabs/ssh v0.3.5/go.mod h1:8XB4KraRrX39qHhT6yxPsHedjA08I/uBVwj4xC+/+z4=
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs=
github.com/go-chi/chi/v5 v5.0.8/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
Expand Down Expand Up @@ -473,6 +467,7 @@ github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhO
github.com/go-playground/validator/v10 v10.10.0/go.mod h1:74x4gJWsvQexRdW8Pn3dXSGrTK4nAUsbPlLADvpJkos=
github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg=
github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls=
github.com/go-toolsmith/astcast v1.1.0/go.mod h1:qdcuFWeGGS2xX5bLM/c3U9lewg7+Zu4mr+xPwZIB4ZU=
Expand Down Expand Up @@ -684,7 +679,6 @@ github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXx
github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4=
github.com/mmcloughlin/addchain v0.4.0/go.mod h1:A86O+tHqZLMNO4w6ZZ4FlVQEadcoqkyU72HC5wJ4RlU=
github.com/mmcloughlin/avo v0.5.0/go.mod h1:ChHFdoV7ql95Wi7vuq2YT1bwCJqiWdZrQ1im3VujLYM=
github.com/mmcloughlin/profile v0.1.1/go.mod h1:IhHD7q1ooxgwTgjxQYkACGA77oFTDdFVejUS1/tS/qU=
github.com/moricho/tparallel v0.3.0/go.mod h1:leENX2cUv7Sv2qDgdi0D0fCftN8fRC67Bcn8pqzeYNI=
github.com/moul/http2curl v1.0.0/go.mod h1:8UbvGypXm98wA/IqH45anm5Y2Z6ep6O31QGOAZ3H0fQ=
Expand Down Expand Up @@ -753,7 +747,6 @@ github.com/quasilyte/go-ruleguard v0.4.0/go.mod h1:Eu76Z/R8IXtViWUIHkE3p8gdH3/PK
github.com/quasilyte/gogrep v0.5.0/go.mod h1:Cm9lpz9NZjEoL1tgZ2OgeUKPIxL1meE7eo60Z6Sk+Ng=
github.com/quasilyte/regex/syntax v0.0.0-20210819130434-b3f0c404a727/go.mod h1:rlzQ04UMyJXu/aOvhd8qT+hvDrFpiwqp8MRXDY9szc0=
github.com/quasilyte/stdinfo v0.0.0-20220114132959-f7386bf02567/go.mod h1:DWNGW8A4Y+GyBgPuaQJuWiy0XYftx4Xm/y5Jqk9I6VQ=
github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
Expand Down Expand Up @@ -917,6 +910,7 @@ golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.10.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190327091125-710a502c58a2/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
Expand Down Expand Up @@ -970,6 +964,7 @@ golang.org/x/sys v0.0.0-20220702020025-31831981b65f/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand Down Expand Up @@ -1016,7 +1011,7 @@ golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k=
golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ=
golang.org/x/tools v0.5.0/go.mod h1:N+Kgy78s5I24c24dU8OfWNEotWjutIs8SnJvn5IDq+k=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.9.1/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.8.0/go.mod h1:JxBZ99ISMI5ViVkT1tr6tdNmXeTrcpVSD3vZ1RsRdN4=
golang.org/x/tools v0.9.3/go.mod h1:owI94Op576fPu3cIGQeHs3joujW/2Oc6MtlxbF5dfNc=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk=
Expand Down
10 changes: 8 additions & 2 deletions interchaintest/chain_core_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"math"

"testing"
"time"

Expand Down Expand Up @@ -91,6 +90,7 @@ func TestCoreSDKCommands(t *testing.T) {
}

func testAuth(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain) {
t.Helper()
govAddr, err := chain.AuthQueryModuleAddress(ctx, "gov")
require.NoError(t, err)
require.NotEmpty(t, govAddr)
Expand Down Expand Up @@ -125,6 +125,7 @@ func testAuth(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain) {
}

func testUpgrade(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain) {
t.Helper()
v, err := chain.UpgradeQueryAllModuleVersions(ctx)
require.NoError(t, err)
require.NotEmpty(t, v)
Expand All @@ -142,6 +143,7 @@ func testUpgrade(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain) {
}

func testAuthz(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, users []ibc.Wallet) {
t.Helper()
granter := users[0].FormattedAddress()
grantee := users[1].FormattedAddress()

Expand Down Expand Up @@ -200,6 +202,7 @@ func testAuthz(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, use
}

func testBank(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, users []ibc.Wallet) {
t.Helper()
user0 := users[0].FormattedAddress()
user1 := users[1].FormattedAddress()
user2 := users[2].FormattedAddress()
Expand Down Expand Up @@ -250,6 +253,7 @@ func testBank(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, user
}

func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, users []ibc.Wallet) {
t.Helper()
var err error
node := chain.GetNode()
acc := authtypes.NewModuleAddress("distribution")
Expand Down Expand Up @@ -359,6 +363,7 @@ func testDistribution(ctx context.Context, t *testing.T, chain *cosmos.CosmosCha
}

func testFeeGrant(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, users []ibc.Wallet) {
t.Helper()
var err error
node := chain.GetNode()

Expand Down Expand Up @@ -418,6 +423,7 @@ func testFeeGrant(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain,
}

func testSlashing(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain) {
t.Helper()
p, err := chain.SlashingQueryParams(ctx)
require.NoError(t, err)
require.NotNil(t, p)
Expand All @@ -432,6 +438,7 @@ func testSlashing(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain)
}

func testStaking(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, users []ibc.Wallet) {
t.Helper()
vals, err := chain.StakingQueryValidators(ctx, stakingtypes.Bonded.String())
require.NoError(t, err)
require.NotEmpty(t, vals)
Expand Down Expand Up @@ -467,7 +474,6 @@ func testStaking(ctx context.Context, t *testing.T, chain *cosmos.CosmosChain, u
require.NoError(t, err)
require.NotEmpty(t, delVals)
require.True(t, delVals[0].OperatorAddress == val)

})

t.Run("misc", func(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion interchaintest/chain_start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestChainStart(t *testing.T) {
users := interchaintest.GetAndFundTestUsers(t, ctx, t.Name(), userFunds, chain)
chainUser := users[0]

conformance.ConformanceCosmWasm(t, ctx, chain, chainUser)
conformance.CosmWasm(t, ctx, chain, chainUser)

require.NotNil(t, ic)
require.NotNil(t, ctx)
Expand Down
27 changes: 25 additions & 2 deletions interchaintest/chain_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func TestChainUpgrade(t *testing.T) {
}

func BasicUpgradeTest(t *testing.T, upgradeVersion, upgradeRepo, upgradeName string) {
t.Helper()
if testing.Short() {
t.Skip("skipping in short mode")
}
Expand Down Expand Up @@ -80,17 +81,20 @@ func BasicUpgradeTest(t *testing.T, upgradeVersion, upgradeRepo, upgradeName str
UpgradeNodes(t, ctx, chain, client, haltHeight, upgradeRepo, upgradeVersion)

// test conformance after upgrade
conformance.ConformanceCosmWasm(t, ctx, chain, chainUser)
conformance.CosmWasm(t, ctx, chain, chainUser)
}

//revive:disable-next-line:context-as-argument
func UpgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, client *client.Client, haltHeight uint64, upgradeRepo, upgradeVersion string) {
t.Helper()
stopNodes(t, ctx, chain)
upgradeNodes(t, ctx, chain, client, upgradeRepo, upgradeVersion)
startNodes(t, ctx, chain)
waitForBlocks(t, ctx, chain)
checkHeight(t, ctx, chain, haltHeight)
}

//revive:disable-next-line:context-as-argument
func fundChainUser(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) ibc.Wallet {
t.Helper()
userFunds := math.NewInt(10_000_000_000)
Expand All @@ -115,28 +119,36 @@ func getTestGenesis() []cosmos.GenesisKV {
}
}

//revive:disable-next-line:context-as-argument
func stopNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
t.Log("stopping node(s)")
err := chain.StopAllNodes(ctx)
if err != nil {
t.Fatalf("error stopping node(s): %v", err)
}
}

//revive:disable-next-line:context-as-argument
func upgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, client *client.Client, upgradeRepo, upgradeVersion string) {
t.Helper()
t.Log("upgrading node(s)")
chain.UpgradeVersion(ctx, client, upgradeRepo, upgradeVersion)
}

//revive:disable-next-line:context-as-argument
func startNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
t.Log("starting node(s)")
err := chain.StartAllNodes(ctx)
if err != nil {
t.Fatalf("error starting upgraded node(s): %v", err)
}
}

//revive:disable-next-line:context-as-argument
func waitForBlocks(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain) {
t.Helper()
timeoutCtx, timeoutCtxCancel := context.WithTimeout(ctx, time.Second*60)
defer timeoutCtxCancel()

Expand All @@ -146,7 +158,9 @@ func waitForBlocks(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain)
}
}

//revive:disable-next-line:context-as-argument
func checkHeight(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, haltHeight uint64) {
t.Helper()
height, err := chain.Height(ctx)
if err != nil {
t.Fatalf("error fetching height after upgrade: %v", err)
Expand All @@ -157,7 +171,14 @@ func checkHeight(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, h
}
}

func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, proposalID string, currentHeight uint64, haltHeight uint64) {
// see https://github.com/golangci/golangci-lint/issues/741
// Ignore SA4009 throughout the file due to specific use case.
//
//nolint:staticcheck // SA4009 disable staticcheck since there is a bug where you can't ignore a single lint check:
//revive:disable-next-line:context-as-argument
func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, proposalID string, currentHeight, haltHeight uint64) {
t.Helper()

err := chain.VoteOnProposalAllValidators(ctx, proposalID, cosmos.ProposalVoteYes)
require.NoError(t, err, "failed to submit votes")

Expand Down Expand Up @@ -185,7 +206,9 @@ func ValidatorVoting(t *testing.T, ctx context.Context, chain *cosmos.CosmosChai
require.Equal(t, haltHeight, currentHeight, "height is not equal to halt height")
}

//revive:disable-next-line:context-as-argument
func SubmitUpgradeProposal(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet, upgradeName string) (uint64, string) {
t.Helper()
currentHeight, err := chain.Height(ctx)
require.NoError(t, err, "error fetching height before submit upgrade proposal")

Expand Down
7 changes: 5 additions & 2 deletions interchaintest/conformance/cosmwasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ import (
"github.com/sedaprotocol/seda-chain/interchaintest/types"
)

// ConformanceCosmWasm validates that store, instantiate, execute, and query work on a CosmWasm contract.
func ConformanceCosmWasm(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet) {
// CosmWasm validates that store, instantiate, execute, and query work on a CosmWasm contract.
//
//revive:disable-next-line:context-as-argument
func CosmWasm(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet) {
t.Helper()
basic(t, ctx, chain, user)
}

//revive:disable-next-line:context-as-argument
func basic(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, user ibc.Wallet) {
t.Helper()
_, contractAddr := helpers.SetupAndInstantiateContract(t, ctx, chain, user.KeyName(), "contracts/cw_template.wasm", `{"count":0}`)
Expand Down
Loading

0 comments on commit dad66fb

Please sign in to comment.