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

Cherry-pick 7702 SetCode transaction type [experimental] #469

Closed
wants to merge 4 commits into from

Conversation

sebastianst
Copy link
Member

Description

Cherry-picks three PRs from the upcoming v1.14.13 upstream release to add the new Pectra 7702 SetCode transaction type to op-geth (and thus make it available to the monorepo):

Had to do a bit of merge conflict resolution, but it wasn't too bad. Those three were the minimal set of changes required to get the main PR ethereum/go-ethereum#30078 to work.

Tests

The pulled-in PRs contain tests.

Additional context

Required to add L1 Pectra support in the monorepo, since we need the new tx type to work with.

Towards ethereum-optimism/optimism#13627

holiman and others added 4 commits January 21, 2025 21:30
In many cases, there is a need to create somewhat nontrivial bytecode. A
recent example is the verkle statetests, where we want a `CREATE2`- op
to create a contract, which can then be invoked, and when invoked does a
selfdestruct-to-self.

It is overkill to go full solidity, but it is also a bit tricky do
assemble this by concatenating bytes. This PR takes an approach that
has been used in in goevmlab for several years.

Using this utility, the case can be expressed as: 
```golang
	// Some runtime code
	runtime := program.New().Ops(vm.ADDRESS, vm.SELFDESTRUCT).Bytecode()
	// A constructor returning the runtime code
	initcode := program.New().ReturnData(runtime).Bytecode()
	// A factory invoking the constructor
	outer := program.New().Create2AndCall(initcode, nil).Bytecode()
```

We have a lot of places in the codebase where we concatenate bytes, cast
from `vm.OpCode` . By taking tihs approach instead, thos places can be made a
bit more maintainable/robust.
Add block overrides to `eth_estimateGas` to align consistency with
`eth_call`.

ethereum/go-ethereum#27800 (comment)

Fixes ethereum/go-ethereum#28175

---------

Co-authored-by: Sina Mahmoodi <itz.s1na@gmail.com>
This PR implements EIP-7702: "Set EOA account code".
Specification: https://eips.ethereum.org/EIPS/eip-7702

> Add a new transaction type that adds a list of `[chain_id, address,
nonce, y_parity, r, s]` authorization tuples. For each tuple, write a
delegation designator `(0xef0100 ++ address)` to the signing account’s
code. All code reading operations must load the code pointed to by the
designator.

---------

Co-authored-by: Mario Vega <marioevz@gmail.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
Co-authored-by: Felix Lange <fjl@twurst.com>
@sebastianst
Copy link
Member Author

This isn't leading anywhere, gonna proceed with a full master merge.

@sebastianst sebastianst deleted the seb/exp-7702 branch February 26, 2025 16:41
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.

4 participants