-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: use cosmos-sdk v50 and IBC v8.1 (#1698)
* proto: update proto files and deps * proto: run buf mode update * deps!: use cosmos-sdk/v0.50 and ibc-go/v8 * s&r: replace ibc-go imports * s&r: replace cosmos-sdk imports * cosmos-sdk: rm legacy upgrade prop handlers * cosmos-sdk: get cosmossdk.io modules * docs: add upgrade reference doc WIP * s&r: replace sdk math with math and legacydec * s&r: replace capability * deps: update modfile after merging main * interface changes: update expected_keepers.go * interface changes: update provider modules, legacy prop handlers * provider: update types directory * provider: update consumer equivocation * provider: update keeper.go * provider: update distribution.go * provider: update hooks (staking, governance) * provider: update params, add legacy params accessors * provider: update add/remove proposal handling; mv legacy to separate file * provider: add missing Tx types, update Msg server * provider: throttle, throttle_legacy, gov proposal handler (router) * provider: minor update to handler_test * provider: add cons version v4 migration - possibly broken * provider: client handling - legacy_proposals * provider: update key assignment * provider, testutil: partially fix tests * consumer: migrate consumer module * democracy: update module overrides * testutil: upgrade simibc files * testutil: upgrade ibc_testing setups * testutil: upgrade ibc_testing setups * testutil: update consumerkeeper mocks * tests: update provider consumer_equivocation tests * tests: fix most provider UTs * provider: fix key assignment and tests * provider: fix throttle and relay tests * provider: update app * provider: update app wiring and cmd * consumer: update consumer app * democracy: update democracy app * sovereign: update sovereign app * integration test: update integration tests * mbt: update mbt tests setup * sovereign: add readme file * tests: update test setup; refactor key_assignment addr parser * e2e: make initial e2e migration to v50 * provider: update wiring to enable e2e * provider: allow nil govkeeper in tests * provider: fix app wiring * tests: update unittest helpers * e2e tests: fix errors in provider relay * sovereign: fix root.go * consumer: add prefix registration to consumer main.go * democracy: update democracy app and root init * apps: refactor apps wiring * democ: refactor root.go wiring * democ: correctly override staking InitGenesis * democracy: update democracy distribution AllocateTokens * democracy: update staking and gov * democracy: update gov proposal whitelist (add legacy test props) * democracy: update staking interface overrides * e2e: refactor democracy tests and related actions * docs: v50 update reference * conclude merging release/v5 * e2e democ: fix democracy consumer IBC transfer tests; update whitelists * proto: update evidence messages submitters * tests: update deprecated tests * review: address comments * chore: use interchain-security/v5 module name * e2e: update e2e; use v5
- Loading branch information
Showing
230 changed files
with
9,895 additions
and
5,041 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package app | ||
|
||
import ( | ||
"bytes" | ||
"crypto/rand" | ||
"encoding/json" | ||
"fmt" | ||
|
||
abci "github.com/cometbft/cometbft/abci/types" | ||
|
||
"github.com/cosmos/cosmos-sdk/baseapp" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
) | ||
|
||
type ( | ||
// VoteExtensionHandler defines a dummy vote extension handler for SimApp. | ||
// | ||
// NOTE: This implementation is solely used for testing purposes. DO NOT use | ||
// in a production application! | ||
VoteExtensionHandler struct{} | ||
|
||
// VoteExtension defines the structure used to create a dummy vote extension. | ||
VoteExtension struct { | ||
Hash []byte | ||
Height int64 | ||
Data []byte | ||
} | ||
) | ||
|
||
func NewVoteExtensionHandler() *VoteExtensionHandler { | ||
return &VoteExtensionHandler{} | ||
} | ||
|
||
func (h *VoteExtensionHandler) SetHandlers(bApp *baseapp.BaseApp) { | ||
bApp.SetExtendVoteHandler(h.ExtendVote()) | ||
bApp.SetVerifyVoteExtensionHandler(h.VerifyVoteExtension()) | ||
} | ||
|
||
func (h *VoteExtensionHandler) ExtendVote() sdk.ExtendVoteHandler { | ||
return func(_ sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) { | ||
buf := make([]byte, 1024) | ||
|
||
_, err := rand.Read(buf) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to generate random vote extension data: %w", err) | ||
} | ||
|
||
ve := VoteExtension{ | ||
Hash: req.Hash, | ||
Height: req.Height, | ||
Data: buf, | ||
} | ||
|
||
bz, err := json.Marshal(ve) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to encode vote extension: %w", err) | ||
} | ||
|
||
return &abci.ResponseExtendVote{VoteExtension: bz}, nil | ||
} | ||
} | ||
|
||
func (h *VoteExtensionHandler) VerifyVoteExtension() sdk.VerifyVoteExtensionHandler { | ||
return func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) { | ||
var ve VoteExtension | ||
|
||
if err := json.Unmarshal(req.VoteExtension, &ve); err != nil { | ||
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil | ||
} | ||
|
||
switch { | ||
case req.Height != ve.Height: | ||
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil | ||
|
||
case !bytes.Equal(req.Hash, ve.Hash): | ||
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil | ||
|
||
case len(ve.Data) != 1024: | ||
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_REJECT}, nil | ||
} | ||
|
||
return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.