diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index c556ad45010..17e1673aac9 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -40,7 +40,7 @@ jobs: make build-docs - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@v4.6.8 + uses: JamesIves/github-pages-deploy-action@v4.7.2 with: branch: gh-pages folder: ~/output diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml index 66e913a023d..63a4a7f0486 100644 --- a/.github/workflows/docker-push.yml +++ b/.github/workflows/docker-push.yml @@ -40,13 +40,13 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5.5.1 + uses: docker/metadata-action@v5.6.1 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} flavor: "latest=false" - name: Build and push docker image - uses: docker/build-push-action@v6.9.0 + uses: docker/build-push-action@v6.10.0 with: context: . file: Dockerfile diff --git a/.github/workflows/release-sims.yml b/.github/workflows/release-sims.yml index 320989b7f6f..87673aee400 100644 --- a/.github/workflows/release-sims.yml +++ b/.github/workflows/release-sims.yml @@ -29,7 +29,7 @@ jobs: go-version: 1.22.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -40,7 +40,7 @@ jobs: steps: - name: install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -50,7 +50,7 @@ jobs: needs: [build, install-runsim] steps: - uses: actions/checkout@v4 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -72,7 +72,7 @@ jobs: **/**.go go.mod go.sum - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/sim-label.yml b/.github/workflows/sim-label.yml index e51c1a27712..8ba9f510459 100644 --- a/.github/workflows/sim-label.yml +++ b/.github/workflows/sim-label.yml @@ -20,7 +20,7 @@ jobs: go-version: 1.22.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -34,7 +34,7 @@ jobs: - uses: actions/setup-go@v5 with: go-version: 1.22.x - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index a8960a1d763..b210c688af0 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -24,7 +24,7 @@ jobs: go-version: 1.22.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -43,7 +43,7 @@ jobs: **/**.go go.mod go.sum - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -67,7 +67,7 @@ jobs: **/**.go go.mod go.sum - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -85,7 +85,7 @@ jobs: go-version: 1.22.x - name: Install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -96,7 +96,7 @@ jobs: steps: - name: install runsim run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary @@ -109,7 +109,7 @@ jobs: with: go-version: 1.22.x - uses: actions/checkout@v4 - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: ~/go/bin key: ${{ runner.os }}-go-runsim-binary diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 780e18ed384..0a285a34e17 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: **/go.sum **/Makefile Makefile - - uses: actions/cache@v4.1.1 + - uses: actions/cache@v4.2.0 with: path: | ~/.cache/go-build diff --git a/docs/docs/delegators/delegator-faq.md b/docs/docs/delegators/delegator-faq.md index 6432b219bcd..50fe61b2e4b 100644 --- a/docs/docs/delegators/delegator-faq.md +++ b/docs/docs/delegators/delegator-faq.md @@ -95,4 +95,4 @@ There is one main slashing condition: - **Double signing:** If someone reports on that a validator signed two different blocks with the same chain ID at the same height, this validator will get slashed. -This is why Atom holders should perform careful due diligence on validators before delegating. It is also important that delegators actively monitor the activity of their validators. If a validator behaves suspiciously or is too often offline, delegators can choose to unbond from them or switch to another validator. **Delegators can also mitigate risk by distributing their stake across multiple validators.**s +This is why Atom holders should perform careful due diligence on validators before delegating. It is also important that delegators actively monitor the activity of their validators. If a validator behaves suspiciously or is too often offline, delegators can choose to unbond from them or switch to another validator. **Delegators can also mitigate risk by distributing their stake across multiple validators.** diff --git a/docs/docs/delegators/delegator-security.md b/docs/docs/delegators/delegator-security.md index 261045aa36c..091e87a5b43 100644 --- a/docs/docs/delegators/delegator-security.md +++ b/docs/docs/delegators/delegator-security.md @@ -7,7 +7,7 @@ The launch of any public blockchain is an incredibly exciting time, and it's def ## Social Engineering -[Social engineering](https://en.wikipedia.org/wiki/Social_engineering_(security)) has existed for about as long as human beings have been on the planet, and in the technical era, it usually takes in the form of [phishing](https://ssd.eff.org/en/module/how-avoid-phishing-attacks) or [spearphishing](https://en.wikipedia.org/wiki/Phishing#Spear_phishing) . Both of these attacks are wildly successful forms of trickery that are responsible for over 95% of account security breaches, and they don't just happen via email: these days, opportunistic and targeted phishing attempts take place [anywhere that you have an inbox](https://www.umass.edu/it/security/phishing-fraudulent-emails-text-messages-phone-calls) . It doesn't matter if you're using Signal, Telegram, SMS, Twitter, or just checking your DMs on forums or social networks, attackers have a [plethora of opportunities](https://lucris.lub.lu.se/ws/portalfiles/portal/85420559/The_Weaponization_of_Social_Media_Bossetta_2018_.pdf) to gain foothold in your digital life in effort to separate you from valuable information and assets that you most definitely don't want to lose. If a deal pops up that [sounds too good to be true](https://www.psychologytoday.com/us/blog/mind-in-the-machine/201712/how-fear-is-being-used-manipulate-cryptocurrency-markets) , or a message shows up asking for information that should never, ever be shared with someone else, you can always verify it before engaging with it by navigating to our official website or an official Cosmos communication channel on your own. +[Social engineering](https://en.wikipedia.org/wiki/Social_engineering_(security)) has existed for about as long as human beings have been on the planet, and in the technical era, it usually takes in the form of [phishing](https://ssd.eff.org/en/module/how-avoid-phishing-attacks) or [spearphishing](https://en.wikipedia.org/wiki/Phishing#Spear_phishing) . Both of these attacks are wildly successful forms of trickery that are responsible for over 95% of account security breaches, and they don't just happen via email: these days, opportunistic and targeted phishing attempts take place [anywhere that you have an inbox](https://www.umass.edu/it/security/phishing-fraudulent-emails-text-messages-phone-calls) . It doesn't matter if you're using Signal, Telegram, SMS, Twitter, or just checking your DMs on forums or social networks, attackers have a [plethora of opportunities](https://lucris.lub.lu.se/ws/portalfiles/portal/85420559/The_Weaponization_of_Social_Media_Bossetta_2018_.pdf) to gain foothold in your digital life in an effort to separate you from valuable information and assets that you most definitely don't want to lose. If a deal pops up that [sounds too good to be true](https://www.psychologytoday.com/us/blog/mind-in-the-machine/201712/how-fear-is-being-used-manipulate-cryptocurrency-markets) , or a message shows up asking for information that should never, ever be shared with someone else, you can always verify it before engaging with it by navigating to our official website or an official Cosmos communication channel on your own. * **Be skeptical of unexpected attachments, or emails that ask you to visit a suspicious or unfamiliar website in the context of blockchains or cryptocurrency.** An attacker may attempt to lure you to a [compromised site](https://blog.malwarebytes.com/cybercrime/2013/02/tools-of-the-trade-exploit-kits/) designed to steal sensitive information from your computer. If you're a Gmail user, test your resilience against the latest email-based phishing tactics [here](https://phishingquiz.withgoogle.com/) . @@ -19,7 +19,7 @@ If you receive an email or tweet that sounds too good to be true, is likely to b ## Key Management -The best way to minimize the risk of theft or loss of ATOM is to have a strong storage and backup strategy for your private keys. The safest way to store your keys is offline, either in a cryptocurrency wallet or on a device that you never connect to the internet. The best backup strategy for your k yes is to ensure that you have multiple copies of them stored in safe places, and to take specific measures to protect at least one copy of your keys from any kind of natural disaster that is a likely possibility in your part of the world. +The best way to minimize the risk of theft or loss of ATOM is to have a strong storage and backup strategy for your private keys. The safest way to store your keys is offline, either in a cryptocurrency wallet or on a device that you never connect to the internet. The best backup strategy for your kyes is to ensure that you have multiple copies of them stored in safe places, and to take specific measures to protect at least one copy of your keys from any kind of natural disaster that is a likely possibility in your part of the world. **To protect your ATOM, do not share your 12 words with anyone.** The only person who should ever need to know them is you. You do not need to share your private keys if you're delegating ATOM to a validator on the network or to use custodial services. If anyone asks for your key material, diff --git a/docs/docs/governance/process.md b/docs/docs/governance/process.md index 06f5f9fce60..782e80b968c 100644 --- a/docs/docs/governance/process.md +++ b/docs/docs/governance/process.md @@ -21,7 +21,7 @@ The deposit period lasts either 14 days or until the proposal deposit totals 250 Prior to a governance proposal entering the voting period (i.e., for the proposal to be voted upon), there must be at least a minimum number of ATOMs deposited (250). Anyone may contribute to this deposit, though it is usually filled by the proposal maker. Deposits of passed and failed proposals are returned to the contributors. -In the past, different people have considered contributions amounts differently. There is some consensus that this should be a personal choice. There is also some consensus that this can be an opportunity for supporters to signal their support by adding to the deposit amount, so a proposer may choose to leave contribution room (i.e., a deposit below 250 ATOMs) so that others may participate. It is important to remember that any contributed ATOMs are at risk of being burned. +In the past, different people have considered contribution amounts differently. There is some consensus that this should be a personal choice. There is also some consensus that this can be an opportunity for supporters to signal their support by adding to the deposit amount, so a proposer may choose to leave contribution room (i.e., a deposit below 250 ATOMs) so that others may participate. It is important to remember that any contributed ATOMs are at risk of being burned. ### Burned deposits diff --git a/docs/docs/governance/proposal-types/text-prop.md b/docs/docs/governance/proposal-types/text-prop.md index 944cc211857..5e734a170a6 100644 --- a/docs/docs/governance/proposal-types/text-prop.md +++ b/docs/docs/governance/proposal-types/text-prop.md @@ -58,7 +58,7 @@ Enter proposal title: Title Enter proposal authors: Author Enter proposal summary: Proposal summary Enter proposal details: Details, all the details -Enter proposal proposal forum url: / +Enter proposal forum url: / Enter proposal vote option context: Vote yes if <...> Enter proposal deposit: 100001uatom ``` diff --git a/docs/docs/modules/lsm-staking.md b/docs/docs/modules/lsm-staking.md index ea7a394e9c1..e0dccf601f1 100644 --- a/docs/docs/modules/lsm-staking.md +++ b/docs/docs/modules/lsm-staking.md @@ -15,6 +15,6 @@ LSM shares are not fungible (as they are tied to a delegator/validator pair) and ## Benefits -By tokenizing your staked ATOM into LSM shares, you maintain the benefits of staking while gaining flexibility in using these shares in DeFi protcols and platforms. +By tokenizing your staked ATOM into LSM shares, you maintain the benefits of staking while gaining flexibility in using these shares in DeFi protocols and platforms. -The LSM shares issued by the Hub are powering liquid staking derivatives like stATOM or dATOM and they are the backbone of the Hydro plaftorm. +The LSM shares issued by the Hub are powering liquid staking derivatives like stATOM or dATOM and they are the backbone of the Hydro platform. diff --git a/go.mod b/go.mod index b1090880f92..005211a3b5d 100644 --- a/go.mod +++ b/go.mod @@ -6,10 +6,10 @@ toolchain go1.22.9 require ( cosmossdk.io/api v0.7.5 - cosmossdk.io/client/v2 v2.0.0-beta.3 + cosmossdk.io/client/v2 v2.0.0-beta.6 cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.4.1 + cosmossdk.io/log v1.5.0 cosmossdk.io/math v1.4.0 cosmossdk.io/simapp v0.0.0-20240118210941-3897926e722e cosmossdk.io/store v1.1.1 @@ -22,7 +22,7 @@ require ( github.com/CosmWasm/wasmd v0.53.0 github.com/cometbft/cometbft v0.38.15 github.com/cometbft/cometbft-db v0.14.1 - github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/cosmos-db v1.1.0 github.com/cosmos/cosmos-sdk v0.50.10 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.7.0 @@ -41,7 +41,7 @@ require ( github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.19.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 ) require ( @@ -77,14 +77,18 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/bits-and-blooms/bitset v1.8.0 // indirect + github.com/bytedance/sonic v1.12.3 // indirect + github.com/bytedance/sonic/loader v0.2.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect + github.com/cloudwego/base64x v0.1.4 // indirect + github.com/cloudwego/iasm v0.2.0 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.1 // indirect + github.com/cockroachdb/pebble v1.1.2 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect @@ -162,6 +166,7 @@ require ( github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/klauspost/compress v1.17.9 // indirect + github.com/klauspost/cpuid/v2 v2.0.9 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.9 // indirect @@ -206,6 +211,7 @@ require ( github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect github.com/tidwall/btree v1.7.0 // indirect + github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect @@ -221,6 +227,7 @@ require ( go.opentelemetry.io/otel/trace v1.24.0 // indirect go.uber.org/mock v0.4.0 // indirect go.uber.org/multierr v1.11.0 // indirect + golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect golang.org/x/crypto v0.28.0 // indirect golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect golang.org/x/net v0.30.0 // indirect diff --git a/go.sum b/go.sum index f9634902593..266c9b2f6c0 100644 --- a/go.sum +++ b/go.sum @@ -190,8 +190,8 @@ cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuW cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/client/v2 v2.0.0-beta.3 h1:+TTuH0DwQYsUq2JFAl3fDZzKq5gQG7nt3dAattkjFDU= -cosmossdk.io/client/v2 v2.0.0-beta.3/go.mod h1:CZcL41HpJPOOayTCO28j8weNBQprG+SRiKX39votypo= +cosmossdk.io/client/v2 v2.0.0-beta.6 h1:CygEwABxbwFmqgLINBb3WGVwzaN4yRgB9ZtIGQzhRNQ= +cosmossdk.io/client/v2 v2.0.0-beta.6/go.mod h1:4p0P6o0ro+FizakJUYS9SeM94RNbv0thLmkHRw5o5as= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.11.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= @@ -200,8 +200,8 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= -cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= +cosmossdk.io/log v1.5.0 h1:dVdzPJW9kMrnAYyMf1duqacoidB9uZIl+7c6z0mnq0g= +cosmossdk.io/log v1.5.0/go.mod h1:Tr46PUJjiUthlwQ+hxYtUtPn4D/oCZXAkYevBeh5+FI= cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= cosmossdk.io/simapp v0.0.0-20240118210941-3897926e722e h1:prrEM8wTWf6Rv0XchutuUtWfWlQHG4G3OylkTYgPlNk= @@ -341,6 +341,11 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bytedance/sonic v1.12.3 h1:W2MGa7RCU1QTeYRTPE3+88mVC0yXmsRQRChiyVocVjU= +github.com/bytedance/sonic v1.12.3/go.mod h1:B8Gt/XvtZ3Fqj+iSKMypzymZxw/FVwgIGKzMzT9r/rk= +github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= +github.com/bytedance/sonic/loader v0.2.0 h1:zNprn+lsIP06C/IqCHs3gPQIvnvpKbbxyXQP1iU4kWM= +github.com/bytedance/sonic/loader v0.2.0/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= @@ -369,6 +374,10 @@ github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= +github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= +github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= +github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= +github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -389,8 +398,8 @@ github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/e github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= -github.com/cockroachdb/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= -github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= +github.com/cockroachdb/pebble v1.1.2 h1:CUh2IPtR4swHlEj48Rhfzw6l/d0qA31fItcIszQVIsA= +github.com/cockroachdb/pebble v1.1.2/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= @@ -417,8 +426,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= -github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= +github.com/cosmos/cosmos-db v1.1.0 h1:KLHNVQ73h7vawXTpj9UJ7ZR2IXv51tsEHkQJJ9EBDzI= +github.com/cosmos/cosmos-db v1.1.0/go.mod h1:t7c4A6cfGdpUwwVxrQ0gQLeRQqGUBJu0yvE4F/26REg= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/cosmos-sdk v0.50.10-lsm h1:dG93GkIfZjOyYIDj3jrpFuMjkpiqVqH5CtxSoBqNtvY= @@ -924,8 +933,11 @@ github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrD github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= +github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -1250,8 +1262,9 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= @@ -1270,6 +1283,8 @@ github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITn github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= +github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= +github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/ugorji/go v1.2.7 h1:qYhyWUUd6WbiM+C6JZAUkIJt/1WrjzNHY9+KCIjVqTo= @@ -1358,6 +1373,8 @@ go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= +golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -2034,6 +2051,7 @@ honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9 honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= pgregory.net/rapid v1.1.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= diff --git a/tests/interchain/README.md b/tests/interchain/README.md index 90ae60ee125..2ebd88e6a82 100644 --- a/tests/interchain/README.md +++ b/tests/interchain/README.md @@ -9,7 +9,7 @@ You can build a docker image using the [docker-push](../../.github/workflows/doc `docker-push` runs nightly on the `main` branch, and for all new releases, but you can also [run it manually on any branch](https://github.com/cosmos/gaia/actions/workflows/docker-push.yml) -Once the `gaia` image is built, the `docker-push` action workflow automatically invoke the +Once the `gaia` image is built, the `docker-push` action workflow automatically invokes the [interchain-test](../../.github/workflows/interchain-test.yml) workflow. Read on to learn how these tests work. diff --git a/tests/interchain/delegator/evidence_test.go b/tests/interchain/delegator/evidence_test.go new file mode 100644 index 00000000000..520e0b01f77 --- /dev/null +++ b/tests/interchain/delegator/evidence_test.go @@ -0,0 +1,62 @@ +package delegator_test + +import ( + "testing" + "time" + + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/delegator" + "github.com/strangelove-ventures/interchaintest/v8" + "github.com/strangelove-ventures/interchaintest/v8/testutil" + "github.com/stretchr/testify/suite" +) + +type EvidenceSuite struct { + *delegator.Suite +} + +func (s *EvidenceSuite) TestDoubleSigning() { + from, to := 0, 3 + privkey, err := s.Chain.Validators[from].PrivValFileContent(s.GetContext()) + s.Require().NoError(err) + s.Require().NoError(s.Chain.Validators[to].OverwritePrivValFile(s.GetContext(), privkey)) + + s.Require().NoError(s.Chain.StopAllNodes(s.GetContext())) + + s.Require().NoError(s.Chain.Validators[to].CreateNodeContainer(s.GetContext())) + s.Require().NoError(s.Chain.Validators[to].StartContainer(s.GetContext())) + time.Sleep(10 * time.Second) + s.Require().NoError(s.Chain.Validators[from].CreateNodeContainer(s.GetContext())) + s.Require().NoError(s.Chain.Validators[from].StartContainer(s.GetContext())) + time.Sleep(10 * time.Second) + + for i := 0; i < len(s.Chain.Validators); i++ { + if i == from || i == to { + continue + } + s.Require().NoError(s.Chain.Validators[i].CreateNodeContainer(s.GetContext())) + s.Require().NoError(s.Chain.Validators[i].StartContainer(s.GetContext())) + } + s.Require().NoError(testutil.WaitForBlocks(s.GetContext(), 5, s.Chain)) + + evidence, err := s.Chain.QueryJSON(s.GetContext(), "evidence", "evidence", "list") + s.Require().NoError(err) + s.Require().NotEmpty(evidence.Array()) + valcons := evidence.Get("0.value.consensus_address").String() + s.Require().NotEmpty(valcons) + s.Require().Equal(s.Chain.ValidatorWallets[from].ValConsAddress, valcons) +} + +func TestEvidence(t *testing.T) { + nodes := 4 + s := &EvidenceSuite{ + Suite: &delegator.Suite{Suite: chainsuite.NewSuite(chainsuite.SuiteConfig{ + UpgradeOnSetup: true, + ChainSpec: &interchaintest.ChainSpec{ + NumValidators: &nodes, + }, + })}, + } + suite.Run(t, s) + +} diff --git a/tests/interchain/delegator/gov_test.go b/tests/interchain/delegator/gov_test.go new file mode 100644 index 00000000000..a617f21fed8 --- /dev/null +++ b/tests/interchain/delegator/gov_test.go @@ -0,0 +1,237 @@ +package delegator_test + +import ( + "encoding/json" + "fmt" + "strconv" + "testing" + + sdkmath "cosmossdk.io/math" + "github.com/stretchr/testify/suite" + "github.com/tidwall/gjson" + "github.com/tidwall/sjson" + + "github.com/cosmos/gaia/v21/tests/interchain/chainsuite" + "github.com/cosmos/gaia/v21/tests/interchain/delegator" + "github.com/strangelove-ventures/interchaintest/v8" + "github.com/strangelove-ventures/interchaintest/v8/ibc" +) + +const ( + stakeAmount = "10000000" // 10 ATOM + submissionDeposit = "100" + proposalDepositInt = chainsuite.GovMinDepositAmount + communityPoolAmount = "200000000" // 200 ATOM + yesWeight = 0.6 + noWeight = 0.3 + abstainWeight = 0.06 + vetoWeight = 0.04 + queryScaleMultiplier = 1000000000000000000 // 18 zeroes +) + +type GovSuite struct { + *delegator.Suite +} + +func (s *GovSuite) SetupSuite() { + s.Suite.SetupSuite() + // Delegate >1 ATOM with delegator account + node := s.Chain.GetNode() + node.StakingDelegate(s.GetContext(), s.DelegatorWallet.KeyName(), s.Chain.ValidatorWallets[0].ValoperAddress, string(stakeAmount)+s.Chain.Config().Denom) + node.StakingDelegate(s.GetContext(), s.DelegatorWallet2.KeyName(), s.Chain.ValidatorWallets[0].ValoperAddress, string(stakeAmount)+s.Chain.Config().Denom) +} + +func (s *GovSuite) TestProposal() { + // Test: + // 1. Proposal submission + // 2. Proposal deposit + // 3. Vote + // 4. Weighted vote + + // Submit proposal + prop, err := s.Chain.BuildProposal(nil, "Test Proposal", "Test Proposal", "ipfs://CID", submissionDeposit+"uatom", s.DelegatorWallet.FormattedAddress(), false) + s.Require().NoError(err) + result, err := s.Chain.SubmitProposal(s.GetContext(), s.DelegatorWallet.KeyName(), prop) + s.Require().NoError(err) + proposalId := result.ProposalID + + // Get status + proposalIDuint, err := strconv.ParseUint(proposalId, 10, 64) + proposal, err := s.Chain.GovQueryProposalV1(s.GetContext(), proposalIDuint) + s.Require().NoError(err) + + // Test submission + currentStatus := proposal.Status.String() + s.Require().Equal("PROPOSAL_STATUS_DEPOSIT_PERIOD", currentStatus) + + // Submit deposit to proposal + proposalDeposit := strconv.Itoa(proposalDepositInt) + node := s.Chain.GetNode() + _, err = node.ExecTx(s.GetContext(), s.DelegatorWallet.KeyName(), "gov", "deposit", proposalId, proposalDeposit+"uatom", "--gas", "auto") + s.Require().NoError(err) + submissionDepositUint, err := strconv.ParseUint(submissionDeposit, 10, 64) + s.Require().NoError(err) + depositTotal := proposalDepositInt + submissionDepositUint + + // Get status + proposalIDuint, err = strconv.ParseUint(proposalId, 10, 64) + proposal, err = s.Chain.GovQueryProposalV1(s.GetContext(), proposalIDuint) + s.Require().NoError(err) + currentStatus = proposal.Status.String() + + // Test deposit + deposit, err := s.Chain.QueryJSON(s.GetContext(), "deposit", "gov", "deposit", proposalId, s.DelegatorWallet.FormattedAddress()) + s.Require().NoError(err) + depositAmount := deposit.Get("amount.#(denom==\"uatom\").amount").String() + depositAmountUint, err := strconv.ParseUint(depositAmount, 10, 64) + s.Require().NoError(err) + s.Require().Equal("PROPOSAL_STATUS_VOTING_PERIOD", currentStatus) + s.Require().Equal(depositTotal, depositAmountUint) + + // Submit yes vote + _, err = node.ExecTx(s.GetContext(), s.DelegatorWallet.KeyName(), "gov", "vote", proposalId, "yes", "--gas", "auto") + s.Require().NoError(err) + + // Test vote + vote, err := s.Chain.QueryJSON(s.GetContext(), "vote", "gov", "vote", proposalId, s.DelegatorWallet.FormattedAddress()) + s.Require().NoError(err) + actual_yes_weight := vote.Get("options.#(option==\"VOTE_OPTION_YES\").weight") + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", actual_yes_weight.String()) + s.Require().Equal(float64(1.0), actual_yes_weight.Float()) + + // Submit weighted vote + _, err = node.ExecTx(s.GetContext(), s.DelegatorWallet2.KeyName(), "gov", "weighted-vote", proposalId, fmt.Sprintf("yes=%0.2f,no=%0.2f,abstain=%0.2f,no_with_veto=%0.2f", yesWeight, noWeight, abstainWeight, vetoWeight), "--gas", "auto") + s.Require().NoError(err) + + // Test weighted vote + vote, err = s.Chain.QueryJSON(s.GetContext(), "vote", "gov", "vote", proposalId, s.DelegatorWallet2.FormattedAddress()) + s.Require().NoError(err) + // chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", vote) + actual_yes_weight = vote.Get("options.#(option==\"VOTE_OPTION_YES\").weight") + // chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", actual_yes_weight.String()) + s.Require().Equal(float64(yesWeight), actual_yes_weight.Float()) + actual_no_weight := vote.Get("options.#(option==\"VOTE_OPTION_NO\").weight") + // chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", actual_no_weight.String()) + s.Require().Equal(float64(noWeight), actual_no_weight.Float()) + actual_abstain_weight := vote.Get("options.#(option==\"VOTE_OPTION_ABSTAIN\").weight") + // chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", actual_abstain_weight.String()) + s.Require().Equal(float64(abstainWeight), actual_abstain_weight.Float()) + actual_veto_weight := vote.Get("options.#(option==\"VOTE_OPTION_NO_WITH_VETO\").weight") + // chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", actual_veto_weight.String()) + s.Require().Equal(float64(vetoWeight), actual_veto_weight.Float()) +} + +func (s *GovSuite) TestParamChange() { + govParams, err := s.Chain.QueryJSON(s.GetContext(), "params", "gov", "params") + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Params: %s", govParams) + currentThreshold := govParams.Get("threshold").Float() + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Current threshold: %f", currentThreshold) + newThreshold := 0.6 + + authority, err := s.Chain.GetGovernanceAddress(s.GetContext()) + s.Require().NoError(err) + + updatedParams, err := sjson.Set(govParams.String(), "threshold", fmt.Sprintf("%f", newThreshold)) + s.Require().NoError(err) + updatedParams, err = sjson.Set(updatedParams, "expedited_voting_period", "10s") + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Updated params: %s", updatedParams) + + paramChangeMessage := fmt.Sprintf(`{ + "@type": "/cosmos.gov.v1.MsgUpdateParams", + "authority": "%s", + "params": %s + }`, authority, updatedParams) + + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Message: %s", paramChangeMessage) + + // Submit proposal + prop, err := s.Chain.BuildProposal(nil, "Gov Param Change Proposal", "Test Proposal", "ipfs://CID", chainsuite.GovDepositAmount, s.DelegatorWallet.KeyName(), false) + s.Require().NoError(err) + prop.Messages = []json.RawMessage{json.RawMessage(paramChangeMessage)} + result, err := s.Chain.SubmitProposal(s.GetContext(), s.DelegatorWallet.KeyName(), prop) + s.Require().NoError(err) + proposalId := result.ProposalID + + json, _, err := s.Chain.GetNode().ExecQuery(s.GetContext(), "gov", "proposal", proposalId) + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", string(json)) + + // Pass proposal + s.Require().NoError(s.Chain.PassProposal(s.GetContext(), proposalId)) + + // Test + govParams, err = s.Chain.QueryJSON(s.GetContext(), "params", "gov", "params") + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Params: %s", govParams) + currentThreshold = govParams.Get("threshold").Float() + s.Require().Equal(newThreshold, currentThreshold) +} + +func (s *GovSuite) TestGovFundCommunityPool() { + // Fund gov account + authority, err := s.Chain.GetGovernanceAddress(s.GetContext()) + s.Require().NoError(err) + err = s.Chain.SendFunds(s.GetContext(), interchaintest.FaucetAccountKeyName, ibc.WalletAmount{ + Denom: chainsuite.Uatom, + Amount: sdkmath.NewInt(250000000), + Address: authority, + }) + s.Require().NoError(err) + balance, err := s.Chain.GetBalance(s.GetContext(), authority, chainsuite.Uatom) + fmt.Println("Gov module balance:", balance) + + jsonMsg, _, err := s.Chain.GetNode().ExecQuery(s.GetContext(), "distribution", "community-pool") + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", string(jsonMsg)) + poolBalanceJson := gjson.Get(string(jsonMsg), "pool.#(%\"*uatom\")") + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Community pool balance: %s", poolBalanceJson.String()) + startingPoolBalance, err := chainsuite.StrToSDKInt(poolBalanceJson.String()) + s.Require().NoError(err) + + // Build proposal + fundMessage := fmt.Sprintf(`{ + "@type": "/cosmos.distribution.v1beta1.MsgFundCommunityPool", + "amount": [ + { + "denom": "uatom", + "amount": "%s" + } + ], + "depositor": "%s" + }`, communityPoolAmount, authority) + + // Submit proposal + prop, err := s.Chain.BuildProposal(nil, "Community Pool Funding Proposal", "Test Proposal", "ipfs://CID", chainsuite.GovDepositAmount, s.DelegatorWallet.FormattedAddress(), false) + s.Require().NoError(err) + prop.Messages = []json.RawMessage{json.RawMessage(fundMessage)} + result, err := s.Chain.SubmitProposal(s.GetContext(), s.DelegatorWallet.KeyName(), prop) + s.Require().NoError(err) + proposalId := result.ProposalID + + // Pass proposal + err = s.Chain.PassProposal(s.GetContext(), proposalId) + + jsonMsg, _, err = s.Chain.GetNode().ExecQuery(s.GetContext(), "distribution", "community-pool") + s.Require().NoError(err) + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("%s", string(jsonMsg)) + + // Test + poolBalanceJson = gjson.Get(string(jsonMsg), "pool.#(%\"*uatom\")") + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("Community pool balance: %s", poolBalanceJson.String()) + endingPoolBalance, err := chainsuite.StrToSDKInt(poolBalanceJson.String()) + s.Require().NoError(err) + balanceDifference := endingPoolBalance.Uint64() - startingPoolBalance.Uint64() + chainsuite.GetLogger(s.GetContext()).Sugar().Infof("The community pool balance increased by %d", balanceDifference) + fundAmount, err := strconv.ParseUint(communityPoolAmount, 10, 64) + s.Require().NoError(err) + s.Require().GreaterOrEqual(balanceDifference, fundAmount) +} + +func TestGov(t *testing.T) { + s := &GovSuite{Suite: &delegator.Suite{Suite: chainsuite.NewSuite(chainsuite.SuiteConfig{ + UpgradeOnSetup: true, + })}} + suite.Run(t, s) +} diff --git a/tests/interchain/go.mod b/tests/interchain/go.mod index f544a671594..0a9f78b8804 100644 --- a/tests/interchain/go.mod +++ b/tests/interchain/go.mod @@ -20,13 +20,14 @@ replace ( ) require ( - cosmossdk.io/math v1.3.0 + cosmossdk.io/math v1.4.0 github.com/cometbft/cometbft v0.38.11 github.com/cosmos/cosmos-sdk v0.50.9 github.com/cosmos/ibc-go/v8 v8.5.0 github.com/cosmos/interchain-security/v5 v5.1.1 github.com/docker/docker v27.1.2+incompatible github.com/google/go-github/v62 v62.0.0 + github.com/gorilla/websocket v1.5.3 github.com/kelseyhightower/envconfig v1.4.0 github.com/prometheus/client_model v0.6.1 github.com/prometheus/common v0.60.1 @@ -151,7 +152,6 @@ require ( github.com/googleapis/gax-go/v2 v2.13.0 // indirect github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/mux v1.8.1 // indirect - github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect diff --git a/tests/interchain/go.sum b/tests/interchain/go.sum index 19e12a84e88..b463a58705e 100644 --- a/tests/interchain/go.sum +++ b/tests/interchain/go.sum @@ -202,8 +202,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= +cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= cosmossdk.io/x/circuit v0.1.1 h1:KPJCnLChWrxD4jLwUiuQaf5mFD/1m7Omyo7oooefBVQ=