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(mechanism): optimize address parsing of stake interfaces #5419
feat(mechanism): optimize address parsing of stake interfaces #5419
Conversation
transactionLogTrigger.setFromAddress(StringUtil | ||
.encode58Check(unfreezeBalanceContract.getOwnerAddress().toByteArray())); | ||
} | ||
if (Objects.nonNull(unfreezeBalanceContract.getReceiverAddress())) { |
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 frequency of these if statements is too high, you can encapsulate a function.
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.
OK, Ok, I encapsulate the code
framework/src/main/java/org/tron/common/logsfilter/capsule/TransactionLogTriggerCapsule.java
Outdated
Show resolved
Hide resolved
transactionLogTrigger.setFromAddress(StringUtil | ||
.encode58Check(freezeBalanceV2Contract.getOwnerAddress().toByteArray())); | ||
} | ||
transactionLogTrigger.setAssetAmount(freezeBalanceV2Contract.getFrozenBalance()); |
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.
transactionLogTrigger.setAssetName("trx");
?
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.
OK,I get it.
transactionLogTrigger.setToAddress(StringUtil | ||
.encode58Check(delegateResourceContract.getReceiverAddress().toByteArray())); | ||
} | ||
transactionLogTrigger.setAssetAmount( |
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.
transactionLogTrigger.setAssetName("trx");
?
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.
OK,I get it.
…nto feature/optimize_transaction_address_parsing_v2
if (Objects.nonNull(withdrawExpireUnfreezeContract)) { | ||
transactionLogTrigger.setFromAddress(StringUtil.encode58Check( | ||
withdrawExpireUnfreezeContract.getOwnerAddress().toByteArray())); | ||
transactionLogTrigger.setAssetAmount(transactionInfo.getWithdrawExpireAmount()); |
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.
transactionLogTrigger.setAssetName("trx");
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.
OK, I get it
WithdrawExpireUnfreezeContract withdrawExpireUnfreezeContract = contractParameter | ||
.unpack(WithdrawExpireUnfreezeContract.class); | ||
|
||
if (Objects.nonNull(withdrawExpireUnfreezeContract)) { |
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.
contract cannot be null.
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.
OK, I get it
UnfreezeBalanceContract unfreezeBalanceContract = contractParameter | ||
.unpack(UnfreezeBalanceContract.class); | ||
|
||
if (Objects.nonNull(unfreezeBalanceContract)) { |
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.
contract cannot be null.
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.
OK, I get it
FreezeBalanceV2Contract freezeBalanceV2Contract = contractParameter | ||
.unpack(FreezeBalanceV2Contract.class); | ||
|
||
if (Objects.nonNull(freezeBalanceV2Contract)) { |
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.
contract cannot be null.
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.
OK, I get it
UnfreezeBalanceV2Contract unfreezeBalanceV2Contract = contractParameter | ||
.unpack(UnfreezeBalanceV2Contract.class); | ||
|
||
if (Objects.nonNull(unfreezeBalanceV2Contract)) { |
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.
contract cannot be null.
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.
OK, I get it
DelegateResourceContract delegateResourceContract = contractParameter | ||
.unpack(DelegateResourceContract.class); | ||
|
||
if (Objects.nonNull(delegateResourceContract)) { |
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.
contract cannot be null.
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.
OK, I get it
UnDelegateResourceContract unDelegateResourceContract = contractParameter | ||
.unpack(UnDelegateResourceContract.class); | ||
|
||
if (Objects.nonNull(unDelegateResourceContract)) { |
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.
contract cannot be null.
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.
OK, I get it
CancelAllUnfreezeV2Contract cancelAllUnfreezeV2Contract = contractParameter | ||
.unpack(CancelAllUnfreezeV2Contract.class); | ||
|
||
if (Objects.nonNull(cancelAllUnfreezeV2Contract)) { |
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.
contract cannot be null.
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.
OK, I get it
…_address_parsing_v2
…_address_parsing_v2
if (!ByteString.EMPTY.equals(unfreezeBalanceContract.getReceiverAddress())) { | ||
transactionLogTrigger.setToAddress(StringUtil | ||
.encode58Check(unfreezeBalanceContract.getReceiverAddress().toByteArray())); | ||
} |
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.
Does this need to be added?
transactionLogTrigger.setAssetName("trx");
transactionLogTrigger.setAssetAmount(transactionInfo.getUnfreezeAmount());
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.
OK, I get it
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more. @@ Coverage Diff @@
## develop #5419 +/- ##
=============================================
+ Coverage 61.35% 61.41% +0.05%
- Complexity 9348 9351 +3
=============================================
Files 846 846
Lines 50211 50273 +62
Branches 5583 5584 +1
=============================================
+ Hits 30805 30873 +68
+ Misses 17002 16981 -21
- Partials 2404 2419 +15
... and 7 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
…_address_parsing_v2
What does this PR do?
optimize address parsing of stake interfaces, close #5411
Why are these changes required?
This PR has been tested by:
Follow up
Extra details