Skip to content

Conversation

@317787106
Copy link
Contributor

What does this PR do?

Why are these changes required?

This PR has been tested by:

  • Unit Tests
  • Manual Testing

Follow up

Extra details

@317787106 317787106 changed the title hotfix(acurator): add more check for AssetIssueActuator fix(acurator): add more check for AssetIssueActuator Jan 26, 2026
int64 total_supply = 4;
repeated FrozenSupply frozen_supply = 5;
int32 trx_num = 6;
int32 trx_num = 6; // The fields trx_num and num are only used to calculate price and avoid usage of decimal, asset price = trx_num / num
Copy link
Contributor

Choose a reason for hiding this comment

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

Using // The fields trx_num and num define the exchange rate: num tokens can be purchased with trx_num TRX. This avoids using decimals. Example: trx_num=1, num=100 means 1 TRX buys 100 tokens. ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no need to use example in proto.

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, so what about using // The fields trx_num and num define the exchange rate: num tokens can be purchased with trx_num TRX. This avoids using decimals..

Consider using exchange rate instead of price—it might be more precise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK

}

@Test
public void SameTokenNameStartTimeTooBig() {

Choose a reason for hiding this comment

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

the uTest name is SameTokenNameStartTimeTooBig? what about add this check in issueTimeTest() above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is a hard fork condition, so use a new method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

change the name as issueStartTimeTooBig.

Copy link
Contributor

@waynercheung waynercheung left a comment

Choose a reason for hiding this comment

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

LGTM

if (chainBaseManager.getForkController().pass(ForkBlockVersionEnum.VERSION_4_8_1)) {
long frozenPeriod = next.getFrozenDays() * FROZEN_PERIOD;
try {
LongMath.checkedAdd(assetIssueContract.getStartTime(), frozenPeriod);
Copy link
Contributor

Choose a reason for hiding this comment

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

Use StrictMath.addExact ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LongMath.checkedAdd and StrictMath.addExact's implementations are same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer Math.addExact over LongMath.checkedAdd: both check for long overflow, but addExact is JDK-native, avoids Guava dependency, and ensures a single consistent implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

use StrictMathWrapper.addExact instead.

@kuny0707 kuny0707 merged commit 7251c60 into tronprotocol:release_v4.8.1 Jan 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

7 participants