-
Notifications
You must be signed in to change notification settings - Fork 814
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
[mint] Update mint distribution to be daily #718
Conversation
922ceae
to
76c2d92
Compare
case bytes.HasPrefix(key, minttypes.LastTokenReleaseDate): | ||
keyItems = append(keyItems, "LastTokenReleaseDate") |
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.
Not needed anymore
scripts/old_initialize_local.sh
Outdated
cat ~/.sei/config/genesis.json | jq --arg start_date "$(date +"%Y-%m-%d")" --arg end_date "$(date -v+3d +"%Y-%m-%d")" '.app_state["mint"]["params"]["token_release_schedule"]=[{"start_date": $start_date, "end_date": $end_date, "token_release_amount": "999999999999"}]' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json | ||
cat ~/.sei/config/genesis.json | jq --arg start_date "$(date -v+3d +"%Y-%m-%d")" --arg end_date "$(date -v+5d +"%Y-%m-%d")" '.app_state["mint"]["params"]["token_release_schedule"] += [{"start_date": $start_date, "end_date": $end_date, "token_release_amount": "999999999999"}]' > ~/.sei/config/tmp_genesis.json && mv ~/.sei/config/tmp_genesis.json ~/.sei/config/genesis.json |
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.
Two schedule for testing, first mint will occur in 1 min (epoch handler)
func SortTokenReleaseCalendar(tokenReleaseSchedule []ScheduledTokenRelease) []ScheduledTokenRelease { | ||
sort.Slice(tokenReleaseSchedule, func(i, j int) bool { | ||
startDate1, _ := time.Parse(TokenReleaseDateFormat, tokenReleaseSchedule[i].GetStartDate()) | ||
startDate2, _ := time.Parse(TokenReleaseDateFormat, tokenReleaseSchedule[j].GetStartDate()) | ||
return startDate1.Before(startDate2) | ||
}) | ||
return tokenReleaseSchedule |
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.
Sorted so it's easier to detect overlaps and search for next release window
string denom = 4 [ | ||
(gogoproto.moretags) = "yaml:\"denom\"" | ||
]; | ||
string start_date = 1; // yyyy-mm-dd |
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.
i think we'll need to consider migration? maybe you can sync with @udpatil who did the same with x/slashing
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.
Ah yeah, good point, thanks!
x/mint/keeper/hooks_test.go
Outdated
expectedAmount := int64(100000) | ||
newMinter := seiApp.MintKeeper.GetMinter(ctx) | ||
|
||
if i == 25 { |
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.
will we ever hit this?
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.
Fixed
}, | ||
}, | ||
{ | ||
name: "Unsorted schedule", |
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.
do we want to allow an unsorted schedule? seems like it could be potentially messy
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.
I think we can raise a panic if it's unsorted but at that point, I think just sorting it and storing it by default would be a better user interface.
require.Equal(t, postOutageTime.Format(minttypes.TokenReleaseDateFormat), newMinter.GetLastMintDate(), "Last mint date should be correct") | ||
require.InDelta(t, 127315, newMinter.GetLastMintAmountCoin().Amount.Int64(), 1, "Minted amount should be correct") | ||
require.InDelta(t, int64(1018522), int64(newMinter.GetRemainingMintAmount()), 24, "Remaining amount should be correct") | ||
}) |
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.
can we finish the mitn release cycle and ensure all tokens are released?
app/upgrades.go
Outdated
@@ -62,6 +62,7 @@ var upgradesList = []string{ | |||
"2.0.44beta", | |||
"2.0.45beta", | |||
"2.0.46beta", | |||
"2.0.46beta-bweng-test", |
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.
mighht want to revert this before merge
|
Describe your changes and provide context
Will follow up with another PR to add a gov prop with updating the current release minter.
Previously the mint rewards are distributed to the block immediately following the mint event, this PR makes it such that the mints are distributed daily over a period of time (as defined in the mint parms). This incentivizes users to stake for longer periods of time rather just for the mint event.
This pretty much rewrites the entire mint module
Testing performed to validate your change
Unit test for individual methods and overall hook test
Simple e2e test:
Going to spin up a loadtest cluster and let it run for a couple of days and use metrics to observe mint events (final verification)
Tested upgrade path locally:
Before
After