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

pectra devnet4: implement pectra devnet4 spec #3706

Merged
merged 53 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
bcb48d2
vm: update the system contract addresses for prague devnet4
g11tech Sep 27, 2024
1c30c2a
change the requests root from trie root to flat root and update examp…
g11tech Sep 29, 2024
73003e7
convert requests to flat type across util,block and vm
g11tech Sep 29, 2024
7cd91a2
bundle execution requests separately from execution payload
g11tech Sep 29, 2024
b4c704b
Merge branch 'master' into devnet4-contracts
jochem-brouwer Oct 10, 2024
420a7aa
t8ntool: update to devnet-4 interface support
jochem-brouwer Oct 10, 2024
1b65e0c
update devnet-4 to EIP PRs 8924, 8394
jochem-brouwer Oct 10, 2024
6d39f31
t8ntool hotfix to fix state tests
jochem-brouwer Oct 10, 2024
7d023c4
refactor cl requests to the new simplified version
g11tech Oct 11, 2024
2998547
remove requests from the block and modify associated code paths
g11tech Oct 11, 2024
5d2ede2
remove storing and retriving of requests from blockchain
g11tech Oct 11, 2024
5fe681b
modify the deposit, withdrawal and consolidation requests accumulatio…
g11tech Oct 11, 2024
613c900
modfiy the 7002 eip spec along with the new contract and debug and fi…
g11tech Oct 11, 2024
9b5caf2
modify code to correctly patch generated requests on getpayload/build…
g11tech Oct 11, 2024
a62ed49
fix the newpayload engine codeflow to validate the cl requests
g11tech Oct 11, 2024
7e898d4
remove the requests from eth rpc and blockfetcher p2p
g11tech Oct 11, 2024
a5aa2db
modify debug and fix 6110 deposit spec test
g11tech Oct 11, 2024
3eafb13
update the vm 7685 spec and add todos for later consideration
g11tech Oct 11, 2024
638acc3
fix t8ntool rq output
jochem-brouwer Oct 11, 2024
965eb86
vm: fix 6110 requests
jochem-brouwer Oct 11, 2024
2fea7ae
update request to just store bytes and expose getters for data and ty…
g11tech Oct 12, 2024
8b641de
repo: rename requestsRoot -> requestsHash
jochem-brouwer Oct 13, 2024
dae997e
vm: fix import (fix docker build)
jochem-brouwer Oct 14, 2024
bef2f34
client: correctly return request data (not including type)
jochem-brouwer Oct 14, 2024
860c621
fix the ingress, generation and propagation of execution requests/req…
g11tech Oct 14, 2024
a6dde76
Update 6110 example
scorbajio Oct 22, 2024
e7ba8b9
Use sha256 constant for default
scorbajio Oct 23, 2024
ee9a33d
Fix asserts
scorbajio Oct 23, 2024
239a63d
Add sha256 empty string constant
scorbajio Oct 23, 2024
4f9ae46
Update block REAME examples
scorbajio Oct 23, 2024
f0b5acc
Reuse already computed hash
scorbajio Oct 23, 2024
d7a33f8
Merge branch 'master' of github.com:ethereumjs/ethereumjs-monorepo in…
scorbajio Oct 23, 2024
676b93b
Fix buildBlock tests
scorbajio Oct 23, 2024
b1bae17
Fix vm api tests
scorbajio Oct 23, 2024
9d3652f
Fix client tests
scorbajio Oct 23, 2024
ea935e7
Fix tests
scorbajio Oct 23, 2024
7e1c382
packages: add requests hash to genesis block (#3771)
spencer-tb Oct 25, 2024
9d5822f
util: correctly report empty rq hash
jochem-brouwer Oct 26, 2024
dc93f8f
blockchain/util: remove sha256_empty_rh from exported util constants
jochem-brouwer Oct 28, 2024
9c64353
Merge branch 'master' into devnet4-contracts
scorbajio Oct 28, 2024
328cd53
Remove requests from being passed in as blockData
scorbajio Oct 28, 2024
c7f4640
Remove old tests that do not conform to new devnet4 specs
scorbajio Oct 28, 2024
a973b43
Remove old test that does not conform to new devnet4 specs
scorbajio Oct 28, 2024
000839d
make linter happy
jochem-brouwer Oct 31, 2024
d91b666
block: make tsc happy
jochem-brouwer Oct 31, 2024
84f40e3
block: remove obsolete examples
jochem-brouwer Oct 31, 2024
d3e6cca
util: make tsc happy
jochem-brouwer Oct 31, 2024
802145d
vm: make linter and tsc happy
jochem-brouwer Oct 31, 2024
88eb200
blockchain: make linter happy
jochem-brouwer Oct 31, 2024
adff539
vm: fix example
jochem-brouwer Oct 31, 2024
46ec57d
make cspell happy
jochem-brouwer Oct 31, 2024
5446fb8
client/util/vm: simplify CLRequest
jochem-brouwer Oct 31, 2024
152ae16
Merge branch 'master' into devnet4-contracts
acolytec3 Oct 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions config/cspell-ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}
],
"words": [
"EEST",
"paulmillr",
"t8ntool",
"!Json",
Expand Down
9 changes: 6 additions & 3 deletions packages/block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
type CLRequest,
type CLRequestType,
} from '@ethereumjs/util'
import { keccak256 } from 'ethereum-cryptography/keccak.js'
Copy link
Member

Choose a reason for hiding this comment

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

Needs update, now uses sha256

Copy link
Contributor

Choose a reason for hiding this comment

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

Fixed the example and will push updates.

Copy link
Contributor

Choose a reason for hiding this comment

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

The 7002 example in the block package fails still, but since ssz isn't supported, we would have to provide a very minimal example.

Copy link
Member

Choose a reason for hiding this comment

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

The SSZ support is a misunderstanding: we do not need to import SSZ. The contract (which generates those requests) internally LOGs the data SSZ-encoded (we can just read the log as opaque bytes and use that). We should update the example (I'll take a look what it does currently)


const main = async () => {
const common = new Common({
Expand All @@ -42,7 +43,7 @@ const main = async () => {
}
const request = DepositRequest.fromRequestData(depositRequestData) as CLRequest<CLRequestType>
const requests = [request]
const requestsRoot = await Block.genRequestsTrieRoot(requests)
const requestsRoot = await Block.genRequestsRoot(requests, keccak256)

const block = Block.fromBlockData(
{
Expand Down Expand Up @@ -77,6 +78,7 @@ import {
type CLRequest,
type CLRequestType,
} from '@ethereumjs/util'
import { keccak256 } from 'ethereum-cryptography/keccak.js'

const main = async () => {
const common = new Common({
Expand All @@ -93,7 +95,7 @@ const main = async () => {
withdrawalRequestData,
) as CLRequest<CLRequestType>
const requests = [request]
const requestsRoot = await Block.genRequestsTrieRoot(requests)
const requestsRoot = await Block.genRequestsRoot(requests, keccak256)

const block = Block.fromBlockData(
{
Expand Down Expand Up @@ -130,6 +132,7 @@ import {
type CLRequest,
type CLRequestType,
} from '@ethereumjs/util'
import { keccak256 } from 'ethereum-cryptography/keccak.js'

const main = async () => {
const common = new Common({
Expand All @@ -146,7 +149,7 @@ const main = async () => {
consolidationRequestData,
) as CLRequest<CLRequestType>
const requests = [request]
const requestsRoot = await Block.genRequestsTrieRoot(requests)
const requestsRoot = await Block.genRequestsRoot(requests, keccak256)

const block = Block.fromBlockData(
{
Expand Down
44 changes: 25 additions & 19 deletions packages/block/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,16 @@ Starting with v5.3.0 this library supports requests to the consensus layer which
```ts
// ./examples/6110Requests.ts

import { createBlock, genRequestsTrieRoot } from '@ethereumjs/block'
import { createBlock, genRequestsRoot } from '@ethereumjs/block'
import { Common, Hardfork, Mainnet } from '@ethereumjs/common'
import {
type CLRequest,
type CLRequestType,
bytesToBigInt,
createDepositRequest,
CLRequestType,
bytesToHex,
createCLRequest,
randomBytes,
} from '@ethereumjs/util'
import { sha256 } from 'ethereum-cryptography/sha256.js'

const main = async () => {
const common = new Common({
Expand All @@ -264,26 +265,29 @@ const main = async () => {
const depositRequestData = {
pubkey: randomBytes(48),
withdrawalCredentials: randomBytes(32),
amount: bytesToBigInt(randomBytes(8)),
amount: randomBytes(8),
signature: randomBytes(96),
index: bytesToBigInt(randomBytes(8)),
index: randomBytes(8),
}
const request = createDepositRequest(depositRequestData) as CLRequest<CLRequestType>
// flatten request bytes as per EIP-7685
const depositRequestBytes = new Uint8Array(
Object.values(depositRequestData)
.map((arr) => Array.from(arr)) // Convert Uint8Arrays to regular arrays
.reduce((acc, curr) => acc.concat(curr), []), // Concatenate arrays
)
const request = createCLRequest(
new Uint8Array([CLRequestType.Deposit, ...depositRequestBytes]),
) as CLRequest<CLRequestType.Deposit>
const requests = [request]
const requestsRoot = await genRequestsTrieRoot(requests)
const requestsRoot = genRequestsRoot(requests, sha256)

const block = createBlock(
{
requests,
header: { requestsRoot },
header: { requestsHash: requestsRoot },
},
{ common },
)
console.log(
`Instantiated block with ${
block.requests?.length
} deposit request, requestTrieValid=${await block.requestsTrieIsValid()}`,
)
console.log(`Instantiated block ${block}, requestsHash=${bytesToHex(block.header.requestsHash!)}`)
}

void main()
Expand All @@ -298,7 +302,7 @@ Have a look at the EIP for some guidance on how to use and fill in the various d
```ts
// ./examples/7002Requests.ts

import { createBlock, genRequestsTrieRoot } from '@ethereumjs/block'
import { createBlock, genRequestsRoot } from '@ethereumjs/block'
import { Common, Hardfork, Mainnet } from '@ethereumjs/common'
import {
type CLRequest,
Expand All @@ -307,6 +311,7 @@ import {
createWithdrawalRequest,
randomBytes,
} from '@ethereumjs/util'
import { sha256 } from 'ethereum-cryptography/keccak.js'

const main = async () => {
const common = new Common({
Expand All @@ -321,7 +326,7 @@ const main = async () => {
}
const request = createWithdrawalRequest(withdrawalRequestData) as CLRequest<CLRequestType>
const requests = [request]
const requestsRoot = await genRequestsTrieRoot(requests)
const requestsRoot = genRequestsRoot(requests, sha256)

const block = createBlock(
{
Expand Down Expand Up @@ -349,14 +354,15 @@ Have a look at the EIP for some guidance on how to use and fill in the various w
```ts
// ./examples/7251Requests.ts

import { createBlock, genRequestsTrieRoot } from '@ethereumjs/block'
import { createBlock, genRequestsRoot } from '@ethereumjs/block'
import { Common, Hardfork, Mainnet } from '@ethereumjs/common'
import {
type CLRequest,
type CLRequestType,
createConsolidationRequest,
randomBytes,
} from '@ethereumjs/util'
import { sha256 } from 'ethereum-cryptography/keccak.js'

const main = async () => {
const common = new Common({
Expand All @@ -371,7 +377,7 @@ const main = async () => {
}
const request = createConsolidationRequest(consolidationRequestData) as CLRequest<CLRequestType>
const requests = [request]
const requestsRoot = await genRequestsTrieRoot(requests)
const requestsRoot = genRequestsRoot(requests, sha256)

const block = createBlock(
{
Expand Down
42 changes: 0 additions & 42 deletions packages/block/examples/6110Requests.ts

This file was deleted.

40 changes: 0 additions & 40 deletions packages/block/examples/7002Requests.ts

This file was deleted.

39 changes: 0 additions & 39 deletions packages/block/examples/7251Requests.ts

This file was deleted.

Loading
Loading