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] Missing migration.blob for iota genesis ... command #4896

Open
lzpap opened this issue Jan 17, 2025 · 1 comment
Open

[genesis] Missing migration.blob for iota genesis ... command #4896

lzpap opened this issue Jan 17, 2025 · 1 comment
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 17, 2025

Bug description

Generating a genesis with local migration sources produces a wrong starting state without migration data/transactions/objects.

Steps To reproduce the bug

  1. Create local obejct snapshot from a recent iota mainnet hornet snapshot:
 ./target/release/iota-genesis-builder --disable-global-snapshot-verification iota --snapshot-path latest-full_snapshot.bin --address-swap-split-map-path swap-split.csv --address-swap-map-path swap.csv --target-network alphanet

where:

  • swap-split.csv is:
Origin,Destination,Tokens,TokensTimelocked
iota1qp8h9augeh6tk3uvlxqfapuwv93atv63eqkpru029p6sgvr49eufyz7katr,0x7f5ef659f341e3256d4abd256c66f754fcf78bf574034f5d5ae8d11e55207d20,300000000000,50000000000000
iota1qrkwdhv2juxue3ju8ug9wfyw2q68qh495cjsn87svyfjytka7y3c6nf3lrk,0x5b595105a4b20efe3d7ae28cb0ab907e93023ca21b3463bf55834051a569d04d,300000000000,50000000000000
iota1qrukjnd6jhgwc0ls6dgt574sxuulcsmq5lnzhtv4jmlwkydhe2zvy69t7jj,0x99e4f3ce4bae0763df277b908bd3661e2ba7fc69fb0738b67646e317e0ee98f7,300000000000,0
  • swap.csv is
Origin,Destination
iota1qrukjnd6jhgwc0ls6dgt574sxuulcsmq5lnzhtv4jmlwkydhe2zvy69t7jj,0x99e4f3ce4bae0763df277b908bd3661e2ba7fc69fb0738b67646e317e0ee98f7
  1. mkdir test_split_config
  2. Try creating a genesis via:
./target/release/iota genesis --working-dir test_split_config --num-validators 1 --local-migration-snapshots stardust_object_snapshot.bin --delegator 0x99e4f3ce4bae0763df277b908bd3661e2ba7fc69fb0738b67646e317e0ee98f7
  1. The test_split_config directory doesn't have a migration.blob.

Expected behaviour

migration.blob is created and a local network with the migrated state can be started.

./target/release/iota start --network.config test_split_config

Actual behaviour

Missing migration.blob causes the local network to start without migration data.

Solution hint

The following function doesn't check for the emptiness of timelocks_to_split field. Should one add it, migration.blob is created:

pub fn is_empty(&self) -> bool {

@lzpap lzpap added vm-language Issues related to the VM & Language Team sc-platform Issues related to the Smart Contract Platform group. labels Jan 17, 2025
@miker83z
Copy link
Contributor

miker83z commented Jan 17, 2025

The actual problem is in this check:

if !timelock_allocation_objects.to_destroy.is_empty() {

Fixing the is_empty only partially fixes the issue. In !timelock_allocation_objects.to_destroy.is_empty() we check if some timelocks needs to be destroyed and only then we continue creating the allocation. However, if we have just 1 timelock that has an amount enough to cover all the validator delegation, then it is not destroyed but just split! This is the scenario you tested, and in that part of the code it didn't go through creating the correct allocation.
A quick solution would be to just check:

if !timelock_allocation_objects.staked_with_timelock.is_empty()

Because that staked_with_timelock vector is filled in any case a timelock is touched for delegation (split or destroyed).

miker83z added a commit that referenced this issue Jan 17, 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

No branches or pull requests

2 participants