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

Expire records directly from FCM, not thru transactional proxy #1422

Closed
tinker-michaelj opened this issue May 17, 2021 · 0 comments · Fixed by #1458
Closed

Expire records directly from FCM, not thru transactional proxy #1422

tinker-michaelj opened this issue May 17, 2021 · 0 comments · Fixed by #1458
Assignees
Labels
Performance Issues related to performance concerns.
Milestone

Comments

@tinker-michaelj
Copy link
Collaborator

tinker-michaelj commented May 17, 2021

Summary

When records are in state, in each transaction the FCQ of the payer account in the FCM receives an ExpirableTxnRecord. The first transaction in each second of consensus time will trigger the expiration of all the records added 180 seconds earlier.

Both adding and expiring records are done through the HederaLedger, which provides transactional semantics for a change-set against the accounts FCM. This provides atomicity for the business logic of a user transaction, so that if an unexpected problem occurs, we do not make an inconsistent change to the state.

However, there is no real benefit to including record creation and expiration in this transaction; and it incurs extra performance costs.


Suggested resolution

Instead of changing account FCQs through the proxied AccountProperty.RECORDS getter/setter combination, we can:

  • For creation, inject the ExpiringCreations with a supplier for the accounts FCM and modify the payer account with its new record directly in createExpiringRecord.
  • For expiration, inject the ExpiryManager with a supplier for the accounts FCM and modify the accounts with expiring records directly in purgeExpiredRecords().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Performance Issues related to performance concerns.
Projects
None yet
2 participants