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: add a CREATE3 tutorial #1059

Open
Genesis3800 opened this issue Dec 1, 2023 · 13 comments
Open

feat: add a CREATE3 tutorial #1059

Genesis3800 opened this issue Dec 1, 2023 · 13 comments
Labels
A-forge Area: forge good first issue Good for newcomers T-new Type: new docs

Comments

@Genesis3800
Copy link
Contributor

Genesis3800 commented Dec 1, 2023

I totally understand if this feels repetitive since I also wrote the CREATE2 article, but I genuinely feel there are nuances that justify writing a tutorial on CREATE3, since there is no actual 'CREATE3' opcode.
I recently got this in my DMs.
image

Also I could not find a proper end-to-end tutorial on CREATE3.
I could work with the solady or solmate libraries to write a tutorial for a CREATE3 factory implementation.

If given the go ahead, I'll make this my best work ever.

@Genesis3800
Copy link
Contributor Author

Genesis3800 commented Dec 8, 2023

Hey @onbjerg , @Evalir , bump pls 😄

I'm totally cool with a rejection too no joke, just proposed this cause I felt there's a gap.

P.S: If we do this, I wanna include sections on deploying ,and then verifying the contracts deployed through a create3 factory too.

@mattsse
Copy link
Member

mattsse commented Dec 8, 2023

more tutorials good!

@Genesis3800
Copy link
Contributor Author

more tutorials good!

Damn damn damn, this makes me so stoked. I'll still wait a bit for anyone else to get their comments in. Will take this up after the weekend if nothing more is commented.
CC: @mds1 maybe you could want a say in this?

@Evalir
Copy link
Member

Evalir commented Dec 8, 2023

feel free to take it @Genesis3800 !

@mds1
Copy link
Contributor

mds1 commented Dec 8, 2023

One thought is that there's probably a few create3 implementations. I'm working with @pcaversaccio to make the one in https://github.com/pcaversaccio/createx a canonical one—I'm biased of course, but hopefully within ~2 weeks that one will be deployed and maybe that's the one we should reference and use in the tutorial.

Could you also give an outline of what you're planning to include? As you'll see in the docs/comments for CreateX, there are a few security concerns to be around of with create3 that we need to cover

@Genesis3800
Copy link
Contributor Author

Genesis3800 commented Dec 9, 2023

Damn, that's a news and a half @mds1 . Best of luck. I am open to waiting for your implementation to get finalised while I prep with as much of the tutorial as I can on my own.

Here's an outline of what I was planning:

  1. Introduction - What is CREATE3 and why bother with a CREATE3 implementation despite having the opcode CREATE2?

  2. CREATE3 factory - Go over a CREATE3 factory implementation. I like a factory contract instead of a library in a tutorial since the factory is easier to plug and play for the end user. I will go over the code in the same way as the CREATE2 article, step by step.

  3. Testing - Writing a couple of basic tests that work with 3 simple contracts: the factory, a barebones increment counter contract, and a barebones decrement counter contract. We will show that the CREATE3 factory deploys both of them to the same address by showing that the test will fail to deploy the second of the 2 contracts if supplied with the same salt.

  4. Deploying and Verifying - Deploy and verify both of the barebone contracts to two different chains at the same address as a proof of implementation.

What do you think?

P.S: @pcaversaccio I would love the chance to work with you, even if indirectly so. You're one of my favs in the space.

@pcaversaccio
Copy link
Contributor

Damn, that's a news and a half @mds1 . Best of luck. I am open to waiting for your implementation to get finalised while I prep with as much of the tutorial as I can on my own.

FWIW, we froze the code 2 days ago :); so you can use our reference implementation if you want.

Here's an outline of what I was planning:

  1. Introduction - What is CREATE3 and why bother with a CREATE3 implementation despite having the opcode CREATE2?
  2. CREATE3 factory - Go over a CREATE3 factory implementation. I like a factory contract instead of a library in a tutorial since the factory is easier to plug and play for the end user. I will go over the code in the same way as the CREATE2 article, step by step.
  3. Testing - Writing a couple of basic tests that work with 3 simple contracts: the factory, a barebones increment counter contract, and a barebones decrement counter contract. We will show that the CREATE3 factory deploys both of them to the same address by showing that the test will fail to deploy the second of the 2 contracts if supplied with the same salt.
  4. Deploying and Verifying - Deploy and verify both of the barebone contracts to two different chains at the same address as a proof of implementation.

What do you think?

One important part to mention is that since we live in a cross-chain world, CREATE3 deployments can be frontrun with another implementation code on another chain by anyone (as long as the factory itself is deployed on the other chain) if not protected by the factory. I.e. the salt value in CREATE3 deployments ensures that the proxy is deployed on the same address, but doesn't ensure that the implementation logic with that logic stays the same across different chains. CreateX offers protection mechanisms against this.

P.S: @pcaversaccio I would love the chance to work with you, even if indirectly so. You're one of my favs in the space.

Very much appreciate the kind words :) - happy to help review the CREATE3 tutorial if that helps.

@Genesis3800
Copy link
Contributor Author

Genesis3800 commented Dec 10, 2023

FWIW, we froze the code 2 days ago :); so you can use our reference implementation if you want.

Ty ser, will get started with yours, even though I am not totally confident I will be able to digest the complex frontrun protections. Will try my best as before.

Very much appreciate the kind words :) - happy to help review the CREATE3 tutorial if that helps.

Yes an extra pair of eyes always helps, especially from someone like you.

@Evalir This one will take some time at least. I'll try to have a first draft in 10-15 days. I'll try to expedite as much as possible.

@Genesis3800
Copy link
Contributor Author

Hey all,

just wanted to update everyone that I am still keen on completing this assigned issue. This one is taking time because I am finding the concepts involved difficult.

I will try my best to have the first draft on CREATEX ready in about a week.
BTW, @pcaversaccio congrats on the official release :)

@pcaversaccio
Copy link
Contributor

Hey all,

just wanted to update everyone that I am still keen on completing this assigned issue. This one is taking time because I am finding the concepts involved difficult.

I will try my best to have the first draft on CREATEX ready in about a week. BTW, @pcaversaccio congrats on the official release :)

😄 thxs; we're publicly live now https://twitter.com/pcaversaccio/status/1738153235678998855.

@Genesis3800
Copy link
Contributor Author

😄 thxs; we're publicly live now https://twitter.com/pcaversaccio/status/1738153235678998855.

Congrats ser, you deserve it.
I love how you put your insane hard work out for free for the public. I can't compete with you at this, but in good faith, I am doing my best to put out a good article on this topic.
Maybe that is also a tiniest bit of help.

@pcaversaccio
Copy link
Contributor

😄 thxs; we're publicly live now https://twitter.com/pcaversaccio/status/1738153235678998855.

Congrats ser, you deserve it. I love how you put your insane hard work out for free for the public. I can't compete with you at this, but in good faith, I am doing my best to put out a good article on this topic. Maybe that is also a tiniest bit of help.

Never underestimate the value of good educational material! That's part of the equation on how to attract great talent.

@Genesis3800
Copy link
Contributor Author

Hey guys,

I'm terribly sorry to write this, but can I withdraw from this PR? I don't think I can do justice to this one right now with my current job being as demanding as it is.
I have not been able to pick up the required concepts in a good manner either.

Apologies again :(
I hate going back on my word, but it turns out I am not capable of delivering on this one.
CC: @Evalir

@zerosnacks zerosnacks changed the title Would the team be open to a CREATE3 tutorial? feat: add a CREATE3 tutorial Sep 13, 2024
@zerosnacks zerosnacks added good first issue Good for newcomers A-forge Area: forge T-new Type: new docs labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-forge Area: forge good first issue Good for newcomers T-new Type: new docs
Projects
No open projects
Status: Todo
Development

No branches or pull requests

6 participants