forked from forbole/callisto
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: store software upgrade plan and refresh data at upgrade height (f…
…orbole#467) Closes: #XXXX jira: https://forbole.atlassian.net/browse/BDU-604 Background: Sifchain hard-coded `validator minimum commission` in a new release and updated it with `software upgrade`. Without any `MsgEditValidator` involved, the `validator commission %` could not be updated and were then incorrect. This PR stores `software upgrade proposal's upgrade plan` and uses the `upgrade` module to check if there's an upgrade plan at each height, if yes it will proceed with neccessary updates of data. Currently it's only updating the validator infos (the rest of the data I believe we have `periodic task` or `handle block` which should be enough). We can add more in the future if similar cases pop up. --- *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [x] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
- Loading branch information
1 parent
e2651d8
commit 54807f3
Showing
14 changed files
with
391 additions
and
40 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
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,10 @@ | ||
CREATE TABLE software_upgrade_plan | ||
( | ||
proposal_id INTEGER REFERENCES proposal (id) UNIQUE, | ||
plan_name TEXT NOT NULL, | ||
upgrade_height BIGINT NOT NULL, | ||
info TEXT NOT NULL, | ||
height BIGINT NOT NULL | ||
); | ||
CREATE INDEX software_upgrade_plan_proposal_id_index ON software_upgrade_plan (proposal_id); | ||
CREATE INDEX software_upgrade_plan_height_index ON software_upgrade_plan (height); |
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,21 @@ | ||
package types | ||
|
||
type SoftwareUpgradePlanRow struct { | ||
ProposalID uint64 `db:"proposal_id"` | ||
PlanName string `db:"plan_name"` | ||
UpgradeHeight int64 `db:"upgrade_height"` | ||
Info string `db:"info"` | ||
Height int64 `db:"height"` | ||
} | ||
|
||
func NewSoftwareUpgradePlanRow( | ||
proposalID uint64, planName string, upgradeHeight int64, info string, height int64, | ||
) SoftwareUpgradePlanRow { | ||
return SoftwareUpgradePlanRow{ | ||
ProposalID: proposalID, | ||
PlanName: planName, | ||
UpgradeHeight: upgradeHeight, | ||
Info: info, | ||
Height: height, | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
hasura/metadata/databases/bdjuno/tables/public_software_upgrade_plan.yaml
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,18 @@ | ||
table: | ||
name: software_upgrade_plan | ||
schema: public | ||
object_relationships: | ||
- name: proposal | ||
using: | ||
foreign_key_constraint_on: proposal_id | ||
select_permissions: | ||
- permission: | ||
allow_aggregations: true | ||
columns: | ||
- proposal_id | ||
- plan_name | ||
- upgrade_height | ||
- info | ||
- height | ||
filter: {} | ||
role: anonymous |
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.