Implement memoless internal transaction detection and skip handler processing

🔎 Visual review of 3e17f25c: ⏳ out of date, newer commits were pushed. Updating it for fee38d09.

Summary

  • Add an isInternalTransaction helper. It treats a tx as vault-to-vault when both FromAddress and ToAddress have an address-to-pubkey mapping. Each check is an O(1) HasAddrPubKey lookup, 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. applyMemolessOutboundLogic is unchanged and never clears memos where IsInternal() is true, because stale-migrate pruning, the per-chain migrate pause, outbound memo recovery, EVM transferAllowance parsing and errata all identify migrations by memo. New TestApplyMemolessOutboundLogic cases check that MIGRATE and CONSOLIDATE memos are kept when enableMemolessOutbound >= 2.
  • Add a KeeperAddrPubKey interface with Set, Get, Has, Delete and Iterator operations. It is backed by a new addr_pk/ KV prefix, which is registered in app/divergence/prefixes.go. KVStoreDummy gets 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 processGenesisSetup for vaults that already exist at genesis
    • in RotateVault for each conflicting vault being moved to Retiring
    • in RotateVault for the new active vault
  • Add a /thorchain/vaults/address/{address} query (gRPC AddrPubKey, REST gateway, OpenAPI spec and generated client). It returns the mapped vault key as pub_key, the name the other vault query responses use, and a found flag.
  • Regenerate the protobuf, pulsar and OpenAPI files.

Test plan

  • Unit tests: isInternalTransaction with vault and non-vault addresses, empty addresses, multiple chains, and repeated lookups
  • Unit tests: the keeper AddrPubKey CRUD and iterator, and several addresses mapped to the same pubkey
  • Unit tests: RotateVault creates 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

🤖 Generated with Claude Code

Edited by Son of Odin

Merge request reports

Loading
Loading