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

fix(genesis-geremony): fix examine-genesis-checkpoint #4829

Merged
merged 14 commits into from
Jan 28, 2025

Conversation

nonast
Copy link
Contributor

@nonast nonast commented Jan 16, 2025

Description of change

This (draft) PR fixes the examine-genesis-checkpoint command of the genesis ceremony. Due to the migrated objects, the genesis inspector did not function correctly anymore, as not all objects exist in the first genesis state. These migrated objects are created in the following transactions. The genesis inspector was not built to take these extra migrated objects into account. In this PR, the migrated objects are also included in the list of objects that is used to count the total supply. The object inspector of this function now also functions as expected.

Will rebase on develop

Links to any relevant issues

fixes #4528

Type of change

Choose a type of change, and delete any options that are not relevant.

  • Bug fix (a non-breaking change which fixes an issue)

How the change has been tested

Ran a genesis ceremony up to the point where examine-genesis-checkpoint is called:

$ mkdir genesis && cd genesis
$ cargo run --release --bin iota genesis-ceremony init
$ cargo run --release --bin iota-genesis-builder -- --disable-global-snapshot-verification iota  --snapshot-path ../../latest-full_snapshot.bin --target-network alphanet-test
$ ../target/release/iota validator make-validator-info validator1 validator1 https://www.iota.org/favicon.png https://www.iota.org /ip4/127.0.0.1 1000
$ ../target/release/iota genesis-ceremony add-validator \
    --name validator1 \
    --authority-key-file authority.key \
    --protocol-key-file protocol.key \
    --account-key-file account.key \
    --network-key-file network.key \
    --network-address /ip4/127.0.0.1/tcp/38189/http \
    --p2p-address /ip4/127.0.0.1/udp/34523 \
    --primary-address /ip4/127.0.0.1/udp/38603 \
    --description validator1 \
    --image-url https://www.iota.org/favicon.png \
    --project-url https://www.iota.org
$ ADDRESS=$(sed -n 4p committee/validator1 |  cut -d ":" -f2- | tr -d ' "')
$ echo "delegator,validator,amount-nanos-to-stake,amount-nanos-to-pay-gas" >> delegations.csv
$ echo "0x4f72f788cdf4bb478cf9809e878e6163d5b351c82c11f1ea28750430752e7892,${ADDRESS},1500000000000000,1500000000000000" >> delegations.csv
$ ../target/release/iota genesis-ceremony init-delegations --delegations-path delegations.csv
$ ../target/release/iota genesis-ceremony build-unsigned-checkpoint --local-migration-snapshots stardust_object_snapshot.bin
$ ../target/release/iota genesis-ceremony examine-genesis-checkpoint 

Change checklist

Tick the boxes that are relevant to your changes, and delete any items that are not.

  • I have followed the contribution guidelines for this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that new and existing unit tests pass locally with my changes

@nonast nonast added the vm-language Issues related to the VM & Language Team label Jan 16, 2025
@nonast nonast added this to the Mainnet milestone Jan 16, 2025
@nonast nonast self-assigned this Jan 16, 2025
Copy link

vercel bot commented Jan 16, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
apps-backend ⬜️ Ignored (Inspect) Visit Preview Jan 28, 2025 11:28am
apps-ui-kit ⬜️ Ignored (Inspect) Visit Preview Jan 28, 2025 11:28am
rebased-explorer ⬜️ Ignored (Inspect) Visit Preview Jan 28, 2025 11:28am
wallet-dashboard ⬜️ Ignored (Inspect) Visit Preview Jan 28, 2025 11:28am

@iota-ci iota-ci added the sc-platform Issues related to the Smart Contract Platform group. label Jan 16, 2025
@miker83z
Copy link
Contributor

miker83z commented Jan 20, 2025

@nonast please add in the description the steps on how to reproduce the environment to execute the command:

$ mkdir genesis && cd genesis
$ cargo run --release --bin iota genesis-ceremony init
$ cargo run --release --bin iota-genesis-builder -- --disable-global-snapshot-verification iota  --snapshot-path ../../latest-full_snapshot.bin --target-network alphanet-test
$ ../target/release/iota validator make-validator-info validator1 validator1 https://www.iota.org/favicon.png https://www.iota.org /ip4/127.0.0.1 1000
$ ../target/release/iota genesis-ceremony add-validator \
    --name validator1 \
    --authority-key-file authority.key \
    --protocol-key-file protocol.key \
    --account-key-file account.key \
    --network-key-file network.key \
    --network-address /ip4/127.0.0.1/tcp/38189/http \
    --p2p-address /ip4/127.0.0.1/udp/34523 \
    --primary-address /ip4/127.0.0.1/udp/38603 \
    --description validator1 \
    --image-url https://www.iota.org/favicon.png \
    --project-url https://www.iota.org
$ ADDRESS=$(sed -n 4p committee/validator1 |  cut -d ":" -f2- | tr -d ' "')
$ echo "delegator,validator,amount-nanos-to-stake,amount-nanos-to-pay-gas" >> delegations.csv
$ echo "0x4f72f788cdf4bb478cf9809e878e6163d5b351c82c11f1ea28750430752e7892,${ADDRESS},1500000000000000,1500000000000000" >> delegations.csv
$ ../target/release/iota genesis-ceremony init-delegations --delegations-path delegations.csv
$ ../target/release/iota genesis-ceremony build-unsigned-checkpoint --local-migration-snapshots stardust_object_snapshot.bin
$ ../target/release/iota genesis-ceremony examine-genesis-checkpoint 

Copy link
Contributor

@valeriyr valeriyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

crates/iota/src/genesis_inspector.rs Outdated Show resolved Hide resolved
@miker83z miker83z force-pushed the vm-language/examine-genesis-checkpoint branch from 65379ca to 13df074 Compare January 28, 2025 11:12
@miker83z miker83z requested a review from Alex6323 January 28, 2025 11:26
@miker83z miker83z merged commit 794e8f4 into develop Jan 28, 2025
40 checks passed
@miker83z miker83z deleted the vm-language/examine-genesis-checkpoint branch January 28, 2025 11:41
lzpap pushed a commit that referenced this pull request Jan 29, 2025
* fix: examine genesis checkpoint

* chore: clippy and fmt

* refactor: is_maybe to try_from

* chore: remove unused functions

* refactor: remove unwrap from func

* chore: remove unused to_bytes funcs

* chore: cargo fmt

* chore: correct spelling

* fix(genesis-inspector): consider  TimelockedStakedIota as a stake

* refactor(genesis-inspector): get migration objects as iterator

* add timelock balance assert

* fixes coming from different review comments

---------

Co-authored-by: Mirko Zichichi <[email protected]>
Co-authored-by: miker83z <[email protected]>
lzpap added a commit that referenced this pull request Jan 29, 2025
* fix: examine genesis checkpoint

* chore: clippy and fmt

* refactor: is_maybe to try_from

* chore: remove unused functions

* refactor: remove unwrap from func

* chore: remove unused to_bytes funcs

* chore: cargo fmt

* chore: correct spelling

* fix(genesis-inspector): consider  TimelockedStakedIota as a stake

* refactor(genesis-inspector): get migration objects as iterator

* add timelock balance assert

* fixes coming from different review comments

---------

Co-authored-by: Nonast <[email protected]>
Co-authored-by: Mirko Zichichi <[email protected]>
Co-authored-by: miker83z <[email protected]>
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 this pull request may close these issues.

[genesis] Fix broken examine-genesis-checkpoint command of the genesis ceremony
8 participants