-
Notifications
You must be signed in to change notification settings - Fork 131
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
Alias fee schedule support #2774
Alias fee schedule support #2774
Conversation
…ure scneraios in sigRequirements Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
@@ -120,8 +127,15 @@ | |||
return MISSING_FEE_COLLECTOR_RESULT; | |||
} | |||
|
|||
@Override | |||
public SigningOrderResult<ResponseCodeEnum> forMissingTokenTreasury() { | |||
return MISSING_TOKEN_TRASURY; |
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.
typo TREASURY
@@ -584,14 +585,26 @@ public ResponseCodeEnum update(final TokenUpdateTransactionBody changes, final l | |||
|
|||
private AliasLookup checkNewAutoRenewAccount(final TokenUpdateTransactionBody changes) { | |||
if (changes.hasAutoRenewAccount()) { | |||
return lookUpAccountId(changes.getAutoRenewAccount(), INVALID_AUTORENEW_ACCOUNT); | |||
final var autoRenewLookUp = lookUpAccountId(changes.getAutoRenewAccount(), INVALID_ALIAS_KEY); |
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 return INVALID_AUTORENEW_ACCOUNT
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 made it into 2 parts. first we look up the alias key. If found and its not a usable accountId we return INVALID_AUTORENEW_ACCOUNT
but if that alias is not found we return INVALID_ALIAS_KEY
. I open to change it though.
if (treasuryLookUp.response() != OK) { | ||
return treasuryLookUp; | ||
} else { | ||
final var validity = usableOrElse(treasuryLookUp.resolvedId(), INVALID_TREASURY_ACCOUNT_FOR_TOKEN); |
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 do usableOrElse
inside lookUpAccountId
?
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.
that is what we did previously.
/* I dont think we need these checks as it is handled just aftet these checks */ | ||
// if (chunkAccountIDLookup.response() != OK) { | ||
// transactionContext.setStatus(chunkAccountIDLookup.response()); | ||
// } | ||
// if (transactionIDLookup.response() != OK) { | ||
// transactionContext.setStatus(transactionIDLookup.response()); | ||
// } |
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 are we removing these ?
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 was actually not sure why we didn't return
after the err response for each.
@@ -204,7 +204,7 @@ private boolean canApplyNewAutoRenewAccount(ConsensusUpdateTopicTransactionBody | |||
return true; | |||
} | |||
|
|||
final var result = ledger.lookUpAccountId(op.getAutoRenewAccount(), INVALID_AUTORENEW_ACCOUNT); | |||
final var result = ledger.lookUpAccountId(op.getAutoRenewAccount()); |
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.
Need to give INVALID_AUTORENEW_ACCOUNT
as response
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.
Again, that will be handled just below this on line 222
@@ -87,6 +86,12 @@ public void doStateTransition() { | |||
txnCtx.setStatus(result.response()); | |||
return; | |||
} | |||
var validity = ledger.usableOrElse(result.resolvedId(), INVALID_ACCOUNT_ID); |
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.
may be we should give result.response()
instead of INVALID_ACCOUNT_ID
. Same in all places
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.
here result.response()
will be OK
right ?
|
||
if (ledger.isDetached(id) || ledger.isDetached(beneficiary)) { | ||
txnCtx.setStatus(ACCOUNT_EXPIRED_AND_PENDING_REMOVAL); | ||
validity = ledger.usableOrElse(result.resolvedId(), INVALID_ACCOUNT_ID); |
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.
same here
@@ -171,6 +171,7 @@ private ResponseCodeEnum sanityCheck(AccountID target, HederaAccountCustomizer c | |||
if (result.response() != OK) { | |||
return result.response(); | |||
} | |||
return ledger.usableOrElse(result.resolvedId(), INVALID_ACCOUNT_ID); |
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.
here as well
// final var customFeeList = op.getCustomFeesList(); | ||
// for (var fee : customFeeList) { | ||
// if (fee.hasFeeCollectorAccountId()) { | ||
// final var feeCollector = fee.getFeeCollectorAccountId(); | ||
// final var feeCollectorNum = accountStore.getAccountNumFromAlias(feeCollector.getAlias(), feeCollector.getAccountNum()); | ||
// final var feeCollectorId = new Id(feeCollector.getShardNum(), feeCollector.getRealmNum(), feeCollectorNum); | ||
// accountStore.loadAccountOrFailWith(feeCollectorId, INVALID_ACCOUNT_ID); | ||
// } | ||
// } |
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 these be removed?
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.
yup, can be removed. The feeCollector validation is actually already done in sigRequirements.
// given(validator.isAfterConsensusSecond(expiry)).willReturn(false); | ||
// given(accountsLedger.exists(testId)).willReturn(true); | ||
// given(accountsLedger.get(testId, IS_DELETED)).willReturn(false); | ||
// given(accountsLedger.get(testId, IS_SMART_CONTRACT)).willReturn(false); | ||
// given(accountsLedger.get(testId, BALANCE)).willReturn(balance); | ||
// given(accountsLedger.get(testId, EXPIRY)).willReturn(expiry); | ||
// | ||
// assertEquals(ACCOUNT_EXPIRED_AND_PENDING_REMOVAL, subject.usableOrElse(testId, ACCOUNT_DELETED)); |
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.
same here
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.
This needs fixing. Will uncomment and fix
Signed-off-by: anighanta <[email protected]>
Codecov Report
@@ Coverage Diff @@
## 02691-M-ExtendAliasSupport #2774 +/- ##
================================================================
+ Coverage 95.67% 95.70% +0.02%
- Complexity 9676 9679 +3
================================================================
Files 700 700
Lines 26570 26569 -1
Branches 2738 2733 -5
================================================================
+ Hits 25422 25428 +6
+ Misses 601 598 -3
+ Partials 547 543 -4
Continue to review full report at Codecov.
|
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
Signed-off-by: anighanta <[email protected]>
@@ -120,7 +120,7 @@ private ResponseCodeEnum validityOf( | |||
} else if (op.hasAccountID()) { | |||
final var result = aliasManager.lookUpAccountID(op.getAccountID()); | |||
if (result.response() != OK) { | |||
return result.response(); | |||
return INVALID_ACCOUNT_ID; |
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 result.response()
Description:
Related issue(s):
addresses #2691
Notes for reviewer:
Checklist