-
Notifications
You must be signed in to change notification settings - Fork 45
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
Sommelier v8 Upgrade #318
Changes from 8 commits
97d5a9a
b921658
86c08b6
4299122
f690389
c918c37
0473746
9569092
e6969d7
55dfef3
111b274
ef439df
80d4510
0b86230
9739dda
5395b5a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,6 +125,7 @@ jobs: | |
"Auction", | ||
"CellarFees", | ||
"Incentives", | ||
"ValidatorIncentives", | ||
"Pubsub", | ||
"Addresses", | ||
] | ||
|
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 | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package v8 | ||
|
||
const ( | ||
UpgradeName = "v8" | ||
) |
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) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Incompatibility Found The constants
🔗 Analysis chainLGTM. 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 executedThe 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 { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Consider consistent error handling during JSON marshalling In the |
There was a problem hiding this comment.
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