-
Notifications
You must be signed in to change notification settings - Fork 113
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
HTS: Add support for token transactions to Importer #1089
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1089 +/- ##
=========================================
Coverage ? 87.71%
Complexity ? 234
=========================================
Files ? 219
Lines ? 5233
Branches ? 575
=========================================
Hits ? 4590
Misses ? 448
Partials ? 195
Continue to review full report at Codecov.
|
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/TokenBalance.java
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
...ter/src/main/java/com/hedera/mirror/importer/parser/record/entity/sql/SqlEntityListener.java
Outdated
Show resolved
Hide resolved
.../hedera/mirror/importer/parser/record/transactionhandler/TokenCreateTransactionsHandler.java
Outdated
Show resolved
Hide resolved
.../hedera/mirror/importer/parser/record/transactionhandler/TokenUpdateTransactionsHandler.java
Outdated
Show resolved
Hide resolved
...ror-importer/src/main/java/com/hedera/mirror/importer/repository/TokenBalanceRepository.java
Outdated
Show resolved
Hide resolved
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.
Review still in progress, but submitting what I have so you can address.
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/Token.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/Token.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/Token.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/Token.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/Token.java
Outdated
Show resolved
Hide resolved
...edera/mirror/importer/parser/record/transactionhandler/TokenUnfreezeTransactionsHandler.java
Outdated
Show resolved
Hide resolved
.../hedera/mirror/importer/parser/record/transactionhandler/TokenUpdateTransactionsHandler.java
Outdated
Show resolved
Hide resolved
.../hedera/mirror/importer/parser/record/transactionhandler/TokenCreateTransactionsHandler.java
Outdated
Show resolved
Hide resolved
...om/hedera/mirror/importer/parser/record/transactionhandler/TokenWipeTransactionsHandler.java
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/TokenAccount.java
Outdated
Show resolved
Hide resolved
...mirror-importer/src/test/java/com/hedera/mirror/importer/repository/TokenRepositoryTest.java
Outdated
Show resolved
Hide resolved
@@ -239,6 +255,21 @@ public void onLiveHash(LiveHash liveHash) throws ImporterException { | |||
liveHashes.add(liveHash); | |||
} | |||
|
|||
@Override | |||
public void onToken(Token token) throws ImporterException { | |||
tokenRepository.save(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.
These two repository calls will definitely slow things down. I haven't had time to verify if multiple calls to save will be internally batched. This might be fine for now but we'll need to revisit this next sprint.
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.
Agreed. This is best path to get the ball rolling but we definitely need to scale.
Challenge is each update needs to ensure it has the correct information from current state before updating.
e.g. A token gets created with a freeze and Kyc settings to default to FROZEN and REVOKED.
An account then Associates itself with the token, it will be frozen and revoked.
Say accounts it gets Unfrozen and then soon after gets GrantedKyc.
We need to make sure the persistence for the KycGrant picks the fact that it was unfrozen and doesn't accidentally revert the freeze state change.
That's why for now I'm just saving immediately, just like Entity updates do.
Currently using Spring cache so this should give us some breathing room to explore the right solution for Accounts and Tokens
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/TokenKycStatusEnum.java
Outdated
Show resolved
Hide resolved
hedera-mirror-importer/src/main/java/com/hedera/mirror/importer/domain/TokenAccount.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
.../src/main/java/com/hedera/mirror/importer/parser/record/entity/EntityRecordItemListener.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
Signed-off-by: Nana-EC <56320167+Nana-EC@users.noreply.github.com>
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.
LGTM
Detailed description:
To support the new Token HAPI, we should enhance our importer to import the new token transactions.
TransactionHandler
for each new transaction typeToken
,TokenAccount
andTokenTransfer
EntityListener
and its concrete implementations for the new entities withOnToken()
,OnTokenAccount()
andOnTokenTransfer()
EntityTypeEnum
andEntityId
with newTokenID
EntityRecordItemListener
to parse the new transaction types and create appropriate domain objects for persistenceTransactionHandlerFactory
to return appropriate Token transactionHandler on appropriate transactions typeTransactionTypeEnum
with Token transaction typesWhich issue(s) this PR fixes:
Fixes #1051
Special notes for your reviewer:
Checklist