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

Implement determinstic contract addresses #1253

Merged
merged 13 commits into from
Mar 6, 2023

Conversation

webmaster128
Copy link
Member

@webmaster128 webmaster128 commented Aug 30, 2022

@webmaster128 webmaster128 force-pushed the implement-determinstic-contract-address branch from d26ba5b to 4287983 Compare March 6, 2023 14:40
@webmaster128 webmaster128 merged commit 2b9b113 into main Mar 6, 2023
@webmaster128 webmaster128 deleted the implement-determinstic-contract-address branch March 6, 2023 14:58
salt: Uint8Array,
prefix: string,
): string {
return _instantiate2AddressIntermediate(checksum, creator, salt, null, prefix).address;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why msg is always set to null when instantiate2 while Wasmd v0.31.x include msgs when creating address?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

I added #1398 for future readers

Copy link
Contributor

Choose a reason for hiding this comment

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

I got it.
However, according to the link you provided, it seems that fix_msg should be null, not that instantiate msg should be null and current code is making instantiate msg to null.

Copy link
Member Author

@webmaster128 webmaster128 Mar 27, 2023

Choose a reason for hiding this comment

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

It refers to different aspects of the same thing. If msg is null or empty during address generation, fixed_msg must be false in the actual instantiation.

If msg is null/empty (during address generation) and fixed_msg = false, then you can instantiate the contract with any msg you want without affecting the generated address.

Copy link
Contributor

@loin3 loin3 Mar 27, 2023

Choose a reason for hiding this comment

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

To be honest, I am not familiar with wasmd, so I'm not sure how to use instantiate2.
If you have a chance, could you make a test code that compares the address obtained with instantiate2Address and the address of the contract instantiated with instantiate2 in the script/wasmd chain?

And thank you for your kind answers :)

Copy link
Member Author

@webmaster128 webmaster128 Mar 27, 2023

Choose a reason for hiding this comment

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

Yeah, it's still early for instantiate2 and not much resources are out there. Feel free to subscribe to #1399 to see

  • Pre-calculation
  • Actual instantiation

in CosmJS. The tests for this ticket will make a few things clearer I guess.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, nice! I strongly advise for removing the msg input field there. Nobody should need to use it.

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.

3 participants