[V136] Fix: ParseMemo without keeper - #check-lint-warning

This PR addresses the issue of calling ParseMemo from Bifrost, where it could happen that this call returned an error for failed parsing, even though the memo was valid for the current version and should have been parsed successfully.

This situation occurred because, when calling ParseMemo, keeper is nil, which in some cases caused the execution of an older version of the parser for the given memo type. As a result, newer memo formats were parsed unsuccessfully. This affected SWAP & ADD memos.

The following Bifrost functions were impacted:

  • For Bitcoin & ETH + EVM + Kuji + Radix + TC:
    • OnObservedTxIn – in the case of a new memo type (e.g., SWAP with multiple affiliates like ...af1/af2:10/20), c.signerCacheManager.SetSigned() was skipped, resulting in a failed signer cache update.
  • For Bitcoin & Dash:
    • getTxIn – txs with new memo types triggered a 'failed to parse memo' log error.
    • SmartContractLogParser.GetTxInItem – txs with new memo types triggered a 'failed to parse memo' log error.

This PR ensures that ParseMemo calls always use the latest version of the parser for the given memo type, while accounting for the possibility that the keeper might be nil. Some actions performed by the parser when the keeper is available cannot be performed without the keeper, such as verifying the existence of a MAYAName. In such cases, the parser skips that verification. But valid memos should NEVER fail just because keeper is missing.

This means that (for SWAP & ADD memos), the set of memos that successfully pass through ParseMemo is a superset of what successfully passes through ParseMemoWithMAYANames. So for such invalid memos, the verification in Bifrost will succeed, but ultimately, the validation will fail in Mayanode.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected memo parsing test expectation.
    • Guarded name/address resolution to avoid nil-keeper issues.
  • Refactor

    • Address resolution and affiliate processing now route by software version, enabling new version-aware behavior.
    • Centralized version context across memo parsing and affiliate BPS logic.
    • Improved MAYA name validation and adjusted preferred-asset swap handling to remove an internal transfer step.
Edited by Ghost User

Merge request reports

Loading
Loading