hashgraph / hedera-smart-contracts

Contains Hedera Smart Contract Service supporting files
Apache License 2.0
46 stars 54 forks source link

test: added test coverage to confirm key alias remain the same after key rotations #984

Closed quiet-node closed 1 month ago

quiet-node commented 1 month ago

Description: There has been a report from a community member raising concerns about whether an account's EVM address would be modified or updated if the account's key is changed—for example, from one ECDSA key to another, or from ECDSA to ED25519.

This PR addresses the concern and confirms that an account's EVM address is fixed at the time of creation and will remain unchanged, regardless of any updates to the account's key.

Fixes #983

Example Log Output:

  Key Rotation Test Suite

>>>>>>> accountId_Alpha <<<<<<<
- accountId: 0.0.1044
- public key: 302d300706052b8104000a03220002f6de454684020fe47e85c225288b2caae36bae587c4c08d142cb2ca8177fe0f5
- evm address: 9b69fafd7574a2ef5635c7ebddc0e7258569076d
>>>>>>> accountInfoAfterKeyRotation - ECDSA <<<<<<<
- accountId: 0.0.1044
- public key: 302d300706052b8104000a03220003b6b1743fe7f8d6c2dd92a40614431b65c9501673508e4be53c8561891b4cc6d2
- evm address: 9b69fafd7574a2ef5635c7ebddc0e7258569076d
    ✔ Should remain the same EVM key alias after key rotation with a different ECDSA key (559ms)

>>>>>>> accountId_Alpha <<<<<<<
- accountId: 0.0.1045
- public key: 302d300706052b8104000a03220003e58eabbff610e4142f274ab883158835ef0a783e973214ffdad06ab6b723b446
- evm address: 48fa79e6b73f50a601ff4f74100838dff43c16aa
>>>>>>> accountInfoAfterKeyRotation - ED25519 <<<<<<<
- accountId: 0.0.1045
- public key: 302a300506032b657003210032a3386cd825f0c1c8d3f3e8c074ec240418d9887eea6601970797c854bb8d69
- evm address: 48fa79e6b73f50a601ff4f74100838dff43c16aa
    ✔ Should remain the same EVM key alias after key rotation with a different ED25519 key (551ms)
github-actions[bot] commented 1 month ago

Test Results

 16 files  ±0   82 suites  ±0   12m 5s :stopwatch: +32s 290 tests ±0  284 :white_check_mark: ±0  6 :zzz: ±0  0 :x: ±0  299 runs  ±0  292 :white_check_mark: ±0  7 :zzz: ±0  0 :x: ±0 

Results for commit ce3e9ab1. ± Comparison against base commit a2b219e5.

:recycle: This comment has been updated with latest results.

quiet-node commented 1 month ago

Please add a README also for users to run just this test. I want to make it very easy for anyone to follow and validate it for themselves.

@Nana-EC this test will be executed in the same manner as the other tests in the repository. Perhaps, you can direct people to our TEST_SETUP documentation, and to isolate this test, simply add a .only to the test suite.