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

fix upgrade storage plan end date calculation and add upgrade-storage cli cmd #233

Merged

Conversation

dahn510
Copy link
Member

@dahn510 dahn510 commented Feb 1, 2023

There is a miscalculation in storage plan end date. canine-chain/msg_server_upgrade_storage.go at a39271478a28f936e1c787a736532c89ffe31671 · JackalLabs/canine-chain

Month time of type time.Time multiplied with upgrade duration of type time.Duration large enough (like a month) will create integer overflow and result in end date being earlier than current time.

The fix removes timeMonth * timeDuration and End date is calculated as ctx.BlockTime().Add(duration).

@dahn510 dahn510 closed this Feb 1, 2023
@dahn510 dahn510 reopened this Feb 1, 2023
@dahn510 dahn510 self-assigned this Feb 2, 2023
@dahn510 dahn510 changed the title fix upgrade storage plan end date calculation fix upgrade storage plan end date calculation and add upgrade-storage cli cmd Feb 2, 2023
@dahn510
Copy link
Member Author

dahn510 commented Feb 2, 2023

Missing cli cmd for upgrade-storage cmd has been added.

@nuggetnchill
Copy link
Member

Missing cli cmd for upgrade-storage cmd has been added.

good catch, definitely my bad for forgetting that cli cmd

@@ -29,7 +29,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdCancelContract())
cmd.AddCommand(CmdBuyStorage())
cmd.AddCommand(CmdClaimStray())
// this line is used by starport scaffolding # 1
cmd.AddCommand(CmdUpgradeStorage())
Copy link
Member

Choose a reason for hiding this comment

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

Good catch, can't believe I left that out

Copy link
Member

@TheMarstonConnell TheMarstonConnell left a comment

Choose a reason for hiding this comment

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

Really cleaned this up thank you!

@TheMarstonConnell TheMarstonConnell merged commit 16cfa0d into bouncy-bulldog-rc Feb 2, 2023
@TheMarstonConnell TheMarstonConnell deleted the JKL-240-upgrade-storage-duration-fix branch February 2, 2023 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants