-
Notifications
You must be signed in to change notification settings - Fork 10
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
module independent #103
Open
cyilong
wants to merge
79
commits into
master
Choose a base branch
from
sv/module-independent
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+53,142
−5,261
Open
module independent #103
Changes from 1 commit
Commits
Show all changes
79 commits
Select commit
Hold shift + click to select a range
27daa65
split modules
sin3A c0f6dc2
update proto file
sin3A 28c835c
update simapp
sin3A c7371ce
update node
sin3A 03e049c
update dependence
sin3A d6f2277
add junit test
sin3A ceb7b2c
add slashing junit test
sin3A 054a877
update simapp mod
sin3A 3c640d2
update go mod
sin3A e6ba840
update simapp mod
sin3A 1002689
update go mod
sin3A b8ddab1
update node test
sin3A 1f772b8
add file
sin3A 716b8b7
separate modules
sin3A 07b132d
add api
sin3A 9115d13
update cosmos-sdk version
sin3A fad8db2
update node
sin3A 37e22e1
update idenrity node
sin3A e6e188b
update go mod
cyilong 2fc74c8
update
sin3A 455266e
Merge branch 'sv/module-independent' of https://github.com/bianjieai/…
sin3A 59438b6
update simapp api
sin3A 0a6305d
update simapp
sin3A 9c7e750
update node upgrade
sin3A b21710d
update api
sin3A 586a8e9
update simapp
sin3A bd39030
update node identity
sin3A a653ae1
update genutil upgrade slashing
sin3A 813edb2
update params
sin3A ce7bbd0
delete bak file
sin3A 0cce404
add proto script
sin3A 6acdc32
update dependence
sin3A 9cfefe1
add junit test
sin3A 854aaee
add slashing junit test
sin3A 4a29aa8
update go mod
sin3A e35fdd3
separate modules
sin3A 6b21754
add api
sin3A bd80eaa
update cosmos-sdk version
sin3A 7c1bd37
update node
sin3A 5dfaba7
update idenrity node
sin3A cd55497
update go mod
cyilong 6bff400
update simapp api
sin3A c9a18f9
update node identity upgrade
sin3A c46ee37
update genutil upgrade slashing
sin3A b96c053
update params
sin3A a6290b9
add proto script
sin3A 21c712d
Merge branch 'sv/module-independent' of https://github.com/bianjieai/…
sin3A c9745cb
update simapp
sin3A 5c05cef
update identity node params upgrade
sin3A 96110b2
update genutil slashing
sin3A 4441ad5
Merge branch 'master' into sv/module-independent
sin3A ae5f4e4
update upgrade
sin3A e786a36
clear expired codes
sin3A 936a181
clear expired codes
sin3A cd8c733
clear codes、update injected
sin3A 100f16a
Merge branch 'sv/module-independent' of https://github.com/bianjieai/…
sin3A bfc468a
fix HomePath
sin3A eceb239
update upgrade api
sin3A 9ffd22d
update upgrade test
sin3A 57da399
update genutils
sin3A 08d88a4
update node modules
sin3A 0cfdc43
update slashing node
sin3A 5ee596c
update slashing API
sin3A 5882101
add file update slashing module.proto
sin3A 0822c26
update
sin3A 0aaf460
update
sin3A cc544d3
update
sin3A f4802d3
update node module
sin3A 23073a8
update
sin3A 6672f90
update
sin3A 13ed118
update params
sin3A 411c44c
update node
sin3A 9674aa5
update params
sin3A a42b13b
update upgrade
sin3A 8a6a833
update upgrade init_genesis
sin3A 2fe96dc
refactor code
dreamer-zq 3774a91
fix node_test
sin3A 39af267
fix the issue of not being able to obtain parameters
sin3A e1cc878
add slashing ConsensusVersion&Migration
sin3A File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,30 @@ | ||
package keeper | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
xp "github.com/cosmos/cosmos-sdk/x/upgrade/exported" | ||
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
"iritamod.bianjie.ai/modules/upgrade/types" | ||
) | ||
|
||
type Keeper struct { | ||
uk *upgradekeeper.Keeper | ||
*upgradekeeper.Keeper | ||
} | ||
|
||
func NewKeeper(uk *upgradekeeper.Keeper) Keeper { | ||
func NewKeeper(skipUpgradeHeights map[int64]bool, storeKey storetypes.StoreKey, cdc codec.BinaryCodec, homePath string, vs xp.ProtocolVersionSetter, authority string) Keeper { | ||
return Keeper{ | ||
uk: uk, | ||
upgradekeeper.NewKeeper(skipUpgradeHeights, storeKey, cdc, homePath, vs, authority), | ||
} | ||
} | ||
|
||
// ScheduleUpgrade schedules an upgrade based on the specified plan. | ||
func (k Keeper) ScheduleUpgrade(ctx sdk.Context, msg *types.MsgUpgradeSoftware) error { | ||
p, has := k.uk.GetUpgradePlan(ctx) | ||
p, has := k.GetUpgradePlan(ctx) | ||
if has { | ||
return sdkerrors.Wrapf( | ||
sdkerrors.ErrInvalidRequest, | ||
|
@@ -35,40 +38,40 @@ func (k Keeper) ScheduleUpgrade(ctx sdk.Context, msg *types.MsgUpgradeSoftware) | |
Height: msg.Height, | ||
Info: msg.Info, | ||
} | ||
return k.uk.ScheduleUpgrade(ctx, plan) | ||
return k.Keeper.ScheduleUpgrade(ctx, plan) | ||
} | ||
|
||
// ClearUpgradePlan clears currently schedule upgrade | ||
func (k Keeper) ClearUpgradePlan(ctx sdk.Context) error { | ||
_, has := k.uk.GetUpgradePlan(ctx) | ||
_, has := k.GetUpgradePlan(ctx) | ||
if !has { | ||
return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "there is currently no upgrade plan") | ||
} | ||
|
||
k.uk.ClearUpgradePlan(ctx) | ||
k.Keeper.ClearUpgradePlan(ctx) | ||
return nil | ||
} | ||
|
||
func (k Keeper) UpgradeKeeper() *upgradekeeper.Keeper { | ||
return k.uk | ||
return k.Keeper | ||
} | ||
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. remove |
||
|
||
// SetUpgradeHandler sets an UpgradeHandler for the upgrade specified by name. This handler will be called when the upgrade | ||
// with this name is applied. In order for an upgrade with the given name to proceed, a handler for this upgrade | ||
// must be set even if it is a no-op function. | ||
func (k *Keeper) SetUpgradeHandler(name string, upgradeHandler upgradetypes.UpgradeHandler) { | ||
k.uk.SetUpgradeHandler(name, upgradeHandler) | ||
k.Keeper.SetUpgradeHandler(name, upgradeHandler) | ||
} | ||
|
||
// ReadUpgradeInfoFromDisk returns the name and height of the upgrade | ||
// which is written to disk by the old binary when panic'ing | ||
// if there's an error in reading the info, | ||
// it assumes that the upgrade info is not available | ||
func (k Keeper) ReadUpgradeInfoFromDisk() (upgradetypes.Plan, error) { | ||
return k.uk.ReadUpgradeInfoFromDisk() | ||
return k.Keeper.ReadUpgradeInfoFromDisk() | ||
} | ||
|
||
// IsSkipHeight checks if the given height is part of skipUpgradeHeights | ||
func (k Keeper) IsSkipHeight(height int64) bool { | ||
return k.uk.IsSkipHeight(height) | ||
return k.Keeper.IsSkipHeight(height) | ||
} | ||
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. remove |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
authority should support to be injected by user