-
Notifications
You must be signed in to change notification settings - Fork 78
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
Update deltaStalkEarnedPerSeason to int32 #1092
Update deltaStalkEarnedPerSeason to int32 #1092
Conversation
@@ -316,7 +316,7 @@ struct AssetSettings { | |||
int96 milestoneStem; // │ 12 (30) | |||
bytes1 encodeType; // │ 1 (31) | |||
// one byte is left here. ──┘ 1 (32) | |||
int24 deltaStalkEarnedPerSeason; // ────┐ 3 | |||
int32 deltaStalkEarnedPerSeason; // ────┐ 3 |
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.
the comments should be updated based on this (i.e, this is now 4 bytes instead of 3), and the summation is now different.
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.
@@ -458,19 +459,19 @@ library LibGerminate { | |||
if (s.sys.silo.assetSettings[token].milestoneSeason < s.sys.season.current) { | |||
prevStalkEarnedPerSeason = s.sys.silo.assetSettings[token].stalkEarnedPerSeason; | |||
} else { | |||
int24 deltaStalkEarnedPerSeason = s | |||
int64 deltaStalkEarnedPerSeason = s |
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 this be int32?
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.
yes, a leftover from experimenting with different sizes: 9249efd#diff-d2261445685829aad9421eae03f9644ae9d11be5713ccc0870497a0be1e58d8aR462
.sys | ||
.silo | ||
.assetSettings[token] | ||
.deltaStalkEarnedPerSeason; | ||
if (deltaStalkEarnedPerSeason >= 0) { | ||
prevStalkEarnedPerSeason = | ||
s.sys.silo.assetSettings[token].stalkEarnedPerSeason - | ||
uint32(int32(deltaStalkEarnedPerSeason)); | ||
uint32(uint64(deltaStalkEarnedPerSeason)); |
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.
why is this casted to a uint64, then a uint32?
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.
yes, a leftover from experimenting with different sizes: 9249efd#diff-d2261445685829aad9421eae03f9644ae9d11be5713ccc0870497a0be1e58d8aR470
@@ -204,7 +204,7 @@ library LibWhitelist { | |||
|
|||
// stalkEarnedPerSeason is set to int32 before casting down. | |||
s.sys.silo.assetSettings[token].deltaStalkEarnedPerSeason = (int32(stalkEarnedPerSeason) - | |||
int32(s.sys.silo.assetSettings[token].stalkEarnedPerSeason)).toInt24(); | |||
int32(s.sys.silo.assetSettings[token].stalkEarnedPerSeason)).toInt32(); |
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.
surrounding the s.sys.silo.assetSettings[token].stalkEarnedPerSeason
with a int32 and casting down to a toInt32 is unnecessary.
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.
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.
Please update the PR with the changes noted in the comments.
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.
Please update the PR with the changes noted in the comments.
Update deltaStalkEarnedPerSeason to int32 to prevent overflow on sunrise upon reseed.