Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[genesis] Splitting funds #4746

Open
lzpap opened this issue Jan 10, 2025 · 0 comments · May be fixed by #4792
Open

[genesis] Splitting funds #4746

lzpap opened this issue Jan 10, 2025 · 0 comments · May be fixed by #4792
Assignees
Labels
sc-platform Issues related to the Smart Contract Platform group. vm-language Issues related to the VM & Language Team

Comments

@lzpap
Copy link
Member

lzpap commented Jan 10, 2025

Description

Currently address swap map in the genesis builder maps all assets on the source address to destination address. Implement the possibility to split funds from a source address to secondary address(es).

Address Swapping and Splitting are two different functionalities: the former blindly maps all addresses/funds to the new address, while the latter intends to split off certain amount of funds (and timelocked funds) to a new address. Also, it is unclear yet whether the splitting feature is going to be employed in production, but to be on the safe side we shall implement it.

Therefore, I suggest to implement a new Hornet snapshot output iterator in iota-genesis-builder that preceeds the address swap iterator and splits off funds from the source address before address swapping actually happens.

Requirements

  1. Only support splitting Basic Outputs to the destination address from the source address that are either:
    a. Basic outputs with only an address unlock and iota tokens,
    b. Basic outputs with address & timelock unlock and iota tokens.
  2. Splitting shall happen on the Hornet snapshot, before it is handed over to the object transformation logic.
  3. Splitting(&swapping) shall happen before the already existing address swap process is carried out.
  4. The amount of timelocked and non-timelocked funds to split shall be configurable.
  5. When source address has more timelocked tokens than the desired split amount, prioiritize later timelocks to be splitted to destination.
  6. Add e2e migration test case(s) that use the split feature and verify the existence of funds on destination address within the started move chain.

Proposed Solution

  • Add a new optional input to iota-genesis-builder binary: split_map.csv. An example split_map.csv:
Source,Destination,Tokens,TokensTimelocked
iota1qp8h9augeh6tk3uvlxqfapuwv93atv63eqkpru029p6sgvr49eufyz7katr,0xa12b4d6ec3f9a28437d5c8f3e96ba72d3c4e8f5ac98d17b1a3b8e9f2c71d4a3c, 2816564858653000, 2816564858653000
iota1qp7h2lkjhs6tk3uvlxqfjhlfw34atv63eqkpru356p6sgvr76eufyz1opkh,0x42d8c182eb1f3b2366d353eed4eb02a31d1d7982c0fd44683811d7036be3a85e, 4776923076923000, 0
  • Tokens and TokensTimelocked are denominated in nanos, not micros!
  • Extend process_outputs_for_iota() with logic that carries out the splitting BEFORE address swapping hapens.
  • At the end of the processing of outputs, verify the existence of funds on destination addresses from split_map.csv

Are you planning to do it yourself in a pull request?

No.

@lzpap lzpap added sc-platform Issues related to the Smart Contract Platform group. vm-language Issues related to the VM & Language Team labels Jan 10, 2025
@miker83z miker83z self-assigned this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sc-platform Issues related to the Smart Contract Platform group. vm-language Issues related to the VM & Language Team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants