Loading
Implement memoless internal transaction detection and skip handler processing
🔎 Visual review of3e17f25c:⏳ out of date, newer commits were pushed. Updating it forfee38d09.
Summary
- Add an
isInternalTransactionhelper. It treats a tx as vault-to-vault when bothFromAddressandToAddresshave an address-to-pubkey mapping. Each check is an O(1)HasAddrPubKeylookup, so it does not iterate over vaults. - In
handleObservedTxInQuorum, a blank memo internal transaction is not given a reference memo and is not passed to a handler. The tx is logged and the function returns early. - Migrate and consolidate outbounds always keep their memo.
applyMemolessOutboundLogicis unchanged and never clears memos whereIsInternal()is true, because stale-migrate pruning, the per-chain migrate pause, outbound memo recovery, EVMtransferAllowanceparsing and errata all identify migrations by memo. NewTestApplyMemolessOutboundLogiccases check thatMIGRATEandCONSOLIDATEmemos are kept whenenableMemolessOutbound >= 2. - Add a
KeeperAddrPubKeyinterface with Set, Get, Has, Delete and Iterator operations. It is backed by a newaddr_pk/KV prefix, which is registered inapp/divergence/prefixes.go.KVStoreDummygets stub implementations. Setting an empty pubkey deletes the mapping. - Add
NetworkMgr.storeVaultAddressMappings. For each of a vault's chains, it stores the chain address derived from the pubkey matching that chain's signing algorithm (AlgoPubKey). Chains that are invalid or cannot be resolved are skipped. It is called:- in
processGenesisSetupfor vaults that already exist at genesis - in
RotateVaultfor each conflicting vault being moved to Retiring - in
RotateVaultfor the new active vault
- in
- Add a
/thorchain/vaults/address/{address}query (gRPCAddrPubKey, REST gateway, OpenAPI spec and generated client). It returns the mapped vault key aspub_key, the name the other vault query responses use, and afoundflag. - Regenerate the protobuf, pulsar and OpenAPI files.
Test plan
- Unit tests:
isInternalTransactionwith vault and non-vault addresses, empty addresses, multiple chains, and repeated lookups - Unit tests: the keeper
AddrPubKeyCRUD and iterator, and several addresses mapped to the same pubkey - Unit tests:
RotateVaultcreates ECDSA and EdDSA address mappings for the new vault and skips invalid chains - Unit tests: migrate and consolidate memos are kept when
enableMemolessOutbound >= 2 - Run unit tests:
make test - Run regression tests:
make test-regression - Test with mocknet to check that blank memo internal transactions skip handler processing
- Query
/thorchain/vaults/address/{address}for an active vault address and for a non-vault address
Edited by Son of Odin