hedera-services icon indicating copy to clipboard operation
hedera-services copied to clipboard

Create client side tests for Hedera Account Service

Open lukelee-sl opened this issue 2 years ago • 0 comments

Problem

Epic: #4619

Currently, there are no client tests for exercising and validating the functionality of the Hedera Account Service.

Solution

Create client side tests ensuring that the following scenarios are covered:

Positive Tests

  • Verify getVirtualAddresses returns the correct list of evmAddresses when an account holds 0, 1 and multiple virtual addresses.
  • Verify getHederaAddress returns the correct Hedera account Id given a virtual evmAddress.
  • Verify isVirtualAddress correctly returns true when a given evmAddress is a virtual address.
  • Verify isAuthorized correctly returns true when the signatureBlob has been validated to have been signed by a single key of a given address in the single key scenario.
  • Verify isAuthorized correctly returns true when the signatureBlob has been validated to have been signed by the multiple keys of a given address in multisig scenarios (e.g. 3 of 3 keys).
  • Verify isAuthorized correctly returns true when the signatureBlob has been validated to have been signed by the sufficient multiple keys of a given address in threshold keys scenarios (e.g. 2 of 3 keys).
  • Verify isAuthorizedRaw correctly returns true when the signatureBlob has been validated to have been signed by the evm key of a given address.

Negative Tests

  • Verify getVirtualAddresses returns an empty list of evmAddresses given an unknown Hedera account Id.
  • Verify getVirtualAddresses returns INVALID_ACCOUNT_ID given a special Hedera account Id (e.g. 0.0.800, 0.0.801).
  • Verify getHederaAddress returns INVALID_ACCOUNT_ID given a non-existing virtual evmAddress.
  • Verify getHederaAddress returns INVALID_ACCOUNT_ID given an evmAddress that is on the list of well known evm addresses.
  • Verify isVirtualAddress correctly returns false when a given evmAddress is not a virtual address.
  • Verify isAuthorized correctly returns false when the signatureBlob does not validate to have been signed by the key of a given address in the single key scenario. Also validate multikey/nested scenarios.
  • Verify isAuthorized correctly returns false when the signatureBlob does not validate to have been signed by the keys of a given address in the multisig scenarios.
  • Verify isAuthorized correctly returns false when the signatureBlob does not validate to have been signed by the sufficient keys of a given address in the threshold key scenario.
  • Verify isAuthorized returns error when passed signatureBlob in incorrect format (not encoded SignatureMap)
  • Verify isAuthorizedRaw correctly returns false when the signatureBlob does not validate to have been signed by the evm key of a given address.

Alternatives

No response

lukelee-sl avatar Jan 12 '23 23:01 lukelee-sl