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

Migrate UDC #919

Merged
merged 41 commits into from
Mar 22, 2024
Merged

Migrate UDC #919

merged 41 commits into from
Mar 22, 2024

Conversation

andrew-fleming
Copy link
Collaborator

@andrew-fleming andrew-fleming commented Feb 19, 2024

Fixes #552.

PR Checklist

Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Looking good andrew! Left some comments

src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/presets.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/utils/_class_hashes.adoc Outdated Show resolved Hide resolved
let mut from_zero: bool = true;

if unique {
_salt = pedersen(deployer.into(), salt);
Copy link
Member

Choose a reason for hiding this comment

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

Should we consider using poseidon since is much cheaper? Maybe a UDC_v2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Huge +1 to UDC_v2 with poseidon

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, but note this UDC is already v2

Copy link
Member

Choose a reason for hiding this comment

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

I think we may need to be explicit in the name regarding the version. If people are using UDC already to predict addresses before deployment, getting confused about whether it uses pedersen or poseidon could be problematic, since the addresses would be different.

Copy link
Member

Choose a reason for hiding this comment

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

Should we update to Poseidon then on this PR? And should we add documentation about it and versions? In the starknet docsite we are not for example mentioning which hash algorithm is used, or how to precompute the addresses, and I think that's worth to mention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made this an issue: #950

src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
assert_eq!(expected_addr, deployed_addr);

// Check event
let event = utils::pop_log::<UniversalDeployer::Event>(udc.contract_address).unwrap();
Copy link
Member

Choose a reason for hiding this comment

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

Should we move this into a helper for consistency?

src/presets/universal_deployer.cairo Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
let mut from_zero: bool = true;

if unique {
_salt = pedersen(deployer.into(), salt);
Copy link
Member

Choose a reason for hiding this comment

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

I think we may need to be explicit in the name regarding the version. If people are using UDC already to predict addresses before deployment, getting confused about whether it uses pedersen or poseidon could be problematic, since the addresses would be different.

let mut from_zero: bool = true;

if unique {
_salt = pedersen(deployer.into(), salt);
Copy link
Member

Choose a reason for hiding this comment

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

Should we update to Poseidon then on this PR? And should we add documentation about it and versions? In the starknet docsite we are not for example mentioning which hash algorithm is used, or how to precompute the addresses, and I think that's worth to mention.

andrew-fleming and others added 5 commits March 12, 2024 14:40
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

looking good!

src/utils/universal_deployer/interface.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
@andrew-fleming andrew-fleming mentioned this pull request Mar 20, 2024
Copy link
Contributor

@martriay martriay left a comment

Choose a reason for hiding this comment

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

we need to fix that one variable name and good to go

src/tests/presets/test_universal_deployer.cairo Outdated Show resolved Hide resolved
src/tests/presets/test_universal_deployer.cairo Outdated Show resolved Hide resolved
Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

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

Left a small suggestion for consistency, but lgtm!

src/presets/universal_deployer.cairo Outdated Show resolved Hide resolved
@andrew-fleming andrew-fleming merged commit ec44ea8 into OpenZeppelin:main Mar 22, 2024
5 checks passed
@andrew-fleming andrew-fleming deleted the add-udc branch March 22, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Migrate UDC to Cairo 1+
3 participants