Skip to content

Commit

Permalink
HIP-17: Update HTS with NFT suppport (#1615)
Browse files Browse the repository at this point in the history
* Refactored nfts (#1614)
Signed-off-by: Daniel <Daniel.K.Ivanov95@gmail.com>

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* fix build (#278)

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>
Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Refactored nfts touchups (#1626)

* Use 0.15.0 hapi-proto

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try adding missing TOKEN_MAX_SUPPLY_REACHED constant

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try removing Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix some CI issues

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize other failing EET in CI

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Feature: Unique Token Burn operation (#1627)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Use 0.15.0 hapi-proto

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try adding missing TOKEN_MAX_SUPPLY_REACHED constant

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try removing Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fixes after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Unique token burn (#275)

* burn method signature

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Initial burn implementation

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add unit tests for unique burn and mint

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add serial numbers to receipt

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More coverage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fees for token burn tx

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More E2E and unit.Update prechecks

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fixes after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More fixes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More e2e + usages

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Cosmetic fixes - license

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Change fungible transfers on NFT transfer

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Move stores.persist login in state transition + coverage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Implement requested PR changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* unit test: any -> eq where possible

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* nit fix

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Remove CryptoTransferUsage and resp. test
Update NftAdjustments
Update UsagePricesProvider

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Update fee files for failing unit tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fix failing unit test

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: tinker-michaelj <michael.tinker@hedera.com>

* Added nfts e2e (#1635)

* Use 0.15.0 hapi-proto

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try adding missing TOKEN_MAX_SUPPLY_REACHED constant

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try removing Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* + nft transfer E2E (#279)

+ nft transfer E2E

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + nft transfer E2E

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>
Signed-off-by: daniel-danev-limechain <daniel.danev@limechain.tech>

Co-authored-by: tinker-michaelj <michael.tinker@hedera.com>
Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Refactored nfts plus master (#1645)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Roll to SDK 0.15.1 (#1618)

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use 0.15.0 hapi-proto

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try adding missing TOKEN_MAX_SUPPLY_REACHED constant

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Try removing Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fixes after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* 01621: Added explicit DENY all clause to top level filters (#1622)

Signed-off-by: Nathan Klick <nathan@swirlds.com>

* Remove gRPC types from HederaLedger zero-sum transfers API to use  (#1616)

* Replace SigMapPubKeyToSigBytes with POJO version

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Reuse expiringEntities ArrayList in AwareTransactionContext

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add license headers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix code smells

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Initial commit, disabling CI for now

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Introduce PureTransferSemanticChecks

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Before semanticCheck argument type migration

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Prioritize validateSemantics

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Extract CryptoTransfer semantic checks into PureTransferSemanticChecks

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Remove unnecessary injection from ContextOptionalValidator

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Start LedgerBalanceChangesTest

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Disable unit test for now

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Switch HederaLedger zeroSum transfers API to non-GRPC types

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Finish transition logic for scheduled CryptoTransfers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Finalize ImpliedTransfersMarshal

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Permit override of response code to be used for an insufficient balance in zero-sum transfers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Permit overriding INSUFFICIENT_TOKEN_BALANCE response code

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use faster implementations for MerkleEntityId hashCode/equals

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use INSUFFICIENT_TOKEN_BALANCE as default code for token balance change

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Extract functions to please Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc, remove more code smells

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add more javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix typo in Javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Address reviewer comments

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Remove public setter for codeForInsufficientBalance.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Simplify the code and avoid exposing unnecessary setters in BalanceChange.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Add safety check on noTokenForHbarAdjust.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>

* Unique token burn (#275)

* burn method signature

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Initial burn implementation

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add unit tests for unique burn and mint

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add serial numbers to receipt

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More coverage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fees for token burn tx

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More E2E and unit.Update prechecks

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fixes after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More fixes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* More e2e + usages

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Cosmetic fixes - license

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Change fungible transfers on NFT transfer

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Move stores.persist login in state transition + coverage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Implement requested PR changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* unit test: any -> eq where possible

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* nit fix

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Remove CryptoTransferUsage and resp. test
Update NftAdjustments
Update UsagePricesProvider

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Update fee files for failing unit tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Begin 0.16.0 development iteration (#1584)

* [maven-release-plugin] Create release branch

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* [maven-release-plugin] prepare for next development iteration

* Add SelfSerializable representation of a custom fee (fixed or fractional) (#1624)

* Implement CustomFee

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add unit tests

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add missing license header.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Add javadoc and equals/hashCode/toString methods for convenience

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>

* Begin compartmentalized use of NftsLedger for atomic CryptoTransfer

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add NFT support to TokenStore.tryTokenChange()

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit tests

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize CI and address reviewer comments

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize TokenManagementSpecs

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: Yoan Sredkov <yoansredkov@gmail.com>
Co-authored-by: Nathan Klick <nathanklick@users.noreply.github.com>
Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>

* resolve unit test failures & making sure that E2E tests pass

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Feature: Integration of One-To-Many Data Structure (#1668)

* Feature: One to many data structure (#287)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix build (#278)

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* add swirlds alpha version

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Replace invertible with new structures

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unfinished work

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Enable function

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring and replacement

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Ownership Change on Mint

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unique Token Ownership Transfer on NFT Transfer

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge Conflicts and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Association and disassociation

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* PR Comments Resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* remove fc invertible map & rename properties

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Coverage fix and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* rename getter

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* Keep FCOTMRs in-sync with mutable state (#1674)

* Add (temporary) default prices for WipeAccount

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>
Signed-off-by: Michael Tinker <michael.tinker@hedera.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@hedera.com>

* Tests: Increase Unit Test coverage on NFTs (#1688)

* Feature: One to many data structure (#287)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix build (#278)

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* add swirlds alpha version

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Replace invertible with new structures

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unfinished work

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Enable function

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring and replacement

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Ownership Change on Mint

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unique Token Ownership Transfer on NFT Transfer

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge Conflicts and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Association and disassociation

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* PR Comments Resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* remove fc invertible map & rename properties

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Coverage fix and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* rename getter

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* Keep FCOTMRs in-sync with mutable state (#1674)

* Add (temporary) default prices for WipeAccount

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Code coverage  (#308)

* initial unit tests for coverage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>
Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* More tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* 1 more for TypedTokenStore

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>
Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Add test for UniqueToken

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Update outdated tests after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Fix metadata on UniqueTokenTest

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Feature: Integration of One-To-Many Data Structure (#1668)

* Feature: One to many data structure (#287)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix build (#278)

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* add swirlds alpha version

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Replace invertible with new structures

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unfinished work

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Enable function

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring and replacement

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Ownership Change on Mint

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unique Token Ownership Transfer on NFT Transfer

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge Conflicts and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Association and disassociation

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* PR Comments Resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* remove fc invertible map & rename properties

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Coverage fix and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* rename getter

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* Keep FCOTMRs in-sync with mutable state (#1674)

* Add (temporary) default prices for WipeAccount

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>
Signed-off-by: Michael Tinker <michael.tinker@hedera.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@hedera.com>

* more tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@hedera.com>

* fix after merge

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* + increasing code coverage (#288)

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increasing code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + added TokenGetNftInfosQuery implementation

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* + increase code coverage

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix unit test bug

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* fix requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* add wipe default fee data to resolve issue

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* fix formatting

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* fix formatting

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <yoansredkov@gmail.com>

* revert accidental change

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* fix licenses

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@hedera.com>
Co-authored-by: daniel-danev-limechain <daniel.danev@limechain.tech>

* Re-resolve merge conflicts with master (#1696)

* HIP-18 Changes for ExpirableTxnRecord (#1649)

* Replace SigMapPubKeyToSigBytes with POJO version

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Reuse expiringEntities ArrayList in AwareTransactionContext

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add license headers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix code smells

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Initial commit, disabling CI for now

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Introduce PureTransferSemanticChecks

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Before semanticCheck argument type migration

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Prioritize validateSemantics

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Extract CryptoTransfer semantic checks into PureTransferSemanticChecks

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Remove unnecessary injection from ContextOptionalValidator

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Start LedgerBalanceChangesTest

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Disable unit test for now

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Switch HederaLedger zeroSum transfers API to non-GRPC types

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Finish transition logic for scheduled CryptoTransfers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* initial commit to use 0.16.0-snapshot

* Finalize ImpliedTransfersMarshal

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Permit override of response code to be used for an insufficient balance in zero-sum transfers

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Permit overriding INSUFFICIENT_TOKEN_BALANCE response code

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use faster implementations for MerkleEntityId hashCode/equals

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use INSUFFICIENT_TOKEN_BALANCE as default code for token balance change

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Extract functions to please Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc, remove more code smells

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add more javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix typo in Javadoc

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* add BalanceChange list to ExpirableTxnRecord

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add CustomFees for the record from CryptoTransferTransitionLogic

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Merge 'master' into 1590-M-Update-TxnRecordService

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix failing tests

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add to another list for custom fees

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add changes for computing customFees in ImpliedTransfersMarshal

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add CustomFeesBalanceChangeTest

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix failing SpanMapManagerTest.java

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add serialize and deserialize tests for ExpirableTxnRecord

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix tests

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix no args constructor

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* uncomment LedgerBalanceChangesTest

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Add ImpliedTransfersMarshalTest

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add some more tests

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add tests to ImpliedTransfersMarshalTest for fractional fee

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* more test coverage

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Full coverage for CustomFeesBalanceChange.java

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add re-calculation of custom fee schedules based on FCMap implementation

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix code smells

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add FCMCustomFeeSchedulesTest.java and fix javadocs

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix failing test

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add division by zero test

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* remove unnecessary creations of other ArrayLists

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* return void

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Modify the logic in ImpliedTransfersMarshal

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix test and refactor the code

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* misc typo fixes

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix review comments

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

Co-authored-by: tinker-michaelj <michael.tinker@hedera.com>
Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>

* 1654 EET for TokenUpdate with CustomFees (#1662)

* Add CustomFees support in HapiTokenUpdate.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Add scenarios that fail on TokenUpdate.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Add scenario that successfully update token.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Fix typos.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Fix defaultFailingHapiSpec to override CI Props.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* HAPIClientValidator does not support FAILED_AS_EXPECTED spec yet. Turn this spec off.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

* Update BalanceChange to use Id instead of EntityId (#1665)

* update balance change to use ID

* add setter for codeForInsufficientBalance so that INSUFFICIENT_PAYER_BALANCE_FOR_CUSTOM_FEE can be set while adding custom fees

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add condition for payer

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix misc

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix failing tests

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix BalanceChangeTest

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Feature: One to many data structure (#287)

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix build (#278)

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* add swirlds alpha version

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Replace invertible with new structures

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unfinished work

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Enable function

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring and replacement

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Ownership Change on Mint

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unique Token Ownership Transfer on NFT Transfer

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge Conflicts and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Association and disassociation

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* PR Comments Resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* remove fc invertible map & rename properties

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Coverage fix and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* rename getter

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* Initial Draft for GCP set up and steps to run JRS in services (#1620)

* initial doc with headers

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add some basic info

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix headers

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add GCP set up guide

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix other spaces

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add a png

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add image

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix typos

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix comments from Ron

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add some pics

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix pics

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* fix the pics

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* add an example personal JSON

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* address review comments

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* Always reset assessedCustomFees to null in AwareTransactionContext (#1673)

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Update for alpha.1 HIP-18 protos (#1671)

* Fix compile errors with post-review HIP-18 protobufs

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Complete migration to 0.16.0-alpha.1 protos

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Rename tokenFeeSchedules field

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Always reset assessedCustomFees to null in AwareTransactionContext

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fail fast in fee spec factories

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Minor improvements.

Signed-off-by: Quan Nguyen <quan.nguyen@hedera.com>

Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>

* Add (temporary) default prices for WipeAccount

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix compile errors

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Update record forensics (#1677)

* Hmm

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Update and simplify test comparing consensus/ISS record streams

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Ignore deleted tokens when rebuilding knownTreasuries (#1679)

* Ignore deleted tokens when rebuilding knownTreasuries; disable FCM dumps by default

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Use stable protobufs

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Reviewer comment

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Add custom fee resources usage into cryptoTransfer fee calculation. (#1666)

* Add custom fee resources usage into cryptoTransfer fee calculation.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Fix code smell and test coverage.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* # This is a combination of 4 commits.
# This is the 1st commit message:

Try to fix the INSUFFICIENT_TX_FEE for some EET tests.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

# This is the commit message #2:

Validate more tests.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

# This is the commit message #3:

Why these tests fail in CircleCi?

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

# This is the commit message #4:

Re-implement transfer fee calculation.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Re-implement custom fee usage calculation.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Add several scenarios for TokenCreate with negative custom fees.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Add more scenarios for transfer.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Removed not needed custom fee key.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* Changes per comments.

Signed-off-by: ljianghedera <leo.jiang@hedera.com>

* 01680: Fix log4j2 issue that resulted in empty hgcaa.log file (#1681)

- Refactor filters by moving out of the global space and into a Logger space
- Define a new com.swirlds logger to contain the filters
- Remove filters from Root logger
- Change Root logger level to FATAL as a last resort catch-all

Signed-off-by: Nathan Klick <nathan@swirlds.com>

* Reconnect test with an account dissociation from a deleted token (#1684)

* add a new token reconnect scenario

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* modify comment

Signed-off-by: Neeharika-Sompalli <neeharika.sompalli@hedera.com>

* 01574-master-javaDocAdded (#1660)

* Javadoc Added

* Styling updated for JavaDoc

* JavaDoc Warnings

* JavaDoc Warnings

* Javadoc

* Javadoc

* Javadoc

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Refactored nfts touchups

Signed-off-by: Michael Tinker <michael.tinker@hedera.com>

* Refactored nfts plus master

Signed-off-by: Michael Tinker <michael.tinker@hedera.com>

Co-authored-by: Neeha <52669918+Neeharika-Sompalli@users.noreply.github.com>
Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>
Co-authored-by: Quan Nguyen <45947300+qnswirlds@users.noreply.github.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: ljianghedera <55505519+ljianghedera@users.noreply.github.com>
Co-authored-by: Nathan Klick <nathanklick@users.noreply.github.com>
Co-authored-by: amckay7777 <amckay7777@gmail.com>

* add forgotten changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Nfts: Code Coverage Increase (#1713)

* add forgotten changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Token Nft Info Answer Unit Tests (#315)

* Token Nft Info Answer Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Coverage unit tests (#316)

* context unit tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* SeqNoEntityIdSource unit tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Burn usage missing test

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add ContextOptionValidator missing tests

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* Add coverage for token mint usage

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* update token mint usage logic

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* pr changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* fix all requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* refactor missed metadata test

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* cleanup

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <yoansredkov@gmail.com>

* Re-enable Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix config.yml spacing

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix compile error

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Sync config.yml

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* CI-enabled #1712 (#1723)

* Unit tests after refactoring

Signed-off-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>

* add MerkleUniqueToken and MerkleUniqueTokenId

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* save changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* add all necessary hedera-node changes

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* resolve queries and resolve compilation failures

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* services state update

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Unit tests after refactoring (#274)

* Fix most of unit tests but 7

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* all but 1

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* PR requested changes

Signed-off-by: Yoan Sredkov <yoansredkov@gmail.com>

* NFTs: Refactored E2E (#273)

* Adapted E2E Scenarios after major refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored nfts transfers (#277)

Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

#182 ! merging nft transfers

Signed-off-by: Daniel Danev <daniel.danev@limechain.tech>

* fix build (#278)

Signed-off-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* add swirlds alpha version

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Replace invertible with new structures

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unfinished work

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Enable function

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring and replacement

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Ownership Change on Mint

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unique Token Ownership Transfer on NFT Transfer

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge Conflicts and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Association and disassociation

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Minor change

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* PR Comments Resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* remove fc invertible map & rename properties

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Coverage fix and refactoring

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Refactored Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Nfts: Get Account NFT Infos Query

* Get Nft Account Infos Query

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Merge conflicts

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Query Range Response Code Renaming

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Remove unnecessary stuff

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Nit resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* FeeSchedules Revert

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* FeeSchedules Revert

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* Re-enable Sonar

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix unit test

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Fix Sonar bugs

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Stabilize CI (add TokenGetAccountNftInfos to ExpectedCustomThrottles)

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

* Quans comments resolution

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* make naming consistent + fix unit tests

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>
Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>

* Feat/burn bug and unit tests internal (#319) (#1724)

* resolve burn issue and add unit tests

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Additional Unit Tests

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* E2E HapiGetAccountNftInfos Modification

Signed-off-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>

* resolve unit test comments

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* rename unittest

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

Co-authored-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* fix sonar issue

Signed-off-by: Daniel Ivanov <daniel.k.ivanov95@gmail.com>

* Add unit test to trigger CI

Signed-off-by: tinker-michaelj <michael.tinker@hedera.com>

Co-authored-by: Yoan Sredkov <48679375+joan41868@users.noreply.github.com>
Co-authored-by: Georgi Yazovaliyski <georgi.yazovaliiski@gmail.com>
Co-authored-by: daniel-danev-limechain <84330934+daniel-danev-limechain@users.noreply.github.com>
Co-authored-by: Michael Tinker <michael.tinker@hedera.com>
Co-authored-by: Yoan Sredkov <yoansredkov@gmail.com>
Co-authored-by: daniel-danev-limechain <daniel.danev@limechain.tech>
Co-authored-by: Nathan Klick <nathanklick@users.noreply.github.com>
Co-authored-by: Quan Nguyen <quan.nguyen@hedera.com>
Co-authored-by: Neeha <52669918+Neeharika-Sompalli@users.noreply.github.com>
Co-authored-by: Quan Nguyen <45947300+qnswirlds@users.noreply.github.com>
Co-authored-by: ljianghedera <55505519+ljianghedera@users.noreply.github.com>
Co-authored-by: amckay7777 <amckay7777@gmail.com>
  • Loading branch information
13 people authored Jul 1, 2021
1 parent 1bf85cf commit 489ce40
Show file tree
Hide file tree
Showing 232 changed files with 11,712 additions and 2,232 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,7 @@ workflows:
filters:
branches:
ignore:
- /.*-PERF/
- NONE
workflow-name: "Continuous-integration"
- sonar-check:
context: SonarCloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import com.hederahashgraph.api.proto.java.FeeComponents;
import com.hederahashgraph.api.proto.java.FeeData;
import com.hederahashgraph.api.proto.java.SubType;
import com.hederahashgraph.api.proto.java.TransactionBody;

import static com.hederahashgraph.fee.FeeBuilder.BASIC_TX_BODY_SIZE;
Expand Down Expand Up @@ -54,7 +55,7 @@ default long changeInBsUsage(long oldB, long oldLifetimeSecs, long newB, long ne
}

long baseNetworkRbs();
FeeData withDefaultTxnPartitioning(FeeComponents usage, long networkRbh, int numPayerKeys);
FeeData withDefaultTxnPartitioning(FeeComponents usage, SubType subType, long networkRbh, int numPayerKeys);
FeeData withDefaultQueryPartitioning(FeeComponents usage);
UsageEstimate baseEstimate(TransactionBody txn, SigUsage sigUsage);
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.hederahashgraph.api.proto.java.FeeComponents;
import com.hederahashgraph.api.proto.java.FeeData;
import com.hederahashgraph.api.proto.java.TransactionBody;
import com.hederahashgraph.api.proto.java.SubType;
import com.hederahashgraph.api.proto.java.TransferList;

import static com.hederahashgraph.fee.FeeBuilder.BASIC_ACCOUNT_AMT_SIZE;
Expand Down Expand Up @@ -51,8 +52,7 @@ public UsageEstimate baseEstimate(TransactionBody txn, SigUsage sigUsage) {
return estimate;
}

@Override
public FeeData withDefaultTxnPartitioning(FeeComponents usage, long networkRbh, int numPayerKeys) {
public FeeData withDefaultTxnPartitioning(FeeComponents usage, SubType subType, long networkRbh, int numPayerKeys) {
var usages = FeeData.newBuilder();

var network = FeeComponents.newBuilder()
Expand All @@ -75,6 +75,7 @@ public FeeData withDefaultTxnPartitioning(FeeComponents usage, long networkRbh,
.setNetworkdata(network)
.setNodedata(node)
.setServicedata(service)
.setSubType(subType)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ public int accountAmountBytes() {
return LONG_SIZE + BASIC_ENTITY_ID_SIZE;
}

@Override
public int nftTransferBytes() {
return LONG_SIZE + 2 * BASIC_ENTITY_ID_SIZE;
}

@Override
public long legacyReceiptStorageSecs() {
return 180;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import com.hederahashgraph.api.proto.java.FeeData;
import com.hederahashgraph.api.proto.java.SubType;
import com.hederahashgraph.api.proto.java.TransactionBody;

import static com.hederahashgraph.fee.FeeBuilder.HRS_DIVISOR;
Expand All @@ -39,10 +40,15 @@ public TxnUsageEstimator(SigUsage sigUsage, TransactionBody txn, EstimatorUtils
}

public FeeData get() {
return get(SubType.DEFAULT);
}

public FeeData get(SubType subType) {
var usage = utils.baseEstimate(txn, sigUsage);
customize(usage);
return utils.withDefaultTxnPartitioning(
usage.build(),
subType,
utils.nonDegenerateDiv(networkRbs, HRS_DIVISOR),
sigUsage.numPayerKeys());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@

public interface UsageProperties {
int accountAmountBytes();

int nftTransferBytes();

long legacyReceiptStorageSecs();
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void cryptoTransferUsage(
accumulator.addBpt(incBpt);

long incRb = totalXfers * LONG_ACCOUNT_AMOUNT_BYTES;
incRb += TOKEN_ENTITY_SIZES.bytesUsedToRecordTokenTransfers(weightedTokensInvolved, weightedTokenXfers);
incRb += TOKEN_ENTITY_SIZES.bytesUsedToRecordTokenTransfers(weightedTokensInvolved, weightedTokenXfers, 0);
accumulator.addRbs(incRb * USAGE_PROPERTIES.legacyReceiptStorageSecs());
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,16 @@
import com.hedera.services.usage.SigUsage;
import com.hedera.services.usage.TxnUsageEstimator;
import com.hederahashgraph.api.proto.java.FeeData;
import com.hederahashgraph.api.proto.java.SubType;
import com.hederahashgraph.api.proto.java.TransactionBody;

import static com.hedera.services.usage.SingletonEstimatorUtils.ESTIMATOR_UTILS;
import static com.hederahashgraph.fee.FeeBuilder.LONG_SIZE;

public class TokenBurnUsage extends TokenTxnUsage<TokenBurnUsage> {

private SubType currentSubType;

private TokenBurnUsage(TransactionBody tokenBurnOp, TxnUsageEstimator usageEstimator) {
super(tokenBurnOp, usageEstimator);
}
Expand All @@ -36,15 +41,27 @@ public static TokenBurnUsage newEstimate(TransactionBody tokenBurnOp, SigUsage s
return new TokenBurnUsage(tokenBurnOp, estimatorFactory.get(sigUsage, tokenBurnOp, ESTIMATOR_UTILS));
}

public TokenBurnUsage givenSubType(SubType subType){
this.currentSubType = subType;
return this;
}

@Override
TokenBurnUsage self() {
return this;
}

public FeeData get() {
var op = this.op.getTokenBurn();

if (currentSubType == SubType.TOKEN_NON_FUNGIBLE_UNIQUE) {
usageEstimator.addBpt((long) op.getSerialNumbersCount() * LONG_SIZE);
addTokenTransfersRecordRb(1, 0, op.getSerialNumbersCount());
} else if (currentSubType == SubType.TOKEN_FUNGIBLE_COMMON) {
addAmountBpt();
addTokenTransfersRecordRb(1, 1, 0);
}
addEntityBpt();
addAmountBpt();
addTokenTransfersRecordRb(1, 1);
return usageEstimator.get();
return usageEstimator.get(currentSubType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public FeeData get() {
usageEstimator.addBpt(baseSize);
usageEstimator.addRbs(baseSize * lifetime);
addNetworkRecordRb(BASIC_ENTITY_ID_SIZE);
addTokenTransfersRecordRb(1, 1);
addTokenTransfersRecordRb(1, op.getInitialSupply() > 0 ? 1 : 0, 0);

return usageEstimator.get();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package com.hedera.services.usage.token;

/*-
* ‌
* Hedera Services API Fees
* ​
* Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC
* ​
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ‍
*/

import com.google.protobuf.ByteString;
import com.hedera.services.usage.QueryUsage;
import com.hederahashgraph.api.proto.java.Query;

import java.util.List;

import static com.hedera.services.usage.token.entities.NftEntitySizes.NFT_ENTITY_SIZES;
import static com.hederahashgraph.fee.FeeBuilder.BASIC_ENTITY_ID_SIZE;
import static com.hederahashgraph.fee.FeeBuilder.INT_SIZE;

public class TokenGetAccountNftInfosUsage extends QueryUsage {
private static final long INT_SIZE_AS_LONG = INT_SIZE;

public TokenGetAccountNftInfosUsage(Query query) {
super(query.getTokenGetAccountNftInfos().getHeader().getResponseType());
updateTb(BASIC_ENTITY_ID_SIZE);
updateTb(2 * INT_SIZE_AS_LONG);
}

public static TokenGetAccountNftInfosUsage newEstimate(Query query) {
return new TokenGetAccountNftInfosUsage(query);
}

public TokenGetAccountNftInfosUsage givenMetadata(List<ByteString> metadata) {
int additionalRb = 0;
for (ByteString m : metadata) {
additionalRb += m.size();
}
updateRb(additionalRb);
updateRb(NFT_ENTITY_SIZES.fixedBytesInNftRepr() * metadata.size());
return this;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.hedera.services.usage.token;

/*-
* ‌
* Hedera Services API Fees
* ​
* Copyright (C) 2018 - 2021 Hedera Hashgraph, LLC
* ​
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ‍
*/

import com.hedera.services.usage.QueryUsage;
import com.hederahashgraph.api.proto.java.Query;

import static com.hedera.services.usage.token.entities.NftEntitySizes.NFT_ENTITY_SIZES;
import static com.hederahashgraph.fee.FeeBuilder.BASIC_ENTITY_ID_SIZE;
import static com.hederahashgraph.fee.FeeBuilder.LONG_SIZE;

public class TokenGetNftInfoUsage extends QueryUsage {
public TokenGetNftInfoUsage(Query query) {
super(query.getTokenGetNftInfo().getHeader().getResponseType());
updateTb(BASIC_ENTITY_ID_SIZE);
updateTb(LONG_SIZE);
updateRb(NFT_ENTITY_SIZES.fixedBytesInNftRepr());
}

public static TokenGetNftInfoUsage newEstimate(Query query) {
return new TokenGetNftInfoUsage(query);
}

public TokenGetNftInfoUsage givenMetadata(String memo) {
updateRb(memo.length());
return this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -20,18 +20,28 @@
* ‍
*/

import com.google.protobuf.ByteString;
import com.hedera.services.usage.SigUsage;
import com.hedera.services.usage.TxnUsageEstimator;
import com.hederahashgraph.api.proto.java.FeeData;
import com.hederahashgraph.api.proto.java.SubType;
import com.hederahashgraph.api.proto.java.TransactionBody;

import static com.hedera.services.usage.SingletonEstimatorUtils.ESTIMATOR_UTILS;

public class TokenMintUsage extends TokenTxnUsage<TokenMintUsage> {

private SubType currentSubType;

private TokenMintUsage(TransactionBody tokenMintOp, TxnUsageEstimator usageEstimator) {
super(tokenMintOp, usageEstimator);
}

public TokenMintUsage givenSubType(SubType subType) {
this.currentSubType = subType;
return this;
}

public static TokenMintUsage newEstimate(TransactionBody tokenMintOp, SigUsage sigUsage) {
return new TokenMintUsage(tokenMintOp, estimatorFactory.get(sigUsage, tokenMintOp, ESTIMATOR_UTILS));
}
Expand All @@ -42,9 +52,22 @@ TokenMintUsage self() {
}

public FeeData get() {
var op = this.op.getTokenMint();

if (currentSubType == SubType.TOKEN_NON_FUNGIBLE_UNIQUE) {
var metadataBytes = 0;
for (ByteString o : op.getMetadataList()) {
metadataBytes += o.size();
}
usageEstimator.addBpt(metadataBytes);
usageEstimator.addRbs(tokenEntitySizes.bytesUsedForUniqueTokenTransfers(op.getMetadataCount()));
addTokenTransfersRecordRb(1, 0, op.getMetadataCount());
} else if (currentSubType == SubType.TOKEN_FUNGIBLE_COMMON) {
addAmountBpt();
addTokenTransfersRecordRb(1, 1, 0);
}

addEntityBpt();
addAmountBpt();
addTokenTransfersRecordRb(1, 1);
return usageEstimator.get();
return usageEstimator.get(currentSubType);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import com.hederahashgraph.api.proto.java.TransactionBody;

import static com.hedera.services.usage.token.entities.TokenEntitySizes.TOKEN_ENTITY_SIZES;
import static com.hederahashgraph.fee.FeeBuilder.BASIC_RICH_INSTANT_SIZE;

public abstract class TokenTxnUsage<T extends TokenTxnUsage<T>> extends TxnUsage {
static TokenEntitySizes tokenEntitySizes = TOKEN_ENTITY_SIZES;
Expand All @@ -36,8 +37,8 @@ protected TokenTxnUsage(TransactionBody tokenOp, TxnUsageEstimator usageEstimato
super(tokenOp, usageEstimator);
}

void addTokenTransfersRecordRb(int numTokens, int numTransfers) {
addRecordRb(tokenEntitySizes.bytesUsedToRecordTokenTransfers(numTokens, numTransfers));
void addTokenTransfersRecordRb(int numTokens, int fungibleNumTransfers, int uniqueNumTransfers) {
addRecordRb(tokenEntitySizes.bytesUsedToRecordTokenTransfers(numTokens, fungibleNumTransfers, uniqueNumTransfers));
}

public T novelRelsLasting(int n, long secs) {
Expand Down
Loading

0 comments on commit 489ce40

Please sign in to comment.