Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: upgrade ics to ibc-go/v7 and cosmos-sdk/v0.47 #918

Merged
merged 185 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from 177 commits
Commits
Show all changes
185 commits
Select commit Hold shift + click to select a range
74933f6
change ibc module paths
faddat Apr 21, 2023
f71e170
Squashed commit of the following:
faddat Apr 21, 2023
7df6152
Squashed commit of the following:
faddat Apr 21, 2023
60ab699
remove buf.work.yaml and don't tidy when building protos
faddat Apr 21, 2023
3c02c23
rebuild proto files
faddat Apr 21, 2023
29aa2d9
simapp, cometbft-db and cometbft
faddat Apr 21, 2023
be01b99
don't use rest and update ibc client types
faddat Apr 21, 2023
95285ce
tidy is successful
faddat Apr 21, 2023
2356e5b
resolve imports in app,go
faddat Apr 21, 2023
610c717
fix api change
vuong177 Apr 21, 2023
ee7ab46
apply change in gov and staking in 47
vuong177 Apr 22, 2023
7ff4cfe
init genesis in democracy module
vuong177 Apr 22, 2023
379e170
Merge branch 'main' into sdk-47-fifth-go-notional
faddat Apr 22, 2023
90a96d6
Merge pull request #2 from notional-labs/upgrade-ccv-module
faddat Apr 22, 2023
6959eb1
fixing build
sontrinh16 Apr 22, 2023
637ecd0
pull upstream
sontrinh16 Apr 22, 2023
08814ef
update code for 47
sontrinh16 Apr 22, 2023
3232541
Squashed commit of the following:
vuong177 Apr 22, 2023
4523f2f
change govtypes, update ccvstaking, ccvgov, ccvdistr newAppModule
sontrinh16 Apr 22, 2023
b41dc4b
update get content from MsgExecLegacyContent
sontrinh16 Apr 22, 2023
36aeac8
modufy check whitelist content
sontrinh16 Apr 22, 2023
7b37a38
update consumer and provider keeper hooks
sontrinh16 Apr 22, 2023
5fc20eb
update proof path
pysel Apr 23, 2023
c760d17
update Slash in staking keeper's signature
pysel Apr 23, 2023
abd1062
regenerate mocks for staking keeper
pysel Apr 23, 2023
558a14b
tidy
pysel Apr 23, 2023
e5e5a60
update provider hooks: return errors
pysel Apr 23, 2023
4341b1d
lint ccv/provider/keeper: sdkerrors + math.Int
pysel Apr 23, 2023
7c8ed57
ccv/consumer/keeper: pass correct args to Slash()
pysel Apr 23, 2023
4425c3e
ccv/consumer/keeper: lint: migrate to cosmossdk.io/(errors/math)
pysel Apr 23, 2023
5095a22
sdk.Int -> math.Int
pysel Apr 23, 2023
91e0fac
app: register newer GRPC services (https://github.com/cosmos/cosmos-s…
pysel Apr 23, 2023
76eabf4
consumer-democracy: new signature for NewApp() + remove invCheckPerio…
pysel Apr 23, 2023
378d86d
consumer: new signature for NewApp() + remove invCheckPeriod from App…
pysel Apr 23, 2023
6a60dbd
provider: new signature for NewApp() + remove invCheckPeriod from App…
pysel Apr 23, 2023
8d1df7a
Revert "ccv/consumer/keeper: pass correct args to Slash()"
pysel Apr 23, 2023
480c393
Revert "update Slash in staking keeper's signature"
pysel Apr 23, 2023
33ef3b3
Revert "regenerate mocks for staking keeper"
pysel Apr 23, 2023
7b7ac96
minor change
sontrinh16 Apr 23, 2023
96ed21d
pull upstream
sontrinh16 Apr 23, 2023
b22d85b
minor change
sontrinh16 Apr 23, 2023
5e44c0d
replace deprecated ibctranferkeeper func sendtransfer
sontrinh16 Apr 23, 2023
57e0877
x/ccv/types: sdk.Int -> math.Int, update sdkerrors path
pysel Apr 24, 2023
4479d85
regenerate mocks
pysel Apr 24, 2023
f696002
minor update mock
sontrinh16 Apr 24, 2023
9950a0a
remove all usage of rest
sontrinh16 Apr 24, 2023
36eb87e
slash functoin fix by fork sdk
vuong177 Apr 24, 2023
b4a000d
remove unnecessary SA1019 disabler
pysel Apr 24, 2023
c24a75f
global midration from sdkerrors to cosmossdk.io/errors
pysel Apr 24, 2023
341b9f4
Merge branch 'sdk-47-fifth-go-notional' into ruslan/wip-interchain-v47
pysel Apr 24, 2023
9e957fd
Merge pull request #3 from notional-labs/ruslan/wip-interchain-v47
pysel Apr 24, 2023
4175788
regenerate mocks: exclude transfertypes import
pysel Apr 24, 2023
6911e6a
simtypes.WeightedProposalContent -> WeightedProposalMsg. Deprecated
pysel Apr 24, 2023
02c17ac
go fmt file
pysel Apr 24, 2023
ce7dfa4
update getParams for consumerkeeper and add SlashWithInfractionReason
sontrinh16 Apr 24, 2023
c73c836
Merge pull request #5 from notional-labs/ruslan/megalint
faddat Apr 24, 2023
2404232
Merge pull request #6 from notional-labs/staking_api
faddat Apr 24, 2023
e67ec72
Merge pull request #4 from notional-labs/api-fix
vuong177 Apr 24, 2023
b991b74
Update Makefile
faddat Apr 24, 2023
f122c43
add unit tests to Makefile
pysel Apr 24, 2023
2d0f1df
dockerignore
pysel Apr 24, 2023
2e53ea6
Update .dockerignore
faddat Apr 24, 2023
9d7d2c4
Merge pull request #7 from notional-labs/ruslan/dockerignore
pysel Apr 24, 2023
d825fd7
change back to deleteProposal
sontrinh16 Apr 24, 2023
fc740f4
add consensus keeper to Apps + remove redundant invCheckPeriod
pysel Apr 24, 2023
c9360b6
Merge pull request #8 from notional-labs/ruslan/cons-params-keeper
faddat Apr 24, 2023
51c12be
rename ec.Marshaler to ec.Codec
pysel Apr 25, 2023
d6ef7e2
change all appearences of -b block to -b sync
pysel Apr 25, 2023
90eb98e
stragglers: Marshaler -> Codec migration
pysel Apr 25, 2023
7f3727c
lint docs
pysel Apr 25, 2023
0293dec
modulesToExport: add to ExportAppStateAndValidators
pysel Apr 25, 2023
326022a
Merge pull request #9 from notional-labs/ruslan/ics-47-wip
faddat Apr 25, 2023
de54787
sdk.Int -> math.Int
faddat Apr 25, 2023
c5c4b1d
minor change
sontrinh16 Apr 27, 2023
a7eb186
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
sontrinh16 Apr 27, 2023
652e682
Merge branch 'main' into sdk-47-fifth-go-notional
faddat Apr 27, 2023
182ae4b
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
sontrinh16 Apr 27, 2023
61838d9
remove test
pysel Apr 27, 2023
60859fd
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
faddat Apr 27, 2023
c7f1ad8
bump versions
faddat Apr 27, 2023
2912b0a
Merge remote-tracking branch 'origin/main' into sdk-47-fifth-go-notional
faddat Apr 27, 2023
1114d92
seperate two types of WhitelistedParams
vuong177 Apr 27, 2023
ec7d13b
Merge remote-tracking branch 'origin/main' into sdk-47-fifth-go-notional
faddat Apr 28, 2023
2a12810
fix deleteForbiddenProposal
sontrinh16 Apr 28, 2023
b2336af
revert legacy whitelist params and fix democracy gov whitelist test
sontrinh16 Apr 29, 2023
8879a50
update forbidden ante test
sontrinh16 Apr 29, 2023
56d889d
add comment and minor change
sontrinh16 Apr 29, 2023
c0db902
fix conflict
sontrinh16 Apr 29, 2023
7ab751a
clean up
sontrinh16 Apr 29, 2023
81f05be
Merge pull request #11 from notional-labs/new-params-update
faddat Apr 29, 2023
d619741
Merge remote-tracking branch 'origin/main' into sdk-47-fifth-go-notional
faddat Apr 29, 2023
094b539
fix lints
faddat Apr 29, 2023
4f16472
Create go-tests.yml
faddat Apr 20, 2023
fac7646
run unit tests separately and use the verbose flag for e2e
faddat Apr 29, 2023
4e75553
update LegacyWhitelistedParams: only whitelist ibc params
vuong177 Apr 29, 2023
b0b8034
trigger ci
faddat Apr 29, 2023
d85cdde
disable legacy parameter changes
faddat Apr 30, 2023
a367ebf
Revert "trigger ci"
faddat Apr 30, 2023
cc7e707
remove unnecessary initgenesis
sontrinh16 May 1, 2023
8fbd22b
Merge branch 'main' into sdk-47-fifth-go-notional
faddat May 2, 2023
bcad4d5
Merge branch 'main' into sdk-47-fifth-go-notional
faddat May 3, 2023
301bf3b
fix: unboding do not found
vuong177 May 3, 2023
3fd87a5
root.go: cd and cdd don't need valset in genesis
vuong177 May 3, 2023
040e7cd
Merge branch 'main' into sdk-47-fifth-go-notional
faddat May 3, 2023
e8199e1
fix: use sdk47 staking keeper interface
MSalopek Apr 28, 2023
d8a4462
fix: change encoding used by provider app [unstable]
MSalopek May 3, 2023
d09d4d9
fix: use mainline ibc-go/v7 in integration tests
MSalopek May 4, 2023
99747c3
fix: refactor difftest setup procedure
MSalopek May 5, 2023
bed4735
merge main
sontrinh16 May 5, 2023
c2e2d84
Merge remote-tracking branch 'origin/upgrade-47-with-fixes' into sdk-…
faddat May 6, 2023
aba247a
fix lints
faddat May 6, 2023
2db9c3b
use a different version of go in docker
faddat May 6, 2023
e5f9554
update proto builder to latest
faddat May 6, 2023
1c2af97
update go.mod
faddat May 6, 2023
85900f9
tidy
faddat May 6, 2023
9188917
apply MSalopek patch to cosmos-sdk so work may continue
faddat May 6, 2023
ab3c27b
organize go.mod and add thanks
faddat May 6, 2023
8061ba7
bump the version of hermes used in docs and images
faddat May 6, 2023
f7c1707
run e2e verbose so we can see where it breaks
faddat May 6, 2023
97d255d
cleanup root.go
faddat May 6, 2023
cd44160
fix consumer democracy, begin fixes on consumer and producer
faddat May 6, 2023
9834efb
tidy
faddat May 6, 2023
7ac4077
cleanup cd
faddat May 6, 2023
2aa1830
cleanup producer
faddat May 6, 2023
911cf12
fix provider app
faddat May 6, 2023
9b183e2
use genesis command with add-genesis-account subcommand
faddat May 6, 2023
44ad916
use genesis subcommand
faddat May 6, 2023
f266184
return only rootCmd
faddat May 6, 2023
9ba5aa6
add defaultMsgValidator to provider genutil
sontrinh16 May 6, 2023
f887e87
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
sontrinh16 May 6, 2023
b83ce51
trigger ci
faddat May 7, 2023
e6f2198
submit-legacy-proposal
faddat May 7, 2023
33048da
add err handler
sontrinh16 May 7, 2023
1627e4e
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
sontrinh16 May 7, 2023
c5f32d5
test is description summary or nah?
faddat May 7, 2023
ad1f8e4
Merge branch 'sdk-47-fifth-go-notional' of https://github.com/notiona…
faddat May 7, 2023
02af1a3
Revert "test is description summary or nah?"
faddat May 7, 2023
b0056d2
dunno why this would work tbh...
faddat May 7, 2023
ead85a7
Revert "dunno why this would work tbh..."
faddat May 7, 2023
58f03ca
begin changing prop types
faddat May 7, 2023
35bbd4c
summary
faddat May 7, 2023
7a96230
summary
faddat May 7, 2023
be4bb44
use legacy proposal type with summary field
faddat May 7, 2023
f1eea47
update example proposal commands
faddat May 7, 2023
d19f1e2
add type
faddat May 7, 2023
73bfc81
proposal type
faddat May 7, 2023
0720c66
fix gov cli
vuong177 May 7, 2023
6642233
legacy router
vuong177 May 7, 2023
05e01e5
minor
vuong177 May 7, 2023
7bceaae
remove type flag in gov proposal, it's not exist
vuong177 May 7, 2023
26c7fb7
async broadcast
vuong177 May 7, 2023
fe5c2a4
change broadcast type to sync
vuong177 May 7, 2023
4b2eb8d
add sleep time
vuong177 May 7, 2023
55f4a42
gov proposal changed
vuong177 May 7, 2023
b212c44
gjson
vuong177 May 7, 2023
f3107b3
minor
vuong177 May 7, 2023
026cf08
remove propType
faddat May 7, 2023
6cccf60
eliminate use of the block sync flag
faddat May 7, 2023
85f6e76
remove broadcast mode (dont set it at all)
faddat May 7, 2023
6790d15
push a change I could test locally if hermes had multiplaform images
faddat May 7, 2023
ea5e11f
fix collect gentxs for provider app
sontrinh16 May 8, 2023
dfa0058
build(deps): bump gaurav-nelson/github-action-markdown-link-check fro…
dependabot[bot] May 8, 2023
d7e271f
fix collect gentxs for provider app (#926)
sontrinh16 May 9, 2023
d4774e7
Merge branch 'main' into seriously-the-sixth-pr-marius-closed-all-others
faddat May 9, 2023
ecdd067
chore: resolve conflicts with feature branch
MSalopek May 15, 2023
fe8b0c0
chore: finalize merge conflict resolution
MSalopek May 15, 2023
89f1f5f
chore: finalize merge conflict resolution
MSalopek May 15, 2023
ba87625
chore: use mainline dependencies
MSalopek May 15, 2023
38129c8
chore: resolve conflicts
MSalopek May 15, 2023
fa543a8
fix!: refactor AfterUnbondInitiated to reflect sdk behaviour
MSalopek May 15, 2023
a457153
chore: revert workflow changes
MSalopek May 15, 2023
d8ef7b1
chore: appease linter
MSalopek May 15, 2023
0f5144b
chore: port ibc-go/sdkv47 proto dep management calls
MSalopek May 15, 2023
f91fbcd
chore: remove simapp; use same inits for democracy
MSalopek May 15, 2023
3fe0252
whitelist update params at module level
mpoke May 16, 2023
cc1227d
uncomment democ tests
shaspitz May 17, 2023
260f0c3
make mocks
shaspitz May 17, 2023
3f26345
chore: appease lint rules
MSalopek May 17, 2023
ef347d4
fix: refactor democracy proposal antehandler
MSalopek May 17, 2023
0f3d5ce
fix: refactor democracy proposal antehandler tests
MSalopek May 17, 2023
f68e65a
fix: bump go version in Dockerfile.gaia
MSalopek May 17, 2023
c6f74f5
fix: uncomment consumer init validation
MSalopek May 17, 2023
cb5fb2a
fix: test changing params using legacy proposal
MSalopek May 17, 2023
5a51545
uncomment e2e test runs
shaspitz May 17, 2023
d837513
fix: various nitpicks and comment strings
MSalopek May 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.git/
Dockerfile
*.md
.gitignore
.gitattributes
scripts/
.vscode/
.github/
proto/
2 changes: 2 additions & 0 deletions .github/workflows/automated-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
branches:
- main
- release/v*
- feat/*
pull_request:
branches:
- main
- release/v*
- feat/*
jobs:
Automated_Tests:
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# syntax=docker/dockerfile:1

FROM golang:1.19-alpine AS is-builder

FROM golang:1.20-alpine AS is-builder
MSalopek marked this conversation as resolved.
Show resolved Hide resolved

ENV PACKAGES curl make git libc-dev bash gcc linux-headers
RUN apk add --no-cache $PACKAGES
Expand Down
77 changes: 7 additions & 70 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ install: go.sum
test:
go test ./... && go run ./tests/e2e/...

# run all unit tests
test-unit:
go test ./...

# run unit and integration tests
test-short:
go test ./x/... ./app/... ./tests/integration/...
Expand Down Expand Up @@ -101,7 +105,7 @@ $(BUILDDIR)/:
### Protobuf ###
###############################################################################

containerProtoVer=0.9.0
containerProtoVer=0.13.0
containerProtoImage=ghcr.io/cosmos/proto-builder:$(containerProtoVer)
containerProtoGen=cosmos-sdk-proto-gen-$(containerProtoVer)
containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer)
Expand Down Expand Up @@ -130,76 +134,9 @@ proto-lint:
proto-check-breaking:
@$(DOCKER_BUF) breaking --against $(HTTPS_GIT)#branch=main

TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.5/proto/tendermint
GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos
CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/v0.7.1
COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master
SDK_PROTO_URL = https://raw.githubusercontent.com/cosmos/cosmos-sdk/v0.45.13-ics/proto/cosmos

TM_CRYPTO_TYPES = third_party/proto/tendermint/crypto
TM_ABCI_TYPES = third_party/proto/tendermint/abci
TM_TYPES = third_party/proto/tendermint/types
TM_VERSION = third_party/proto/tendermint/version
TM_LIBS = third_party/proto/tendermint/libs/bits
TM_P2P = third_party/proto/tendermint/p2p

SDK_QUERY = third_party/proto/cosmos/base/query/v1beta1
SDK_BASE = third_party/proto/cosmos/base/v1beta1
SDK_UPGRADE = third_party/proto/cosmos/upgrade/v1beta1
SDK_STAKING = third_party/proto/cosmos/staking/v1beta1
SDK_EVIDENCE = third_party/proto/cosmos/evidence/v1beta1

GOGO_PROTO_TYPES = third_party/proto/gogoproto
CONFIO_TYPES = third_party/proto/confio
COSMOS_PROTO_TYPES = third_party/proto/cosmos_proto

proto-update-deps:
@mkdir -p $(COSMOS_PROTO_TYPES)
@curl -sSL $(COSMOS_PROTO_URL)/cosmos.proto > $(COSMOS_PROTO_TYPES)/cosmos.proto

@mkdir -p $(SDK_QUERY)
@curl -sSL $(SDK_PROTO_URL)/base/query/v1beta1/pagination.proto > $(SDK_QUERY)/pagination.proto

@mkdir -p $(SDK_BASE)
@curl -sSL $(SDK_PROTO_URL)/base/v1beta1/coin.proto > $(SDK_BASE)/coin.proto

@mkdir -p $(SDK_UPGRADE)
@curl -sSL $(SDK_PROTO_URL)/upgrade/v1beta1/upgrade.proto > $(SDK_UPGRADE)/upgrade.proto

@mkdir -p $(SDK_STAKING)
@curl -sSL $(SDK_PROTO_URL)/staking/v1beta1/staking.proto > $(SDK_STAKING)/staking.proto

@mkdir -p $(SDK_EVIDENCE)
@curl -sSL $(SDK_PROTO_URL)/evidence/v1beta1/evidence.proto > $(SDK_EVIDENCE)/evidence.proto

## Importing of tendermint protobuf definitions currently requires the
## use of `sed` in order to build properly with cosmos-sdk's proto file layout
## (which is the standard Buf.build FILE_LAYOUT)
## Issue link: https://github.com/tendermint/tendermint/issues/5021
@mkdir -p $(TM_TYPES)
@curl -sSL $(TM_URL)/types/types.proto > $(TM_TYPES)/types.proto
@curl -sSL $(TM_URL)/types/params.proto > $(TM_TYPES)/params.proto
@curl -sSL $(TM_URL)/types/validator.proto > $(TM_TYPES)/validator.proto

@mkdir -p $(TM_ABCI_TYPES)
@curl -sSL $(TM_URL)/abci/types.proto > $(TM_ABCI_TYPES)/types.proto

@mkdir -p $(TM_VERSION)
@curl -sSL $(TM_URL)/version/types.proto > $(TM_VERSION)/types.proto

@mkdir -p $(TM_LIBS)
@curl -sSL $(TM_URL)/libs/bits/types.proto > $(TM_LIBS)/types.proto

@mkdir -p $(TM_CRYPTO_TYPES)
@curl -sSL $(TM_URL)/crypto/proof.proto > $(TM_CRYPTO_TYPES)/proof.proto
@curl -sSL $(TM_URL)/crypto/keys.proto > $(TM_CRYPTO_TYPES)/keys.proto

@mkdir -p $(CONFIO_TYPES)
@curl -sSL $(CONFIO_URL)/proofs.proto > $(CONFIO_TYPES)/proofs.proto

## insert go package option into proofs.proto file
## Issue link: https://github.com/confio/ics23/issues/32
@perl -i -l -p -e 'print "option go_package = \"github.com/confio/ics23/go\";" if $$. == 4' $(CONFIO_TYPES)/proofs.proto
@echo "Updating Protobuf dependencies"
$(DOCKER) run --rm -v $(CURDIR)/proto:/workspace --workdir /workspace $(protoImageName) buf mod update

.PHONY: proto-all proto-gen proto-gen-any proto-swagger-gen proto-format proto-lint proto-check-breaking proto-update-deps mocks

Expand Down
48 changes: 42 additions & 6 deletions app/consumer-democracy/ante/forbidden_proposals_ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,61 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"

govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
)

type ForbiddenProposalsDecorator struct {
IsProposalWhitelisted func(govtypes.Content) bool
isLegacyProposalWhitelisted func(govv1beta1.Content) bool
isModuleWhiteList func(string) bool
}

func NewForbiddenProposalsDecorator(whiteListFn func(govtypes.Content) bool) ForbiddenProposalsDecorator {
return ForbiddenProposalsDecorator{IsProposalWhitelisted: whiteListFn}
func NewForbiddenProposalsDecorator(
whiteListFn func(govv1beta1.Content) bool,
isModuleWhiteList func(string) bool,
) ForbiddenProposalsDecorator {
return ForbiddenProposalsDecorator{
isLegacyProposalWhitelisted: whiteListFn,
isModuleWhiteList: isModuleWhiteList,
}
}

func (decorator ForbiddenProposalsDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
currHeight := ctx.BlockHeight()

for _, msg := range tx.GetMsgs() {
submitProposalMgs, ok := msg.(*govtypes.MsgSubmitProposal)
submitProposalMgs, ok := msg.(*govv1.MsgSubmitProposal)
// if the message is MsgSubmitProposal, check if proposal is whitelisted
if ok {
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
if !decorator.IsProposalWhitelisted(submitProposalMgs.GetContent()) {
messages := submitProposalMgs.GetMessages()
isWhitelisted := true

// iterate over all the proposal messages
for _, message := range messages {
sdkMsg, isLegacyProposal := message.GetCachedValue().(*govv1.MsgExecLegacyContent)
if isLegacyProposal {
// legacy gov proposal content
content, err := govv1.LegacyContentFromMessage(sdkMsg)
if err != nil {
continue
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
}
if !decorator.isLegacyProposalWhitelisted(content) {
// not whitelisted
isWhitelisted = false
break
}
} else {
// not legacy gov proposal content
if !decorator.isModuleWhiteList(message.TypeUrl) {
// not whitelisted
shaspitz marked this conversation as resolved.
Show resolved Hide resolved
isWhitelisted = false
break
}
}
}

if !isWhitelisted {
return ctx, fmt.Errorf("tx contains unsupported proposal message types at height %d", currHeight)
}
}
Expand Down
Loading