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

feat(api): check if scalingFactor is bigger than 0 #5746

Merged

Conversation

317787106
Copy link
Contributor

@317787106 317787106 commented Mar 5, 2024

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 base branch from develop to release_v4.7.4 March 5, 2024 11:15

try {
TransactionCapsule trxCap = createTransactionCapsule(trigger,
ContractType.TriggerSmartContract);
trx = triggerConstantContract(trigger, trxCap, trxExtBuilder, retBuilder);
Transaction trx = triggerConstantContract(trigger, trxCap, trxExtBuilder, retBuilder);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this need to be handled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This part is rollback to 4.7.3.

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this part of the direct rollback ? I see the previous analysis which is also wrong

Copy link
Contributor Author

@317787106 317787106 Mar 5, 2024

Choose a reason for hiding this comment

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

Only this part is new added:

if (scalingFactor.compareTo(BigInteger.ZERO) <= 0) {
      throw new ContractValidateException("scalingFactor must be positive");
}

Other part is still same as before. Check the condition outside this method is not only easy to understand and but also include all conditions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@halibobo1205 what's wrong with previous analysis? This optimization is to coverage this additional case: contract and method scalingFactor are both exist, but it really return 0.

@317787106 317787106 merged commit 074e0d6 into tronprotocol:release_v4.7.4 Mar 6, 2024
5 checks passed
@halibobo1205 halibobo1205 added this to the GreatVoyage-v4.7.4 milestone Mar 7, 2024
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.

None yet

3 participants