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

Sommelier v8 Upgrade #318

Merged
merged 16 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
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
1 change: 1 addition & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ jobs:
"Auction",
"CellarFees",
"Incentives",
"ValidatorIncentives",
"Pubsub",
"Addresses",
]
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ e2e_cellarfees_test: e2e_clean_slate
e2e_incentives_test: e2e_clean_slate
@E2E_SKIP_CLEANUP=true integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestIncentives || make -s fail

e2e_validator_incentives_test: e2e_clean_slate
@E2E_SKIP_CLEANUP=true integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestValidatorIncentives || make -s fail

e2e_pubsub_test: e2e_clean_slate
@E2E_SKIP_CLEANUP=true integration_tests/integration_tests.test -test.failfast -test.v -test.run IntegrationTestSuite -testify.m TestPubsub || make -s fail

Expand Down
82 changes: 45 additions & 37 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,36 +101,37 @@ import (
icaexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
"github.com/gorilla/mux"
"github.com/peggyjv/gravity-bridge/module/v4/x/gravity"
gravityclient "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/client"
gravitykeeper "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/keeper"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
appParams "github.com/peggyjv/sommelier/v7/app/params"
"github.com/peggyjv/sommelier/v7/x/addresses"
addresseskeeper "github.com/peggyjv/sommelier/v7/x/addresses/keeper"
addressestypes "github.com/peggyjv/sommelier/v7/x/addresses/types"
"github.com/peggyjv/sommelier/v7/x/auction"
auctionclient "github.com/peggyjv/sommelier/v7/x/auction/client"
auctionkeeper "github.com/peggyjv/sommelier/v7/x/auction/keeper"
auctiontypes "github.com/peggyjv/sommelier/v7/x/auction/types"
"github.com/peggyjv/sommelier/v7/x/axelarcork"
axelarcorkclient "github.com/peggyjv/sommelier/v7/x/axelarcork/client"
axelarcorkkeeper "github.com/peggyjv/sommelier/v7/x/axelarcork/keeper"
axelarcorktypes "github.com/peggyjv/sommelier/v7/x/axelarcork/types"
"github.com/peggyjv/sommelier/v7/x/cellarfees"
cellarfeeskeeper "github.com/peggyjv/sommelier/v7/x/cellarfees/keeper"
cellarfeestypes "github.com/peggyjv/sommelier/v7/x/cellarfees/types"
"github.com/peggyjv/sommelier/v7/x/cork"
corkclient "github.com/peggyjv/sommelier/v7/x/cork/client"
corkkeeper "github.com/peggyjv/sommelier/v7/x/cork/keeper"
corktypes "github.com/peggyjv/sommelier/v7/x/cork/types"
"github.com/peggyjv/sommelier/v7/x/incentives"
incentiveskeeper "github.com/peggyjv/sommelier/v7/x/incentives/keeper"
incentivestypes "github.com/peggyjv/sommelier/v7/x/incentives/types"
"github.com/peggyjv/sommelier/v7/x/pubsub"
pubsubclient "github.com/peggyjv/sommelier/v7/x/pubsub/client"
pubsubkeeper "github.com/peggyjv/sommelier/v7/x/pubsub/keeper"
pubsubtypes "github.com/peggyjv/sommelier/v7/x/pubsub/types"
"github.com/peggyjv/gravity-bridge/module/v5/x/gravity"
gravityclient "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/client"
gravitykeeper "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/keeper"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/types"
appParams "github.com/peggyjv/sommelier/v8/app/params"
v8 "github.com/peggyjv/sommelier/v8/app/upgrades/v8"
"github.com/peggyjv/sommelier/v8/x/addresses"
addresseskeeper "github.com/peggyjv/sommelier/v8/x/addresses/keeper"
addressestypes "github.com/peggyjv/sommelier/v8/x/addresses/types"
"github.com/peggyjv/sommelier/v8/x/auction"
auctionclient "github.com/peggyjv/sommelier/v8/x/auction/client"
auctionkeeper "github.com/peggyjv/sommelier/v8/x/auction/keeper"
auctiontypes "github.com/peggyjv/sommelier/v8/x/auction/types"
"github.com/peggyjv/sommelier/v8/x/axelarcork"
axelarcorkclient "github.com/peggyjv/sommelier/v8/x/axelarcork/client"
axelarcorkkeeper "github.com/peggyjv/sommelier/v8/x/axelarcork/keeper"
axelarcorktypes "github.com/peggyjv/sommelier/v8/x/axelarcork/types"
"github.com/peggyjv/sommelier/v8/x/cellarfees"
cellarfeeskeeper "github.com/peggyjv/sommelier/v8/x/cellarfees/keeper"
cellarfeestypes "github.com/peggyjv/sommelier/v8/x/cellarfees/types"
"github.com/peggyjv/sommelier/v8/x/cork"
corkclient "github.com/peggyjv/sommelier/v8/x/cork/client"
corkkeeper "github.com/peggyjv/sommelier/v8/x/cork/keeper"
corktypes "github.com/peggyjv/sommelier/v8/x/cork/types"
"github.com/peggyjv/sommelier/v8/x/incentives"
incentiveskeeper "github.com/peggyjv/sommelier/v8/x/incentives/keeper"
incentivestypes "github.com/peggyjv/sommelier/v8/x/incentives/types"
"github.com/peggyjv/sommelier/v8/x/pubsub"
pubsubclient "github.com/peggyjv/sommelier/v8/x/pubsub/client"
pubsubkeeper "github.com/peggyjv/sommelier/v8/x/pubsub/keeper"
pubsubtypes "github.com/peggyjv/sommelier/v8/x/pubsub/types"
"github.com/rakyll/statik/fs"

// unnamed import of statik for swagger UI support
Expand Down Expand Up @@ -519,11 +520,7 @@ func NewSommelierApp(
)

app.IncentivesKeeper = incentiveskeeper.NewKeeper(
appCodec, keys[incentivestypes.StoreKey], app.GetSubspace(incentivestypes.ModuleName), app.DistrKeeper, app.BankKeeper, app.MintKeeper,
)

app.IncentivesKeeper = incentiveskeeper.NewKeeper(
appCodec, keys[incentivestypes.StoreKey], app.GetSubspace(incentivestypes.ModuleName), app.DistrKeeper, app.BankKeeper, app.MintKeeper,
appCodec, keys[incentivestypes.StoreKey], app.GetSubspace(incentivestypes.ModuleName), app.DistrKeeper, app.BankKeeper, app.MintKeeper, app.StakingKeeper,
)

app.GravityKeeper = *app.GravityKeeper.SetHooks(
Expand Down Expand Up @@ -1025,13 +1022,24 @@ func (app *SommelierApp) setupUpgradeStoreLoaders() {

var storeUpgrades *storetypes.StoreUpgrades = nil

// TODO: Add v8 store loader when writing upgrade handler
if upgradeInfo.Name == v8.UpgradeName {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{addressestypes.ModuleName},
}
}

if storeUpgrades != nil {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
}
}

func (app *SommelierApp) setupUpgradeHandlers() {
// TODO: Add v8 upgrade handler
// TODO: Add v8 upgrade handle
app.UpgradeKeeper.SetUpgradeHandler(
v8.UpgradeName,
v8.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)
}
2 changes: 1 addition & 1 deletion app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
appparams "github.com/peggyjv/sommelier/v7/app/params"
appparams "github.com/peggyjv/sommelier/v8/app/params"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package app

import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/peggyjv/sommelier/v7/app/params"
"github.com/peggyjv/sommelier/v8/app/params"
)

// MakeEncodingConfig creates an EncodingConfig for testing. This function
Expand Down
6 changes: 3 additions & 3 deletions app/upgrades/v4/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
cellarfeestypes "github.com/peggyjv/sommelier/v7/x/cellarfees/types"
corktypes "github.com/peggyjv/sommelier/v7/x/cork/types"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/types"
cellarfeestypes "github.com/peggyjv/sommelier/v8/x/cellarfees/types"
corktypes "github.com/peggyjv/sommelier/v8/x/cork/types"
)

func CreateUpgradeHandler(
Expand Down
6 changes: 3 additions & 3 deletions app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
appparams "github.com/peggyjv/sommelier/v7/app/params"
incentiveskeeper "github.com/peggyjv/sommelier/v7/x/incentives/keeper"
incentivestypes "github.com/peggyjv/sommelier/v7/x/incentives/types"
appparams "github.com/peggyjv/sommelier/v8/app/params"
incentiveskeeper "github.com/peggyjv/sommelier/v8/x/incentives/keeper"
incentivestypes "github.com/peggyjv/sommelier/v8/x/incentives/types"
)

func CreateUpgradeHandler(
Expand Down
20 changes: 10 additions & 10 deletions app/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ import (
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types"
auctionkeeper "github.com/peggyjv/sommelier/v7/x/auction/keeper"
auctiontypes "github.com/peggyjv/sommelier/v7/x/auction/types"
axelarcorkkeeper "github.com/peggyjv/sommelier/v7/x/axelarcork/keeper"
axelarcorktypes "github.com/peggyjv/sommelier/v7/x/axelarcork/types"
cellarfeeskeeper "github.com/peggyjv/sommelier/v7/x/cellarfees/keeper"
cellarfeestypes "github.com/peggyjv/sommelier/v7/x/cellarfees/types"
corkkeeper "github.com/peggyjv/sommelier/v7/x/cork/keeper"
corktypes "github.com/peggyjv/sommelier/v7/x/cork/types/v2"
pubsubkeeper "github.com/peggyjv/sommelier/v7/x/pubsub/keeper"
pubsubtypes "github.com/peggyjv/sommelier/v7/x/pubsub/types"
auctionkeeper "github.com/peggyjv/sommelier/v8/x/auction/keeper"
auctiontypes "github.com/peggyjv/sommelier/v8/x/auction/types"
axelarcorkkeeper "github.com/peggyjv/sommelier/v8/x/axelarcork/keeper"
axelarcorktypes "github.com/peggyjv/sommelier/v8/x/axelarcork/types"
cellarfeeskeeper "github.com/peggyjv/sommelier/v8/x/cellarfees/keeper"
cellarfeestypes "github.com/peggyjv/sommelier/v8/x/cellarfees/types"
corkkeeper "github.com/peggyjv/sommelier/v8/x/cork/keeper"
corktypes "github.com/peggyjv/sommelier/v8/x/cork/types/v2"
pubsubkeeper "github.com/peggyjv/sommelier/v8/x/pubsub/keeper"
pubsubtypes "github.com/peggyjv/sommelier/v8/x/pubsub/types"
)

func CreateUpgradeHandler(
Expand Down
10 changes: 10 additions & 0 deletions app/upgrades/v8/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# v8 upgrade

This upgrade moves Sommelier to major version 8.

## Summary of changes

* Add the addresses module for mapping cosmos/evm addresses
* Update the cellarfees module to start fee auctions based on the accrued USD value of a particular denom
* Update the auction module to allow a portion of SOMM proceeds earned by auctions to be burned
* Upgrade the gravity module to v5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should mention the new validator incentives

5 changes: 5 additions & 0 deletions app/upgrades/v8/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v8

const (
UpgradeName = "v8"
)
18 changes: 18 additions & 0 deletions app/upgrades/v8/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v8

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("v8 upgrade: entering handler and running migrations")

return mm.RunMigrations(ctx, configurator, vm)
}
}
6 changes: 3 additions & 3 deletions cmd/sommelier/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ import (
"github.com/spf13/cast"
"github.com/spf13/cobra"

bridgecmd "github.com/peggyjv/gravity-bridge/module/v4/cmd/gravity/cmd"
"github.com/peggyjv/sommelier/v7/app"
"github.com/peggyjv/sommelier/v7/app/params"
bridgecmd "github.com/peggyjv/gravity-bridge/module/v5/cmd/gravity/cmd"
"github.com/peggyjv/sommelier/v8/app"
"github.com/peggyjv/sommelier/v8/app/params"
)

// NewRootCmd creates a new root command for simd. It is called once in the
Expand Down
4 changes: 2 additions & 2 deletions cmd/sommelier/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/cosmos/cosmos-sdk/server"
scmd "github.com/cosmos/cosmos-sdk/server/cmd"
"github.com/peggyjv/sommelier/v7/app"
"github.com/peggyjv/sommelier/v7/cmd/sommelier/cmd"
"github.com/peggyjv/sommelier/v8/app"
"github.com/peggyjv/sommelier/v8/cmd/sommelier/cmd"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/peggyjv/sommelier/v7
module github.com/peggyjv/sommelier/v8

go 1.22

Expand All @@ -23,7 +23,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/miguelmota/go-ethereum-hdwallet v0.1.1
github.com/ory/dockertest/v3 v3.10.0
github.com/peggyjv/gravity-bridge/module/v4 v4.0.2-0.20240507144821-c36490e18116
github.com/peggyjv/gravity-bridge/module/v5 v5.0.0-20241009165118-198cad613f2f
github.com/rakyll/statik v0.1.7
github.com/regen-network/cosmos-proto v0.3.1
github.com/spf13/cast v1.6.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1412,8 +1412,8 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE=
github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
github.com/peggyjv/gravity-bridge/module/v4 v4.0.2-0.20240507144821-c36490e18116 h1:WmtdxpmEWGv4hWpTZfFAR8SIFeoBlOjvkN4pixwYMZk=
github.com/peggyjv/gravity-bridge/module/v4 v4.0.2-0.20240507144821-c36490e18116/go.mod h1:tlA4IAHXoDRK8zgQ2PP111hBkHOZLcH6tgz2Kh/EBoI=
github.com/peggyjv/gravity-bridge/module/v5 v5.0.0-20241009165118-198cad613f2f h1:UAzrovsM6zdTIPsAfMjLjyzOXUJdMrBTJThSL0mO5TA=
github.com/peggyjv/gravity-bridge/module/v5 v5.0.0-20241009165118-198cad613f2f/go.mod h1:/vcYmGnfzHn2d7Ptxq1PLLC3gpuMJz46r2tZXFSCC6k=
github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/addresses_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/ethereum/go-ethereum/common"
"github.com/peggyjv/sommelier/v7/x/addresses/types"
"github.com/peggyjv/sommelier/v8/x/addresses/types"
)

func (s *IntegrationTestSuite) TestAddresses() {
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/auction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/peggyjv/sommelier/v7/x/auction/types"
cellarfees "github.com/peggyjv/sommelier/v7/x/cellarfees/types"
"github.com/peggyjv/sommelier/v8/x/auction/types"
cellarfees "github.com/peggyjv/sommelier/v8/x/cellarfees/types"
)

func (s *IntegrationTestSuite) TestAuction() {
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/axelarcork_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
"github.com/ethereum/go-ethereum/common"
"github.com/golang/protobuf/proto" //nolint:staticcheck
"github.com/peggyjv/sommelier/v7/x/axelarcork/types"
pubsubtypes "github.com/peggyjv/sommelier/v7/x/pubsub/types"
"github.com/peggyjv/sommelier/v8/x/axelarcork/types"
pubsubtypes "github.com/peggyjv/sommelier/v8/x/pubsub/types"
)

func (s *IntegrationTestSuite) TestAxelarCork() {
Expand Down
6 changes: 3 additions & 3 deletions integration_tests/cellarfees_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
disttypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
govtypesv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
auctiontypes "github.com/peggyjv/sommelier/v7/x/auction/types"
cellarfeestypes "github.com/peggyjv/sommelier/v7/x/cellarfees/types"
cellarfeestypesv2 "github.com/peggyjv/sommelier/v7/x/cellarfees/types/v2"
auctiontypes "github.com/peggyjv/sommelier/v8/x/auction/types"
cellarfeestypes "github.com/peggyjv/sommelier/v8/x/cellarfees/types"
cellarfeestypesv2 "github.com/peggyjv/sommelier/v8/x/cellarfees/types/v2"
)

func (s *IntegrationTestSuite) TestCellarFees() {
Expand Down
10 changes: 5 additions & 5 deletions integration_tests/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"os"

corktypes "github.com/peggyjv/sommelier/v7/x/cork/types/v2"
corktypes "github.com/peggyjv/sommelier/v8/x/cork/types/v2"

tmrand "github.com/cometbft/cometbft/libs/rand"
rpchttp "github.com/cometbft/cometbft/rpc/client/http"
Expand Down Expand Up @@ -42,10 +42,10 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v7/modules/core"
gravityclient "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/client"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
"github.com/peggyjv/sommelier/v7/app"
"github.com/peggyjv/sommelier/v7/app/params"
gravityclient "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/client"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/types"
"github.com/peggyjv/sommelier/v8/app"
"github.com/peggyjv/sommelier/v8/app/params"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/ethereum.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
ethereumtypes "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethclient"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v4/x/gravity/types"
gravitytypes "github.com/peggyjv/gravity-bridge/module/v5/x/gravity/types"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Incompatibility Found

The constants DeployERC20ABIJSON and SendToCosmosABIJSON are referenced in integration_tests/ethereum.go but are not defined in the gravitytypes v5 package. This indicates a compatibility issue that needs to be addressed.

  • Ensure that gravitytypes v5 includes definitions for DeployERC20ABIJSON and SendToCosmosABIJSON.
  • Update the usage in ethereum.go if the constants have been renamed or relocated in v5.
🔗 Analysis chain

LGTM. Verify compatibility with v5 types.

The update of the gravitytypes import from v4 to v5 aligns with similar changes across the codebase. This change appears to be part of a coordinated upgrade of the Gravity module.

To ensure compatibility, please verify that all uses of gravitytypes in this file are still valid with the v5 version. Run the following script to check for any potential issues:

If any incompatibilities are found, please update the affected code accordingly.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for potential compatibility issues with gravitytypes v5

# Test: Search for all uses of gravitytypes in the file
rg -n 'gravitytypes\.' integration_tests/ethereum.go

# Test: Verify that the gravitytypes package is imported correctly
rg -n 'github\.com/peggyjv/gravity-bridge/module/v5/x/gravity/types' integration_tests/ethereum.go

Length of output: 404


Script:

#!/bin/bash
# Description: Verify existence of DeployERC20ABIJSON and SendToCosmosABIJSON in gravitytypes v5

# Check for DeployERC20ABIJSON definition
rg -n 'DeployERC20ABIJSON' $(fd --search-path "module/v5/x/gravity/types" --type go)

# Check for SendToCosmosABIJSON definition
rg -n 'SendToCosmosABIJSON' $(fd --search-path "module/v5/x/gravity/types" --type go)

Length of output: 736


Script:

#!/bin/bash
# Description: Verify existence of DeployERC20ABIJSON and SendToCosmosABIJSON in gravitytypes v5

# Check for DeployERC20ABIJSON definition
rg -n 'DeployERC20ABIJSON' 'module/v5/x/gravity/types/**/*.go'

# Check for SendToCosmosABIJSON definition
rg -n 'SendToCosmosABIJSON' 'module/v5/x/gravity/types/**/*.go'

Length of output: 274


Script:

#!/bin/bash
# Description: Locate definitions of DeployERC20ABIJSON and SendToCosmosABIJSON across the codebase

# Search for DeployERC20ABIJSON definition in all Go files
rg -n 'DeployERC20ABIJSON' --type go

# Search for SendToCosmosABIJSON definition in all Go files
rg -n 'SendToCosmosABIJSON' --type go

Length of output: 304

)

type EthereumConfig struct {
Expand Down
16 changes: 16 additions & 0 deletions integration_tests/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/peggyjv/sommelier/v8/app/params"
incentivestypes "github.com/peggyjv/sommelier/v8/x/incentives/types"
)

func getGenDoc(path string) (*tmtypes.GenesisDoc, error) {
Expand Down Expand Up @@ -108,3 +110,17 @@ func addGenesisAccount(path, moniker, amountStr string, accAddr sdk.AccAddress)
genDoc.AppState = appStateJSON
return genutil.ExportGenesisFile(genDoc, genFile)
}

func (s *IntegrationTestSuite) setIncentivesGenState(appGenState map[string]json.RawMessage) error {
incentivesGenState := incentivestypes.DefaultGenesisState()
err := cdc.UnmarshalJSON(appGenState[incentivestypes.ModuleName], &incentivesGenState)
if err != nil {
return fmt.Errorf("failed to unmarshal incentives genesis state: %w", err)
}

incentivesGenState.Params.ValidatorIncentivesCutoffHeight = 0
incentivesGenState.Params.ValidatorMaxDistributionPerBlock = sdk.NewCoin(params.BaseCoinUnit, sdk.NewInt(0))

appGenState[incentivestypes.ModuleName] = cdc.MustMarshalJSON(&incentivesGenState)
return nil
}
Comment on lines +114 to +126
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider consistent error handling during JSON marshalling

In the setIncentivesGenState function, you handle errors when unmarshalling JSON in line 116. However, when marshalling the updated genesis state in line 124, cdc.MustMarshalJSON is used, which can panic on error. For consistency and to avoid unexpected panics, consider using cdc.MarshalJSON and handling the error appropriately.

Loading
Loading