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

Create integration and end to end tests for HIP 632

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

Problem

Epic: #4619

Currently there are no integration/end-to-end tests for testing the functionality introduced in HIP 632

Solution

Create test client tests which exercise the function of the Hedera Account Service. Include tests for the following scenarios

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