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

feat(sui-genesis-builder): migrate Alias Outputs #163

Merged
merged 36 commits into from
May 16, 2024

Conversation

PhilippGackstatter
Copy link

@PhilippGackstatter PhilippGackstatter commented May 3, 2024

Description of change

Implements the Move models in Rust for the migration of the Alias Output.

Changes to the Alias Move model:

  • Make attach_alias method public (was test-only before). This is needed so we can easily attach the Alias to the AliasOutput from a PTB, since we cannot pass alias_output.id as an argument to dynamic_object_field::add directly.
  • Make State Controller non-optional. A state controller is always present in the stardust model, so imho it does not make sense to make it Option<SuiAddress> in the move code, unless I missed the argument for it.

Links to any relevant issues

fixes issue #154.

Type of change

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

  • Enhancement (a non-breaking change which adds functionality)

How the change has been tested

Added a migration test. More to be added for native tokens and in case the alias id is zeroed.

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

@PhilippGackstatter PhilippGackstatter changed the base branch from develop to 112-migrate-basic-outputs May 3, 2024 15:19
@miker83z miker83z changed the title Migrate Alias Outputs feat(sui-genesis-builder): migrate Alias Outputs May 10, 2024
@PhilippGackstatter PhilippGackstatter force-pushed the 154-migrate-alias-outputs branch from 5b6fcac to e60e613 Compare May 14, 2024 12:19
@miker83z miker83z added the sc-platform Issues related to the Smart Contract Platform group. label May 14, 2024
@miker83z miker83z added this to the L1SC/IOTA-Framework milestone May 14, 2024
@PhilippGackstatter PhilippGackstatter marked this pull request as ready for review May 15, 2024 07:35
Copy link
Contributor

@miker83z miker83z left a comment

Choose a reason for hiding this comment

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

Great PR, it follows almost perfectly the assumed design!

I just signaled a major issue related to the security of generating ObjectIds + some small issues.

crates/sui-genesis-builder/src/stardust/types/alias.rs Outdated Show resolved Hide resolved
crates/sui-genesis-builder/src/stardust/migration.rs Outdated Show resolved Hide resolved
crates/sui-genesis-builder/src/stardust/migration.rs Outdated Show resolved Hide resolved
crates/sui-genesis-builder/src/stardust/types/alias.rs Outdated Show resolved Hide resolved
crates/sui-genesis-builder/src/stardust/migration.rs Outdated Show resolved Hide resolved
crates/sui-genesis-builder/src/stardust/migration.rs Outdated Show resolved Hide resolved
@PhilippGackstatter PhilippGackstatter merged commit 978bbb7 into develop May 16, 2024
17 of 35 checks passed
@PhilippGackstatter PhilippGackstatter deleted the 154-migrate-alias-outputs branch May 16, 2024 13:14
alexsporn pushed a commit that referenced this pull request Sep 6, 2024
* feat(sui-genesis-builder): store TypeOrigin of native tokens

While creating foundries now maps the `(ObjectID, TypeOrigin)` to the
`TokenId`.

* refactor(sui-genesis-builder): split stardust::types module

* feat(sui-genesis-builder): add unlock types

* feat(sui-genesis-builder): add BasicOutput type

* refactor(sui-genesis-builder): use OutputHeader while creating outputs

* feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* feat(sui-genesis-builder): fix native-token object ids during migration

* fixup! fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fix(sui-genesis-builder): correct BasicOutput::type_ module and name

Co-authored-by: Philipp Gackstatter <[email protected]>

* fix(sui-genesis-builder): load packages and input objects correctly

* fix(sui-genesis-builder): dummy transfer Bag object

* Implement move data model in Rust

* Execute alias creation transaction

* Fix dependencies during PTB execution

* Fix alias tags, extend test

* Add TODO for dynamic object field

* Expose `attach_alias` function

* Fix outstanding alias migration TODOs

* Prettify alias migration test

* `cargo fmt` the genesis builder

* Make state controller non-optional

* Move alias migration test to separate file

* Cleanup alias migration test

* Add zeroized check and simplify match statement

* Add non-zeroed alias id test

* Use to_genesis_object approach

* Use fresh_id as the alias output ID

* Compute version of aliases via `lamport_timestamp`

* Move crate-level migration test to module

---------

Co-authored-by: Konstantinos Demartinos <[email protected]>
alexsporn pushed a commit that referenced this pull request Sep 6, 2024
* feat(sui-genesis-builder): store TypeOrigin of native tokens

While creating foundries now maps the `(ObjectID, TypeOrigin)` to the
`TokenId`.

* refactor(sui-genesis-builder): split stardust::types module

* feat(sui-genesis-builder): add unlock types

* feat(sui-genesis-builder): add BasicOutput type

* refactor(sui-genesis-builder): use OutputHeader while creating outputs

* feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* feat(sui-genesis-builder): fix native-token object ids during migration

* fixup! fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fix(sui-genesis-builder): correct BasicOutput::type_ module and name

Co-authored-by: Philipp Gackstatter <[email protected]>

* fix(sui-genesis-builder): load packages and input objects correctly

* fix(sui-genesis-builder): dummy transfer Bag object

* Implement move data model in Rust

* Execute alias creation transaction

* Fix dependencies during PTB execution

* Fix alias tags, extend test

* Add TODO for dynamic object field

* Expose `attach_alias` function

* Fix outstanding alias migration TODOs

* Prettify alias migration test

* `cargo fmt` the genesis builder

* Make state controller non-optional

* Move alias migration test to separate file

* Cleanup alias migration test

* Add zeroized check and simplify match statement

* Add non-zeroed alias id test

* Use to_genesis_object approach

* Use fresh_id as the alias output ID

* Compute version of aliases via `lamport_timestamp`

* Move crate-level migration test to module

---------

Co-authored-by: Konstantinos Demartinos <[email protected]>
alexsporn pushed a commit that referenced this pull request Sep 6, 2024
* feat(sui-genesis-builder): store TypeOrigin of native tokens

While creating foundries now maps the `(ObjectID, TypeOrigin)` to the
`TokenId`.

* refactor(sui-genesis-builder): split stardust::types module

* feat(sui-genesis-builder): add unlock types

* feat(sui-genesis-builder): add BasicOutput type

* refactor(sui-genesis-builder): use OutputHeader while creating outputs

* feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* feat(sui-genesis-builder): fix native-token object ids during migration

* fixup! fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fix(sui-genesis-builder): correct BasicOutput::type_ module and name

Co-authored-by: Philipp Gackstatter <[email protected]>

* fix(sui-genesis-builder): load packages and input objects correctly

* fix(sui-genesis-builder): dummy transfer Bag object

* Implement move data model in Rust

* Execute alias creation transaction

* Fix dependencies during PTB execution

* Fix alias tags, extend test

* Add TODO for dynamic object field

* Expose `attach_alias` function

* Fix outstanding alias migration TODOs

* Prettify alias migration test

* `cargo fmt` the genesis builder

* Make state controller non-optional

* Move alias migration test to separate file

* Cleanup alias migration test

* Add zeroized check and simplify match statement

* Add non-zeroed alias id test

* Use to_genesis_object approach

* Use fresh_id as the alias output ID

* Compute version of aliases via `lamport_timestamp`

* Move crate-level migration test to module

---------

Co-authored-by: Konstantinos Demartinos <[email protected]>
alexsporn pushed a commit that referenced this pull request Sep 9, 2024
* feat(sui-genesis-builder): store TypeOrigin of native tokens

While creating foundries now maps the `(ObjectID, TypeOrigin)` to the
`TokenId`.

* refactor(sui-genesis-builder): split stardust::types module

* feat(sui-genesis-builder): add unlock types

* feat(sui-genesis-builder): add BasicOutput type

* refactor(sui-genesis-builder): use OutputHeader while creating outputs

* feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* feat(sui-genesis-builder): fix native-token object ids during migration

* fixup! fixup! fixup! feat(sui-genesis-builder): implement stardust::migration::Executor::create_basic_objects

* fix(sui-genesis-builder): correct BasicOutput::type_ module and name

Co-authored-by: Philipp Gackstatter <[email protected]>

* fix(sui-genesis-builder): load packages and input objects correctly

* fix(sui-genesis-builder): dummy transfer Bag object

* Implement move data model in Rust

* Execute alias creation transaction

* Fix dependencies during PTB execution

* Fix alias tags, extend test

* Add TODO for dynamic object field

* Expose `attach_alias` function

* Fix outstanding alias migration TODOs

* Prettify alias migration test

* `cargo fmt` the genesis builder

* Make state controller non-optional

* Move alias migration test to separate file

* Cleanup alias migration test

* Add zeroized check and simplify match statement

* Add non-zeroed alias id test

* Use to_genesis_object approach

* Use fresh_id as the alias output ID

* Compute version of aliases via `lamport_timestamp`

* Move crate-level migration test to module

---------

Co-authored-by: Konstantinos Demartinos <[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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants