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

[cherry-pick] fix(genesis-geremony): fix examine-genesis-checkpoint (#4829) #5080

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

lzpap
Copy link
Member

@lzpap lzpap commented Jan 29, 2025

Cherry-picking #4829

Description of change

This (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

* 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 lzpap requested review from a team as code owners January 29, 2025 13:13
Copy link

vercel bot commented Jan 29, 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) Jan 29, 2025 1:13pm
apps-ui-kit ⬜️ Ignored (Inspect) Jan 29, 2025 1:13pm
rebased-explorer ⬜️ Ignored (Inspect) Jan 29, 2025 1:13pm
wallet-dashboard ⬜️ Ignored (Inspect) Jan 29, 2025 1:13pm

@iota-ci iota-ci added the sc-platform Issues related to the Smart Contract Platform group. label Jan 29, 2025
@lzpap lzpap merged commit 735a310 into releases/iota-v0.9.0-release Jan 29, 2025
39 checks passed
@lzpap lzpap deleted the cherry-pick-for-release/pr-4829 branch January 29, 2025 15:04
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants