REMOVE TXOUT MEMOS
Current
All outbounds have an associated memo.
OUT:{hash}
REFUND:{hash}
CONSOLIDATE
MIGRATE:{height}
RAGNAROK:{height}
However
- This adds on-chain gas costs
- Requires access to on-chain memo handling (eg ERC20 router)
- Prevents batching of outbounds
Outbound memos were originally used to easily debug outbound transactions in V0.1 TC and were never after considered to be removed.
The ETH
unstuck
tx type has no on-chain memo. The transaction is scheduled, processed and observed without a memo.
Consids on Collisions
Currently there are 5 matching parameters to ID an outbound from TC (from the on-chain observation) https://thornode.ninerealms.com/thorchain/queue/outbound
{
"vault_pub_key": "thorpub1addwnpepqg6hh0d8k2nn8ue53ke9rynd63sr9g38hnrvrdfgsgn7aeszm28u2wwxgsy",
"in_hash": "A709EC70E2254ECE1E32CCF857047663E395C7CA259CB9C3099652C552A409D4",
"chain": "LTC",
"to_address": "ltc1p6ah8f6kynhr7pa56c2f6an2ejx2slsrcuxu59rvhaxys7kp66zvse2r22w",
"coin": {
"asset": "LTC.LTC",
"amount": "22281227"
},
"max_gas": [
{
"asset": "LTC.LTC",
"amount": "7500",
"decimals": 8
}
],
"gas_rate": 30,
"memo": "OUT:A709EC70E2254ECE1E32CCF857047663E395C7CA259CB9C3099652C552A409D4",
},
- The
chain
- The
vault_pub_key
- The
to_address
- The
coin.asset
andcoin.amount
- The
memo
Importantly, the user is not in control of the
coin.amount
- this is their swap or redemption output minus the prevailing gas cost, which constantly changes, nor the assignedvault_pub_key
(TC controls this, based on vault security and fund availability)
Removal of the memo
field is not going to increase a collision risk meaningfully (a user withdrawing to the same address with the same amount, same asset and assigned to the same vault).
Even if there are two or more colliding
txOut
, the outbound queue already separates action items including thein_hash
, so there won't be any collision in signing logic. The bifrost for a vault handles the outbound queue as FIFO - it will finish signing the first, insta-observe, then move on to signing the next.
Midgard
Midgard will be prepped to no longer require an outbound memo in tx handling.
Implementation
Stage 1: Deprecation
Add to constants/mimir_strings.go: MimirKeyMemolessOutbound = "MemolessOutbound"
in x/thorchain/keeper/v1/keeper_mimir.go line 113-124
IsOperationalMimir` add it
In x/thorchain/manager_txout_current.go
Lines 465-466: Wrap toi.Memo = NewOutboundMemo(toi.InHash).String()
in mimir check
Lines 474-485: Wrap memo appending logic in mimir check
Line 181: Wrap refund/migrate memo check in mimir check
Line 601: Wrap memo parsing for fee logic in mimir check
Pattern: if tos.keeper.GetMimir(ctx, constants.MimirKeyMemolessOutbound) != 0 { /* existing logic */ }
else skip
Deploy with MimirKeyMemolessOutbound=0
, flip to 1
to test memoless
Stage 2: Code Removal
Delete files: x/thorchain/memo/{memo_outbound.go, memo_refund.go, memo_migrate.go, memo_ragnarok.go, memo_consolidate.go}
In x/thorchain/memo/memo.go
: Remove outbound TxTypes, map entries, IsOutbound()
cases
In x/thorchain/manager_txout_current.go
: Remove wrapped memo logic, default toi.Memo = ""
In x/thorchain/memo/memo_parser.go
: Remove outbound parsing cases
Update handlers to set Memo: ""
Update tests in memo_test.go
Remove MimirKeyMemolessOutbound
mimir
Testing
Ensure that the colliding txOut case is tested (two txOut's with same outbound parameters, differing only with in_hash