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

Skinniest CREATELINK #2185

Closed
wants to merge 15 commits into from
Closed

Conversation

wjmelements
Copy link
Contributor

@wjmelements wjmelements commented Jul 10, 2019

As demonstrated in EIP 911, a lot of state can be saved by sharing code of identical contracts.
This EIP adds a minimalist CREATELINK opcode at 0xf7 that takes one parameter, the target contract address, and returns one parameter, the created account address.
No constructor is called; the code matches the code at the target address.
It is self-chainable, so factory contracts can make many children back-to-back with little overhead.

@github-actions
Copy link

github-actions bot commented Sep 8, 2020

There has been no activity on this pull request for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot added the stale label Sep 8, 2020
@wjmelements
Copy link
Contributor Author

I have received no feedback but am ready for a review.

@github-actions github-actions bot removed the stale label Sep 9, 2020
Copy link
Contributor

@MicahZoltu MicahZoltu left a comment

Choose a reason for hiding this comment

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

I believe it will be necessary to discuss how this interacts with SELFDESTRUCT on the linked contract, but that isn't necessary for Draft status.

EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
eip: <to be assigned>
title: CREATELINK opcode
author: William Morriss (@wjmelements)
discussions-to: [Github PR](https://github.com/ethereum/EIPs/pull/2185)
Copy link
Contributor

Choose a reason for hiding this comment

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

This can't be the pull request. You can create a new issue or a thread on https://ethereum-magicians.org/. Also, this should just be the link, not a markdown link with title.

EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
EIPS/eip-draft_createlink.md Outdated Show resolved Hide resolved
<!--The technical specification should describe the syntax and semantics of any new feature. The specification should be detailed enough to allow competing, interoperable implementations for any of the current Ethereum platforms (go-ethereum, parity, cpp-ethereum, ethereumj, ethereumjs, and [others](https://github.com/ethereum/wiki/wiki/Clients)).-->
The opcode for `CREATELINK` is `0xf7`.
`CREATELINK` pops one word, the target address.
As with `BALANCE`, `EXTCODESIZE`, `EXTCODECOPY`, and `EXTCODEHASH`, the upper 12 bytes are zeroed.
Copy link
Contributor

Choose a reason for hiding this comment

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

The first time any opcode is referenced in an EIP it needs to have (`0x##`) after it. Please add that for these opcodes.

Alternatively, just remove them since we don't really need a comparison in order to draft a specification. Instead just say:

the upper 12 bytes of the popped address are zeroed.

In case the account does not exist or does not have code, the opcode is equivalent to a revert returning 32 bytes, the `OR` of `0xf7 << 31` and the non-existent account address.
For example, a call to a contract with code `0x3df7` would revert, returning data `0xf700000000000000000000000000000000000000000000000000000000000000` and the remaining gas.

The new account address is calulated the same way as in `CREATE`.
Copy link
Contributor

Choose a reason for hiding this comment

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

In the Rationale, I recommend discussing why CREATE instead of CREATE2 (unless it is obvious and I'm just being dense).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CREATE2 has salt; CREATE does not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could we add a salt parameter that is popped from the stack? I have heard many people indicate that they have a strong preference for CREATE2 addressing, with some even going as far as suggesting we drop CREATE support. It would be unfortunate to go the opposite direction and introduce a new creation opcode that uses the unliked addressing mechanism.

wjmelements and others added 12 commits September 10, 2020 17:43
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
Co-authored-by: Micah Zoltu <micah@zoltu.net>
@github-actions
Copy link

There has been no activity on this pull request for two months. It will be closed in a week if no further activity occurs. If you would like to move this EIP forward, please respond to any outstanding feedback or add a comment indicating that you have addressed all required feedback and are ready for a review.

@github-actions github-actions bot added the stale label Nov 22, 2020
@github-actions
Copy link

This pull request was closed due to inactivity. If you are still pursuing it, feel free to reopen it and respond to any feedback or request a review in a comment.

@github-actions github-actions bot closed this Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants