Skip to content

Commit

Permalink
debug and get 6493 end to end client spec working
Browse files Browse the repository at this point in the history
  • Loading branch information
g11tech committed Sep 23, 2024
1 parent 449a9e2 commit f314666
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion packages/client/src/rpc/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const toJSONRPCTx = (
merkleBranch: Uint8Array[]
transactionsRoot: Uint8Array
transactionRoot: Uint8Array
}
},
): JSONRPCTx => {
const txJSON = tx.toJSON()
return {
Expand Down
10 changes: 5 additions & 5 deletions packages/client/src/rpc/modules/engine/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const transaction = validators.hexOrObject(
validators.object({
regular: validators.nullOptional(validators.uint256),
blob: validators.nullOptional(validators.uint256),
})
}),
),
gas: validators.nullOptional(validators.uint64),
to: validators.nullOptional(validators.address),
Expand All @@ -21,22 +21,22 @@ const transaction = validators.hexOrObject(
validators.object({
address: validators.address,
storageKeys: validators.array(validators.bytes32),
})
)
}),
),
),
maxPriorityFeesPerGas: validators.nullOptional(
validators.object({
regular: validators.nullOptional(validators.uint256),
blob: validators.nullOptional(validators.uint256),
})
}),
),
blobVersionedHashes: validators.nullOptional(validators.array(validators.bytes32)),
}),
signature: validators.object({
from: validators.nullOptional(validators.address),
ecdsaSignature: validators.nullOptional(validators.hex),
}),
})
}),
)

export const executionPayloadV1FieldValidators = {
Expand Down
6 changes: 3 additions & 3 deletions packages/client/src/rpc/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ export class Eth {
transactionsRoot: block.header.transactionsTrie,
...ssz.computeTransactionInclusionProof(
block.transactions.map((tx) => tx.sszRaw()),
txIndex
txIndex,
),
}
}
Expand Down Expand Up @@ -861,7 +861,7 @@ export class Eth {
transactionsRoot: block.header.transactionsTrie,
...ssz.computeTransactionInclusionProof(
block.transactions.map((tx) => tx.sszRaw()),
txIndex
txIndex,
),
}
}
Expand Down Expand Up @@ -895,7 +895,7 @@ export class Eth {
transactionsRoot: block.header.transactionsTrie,
...ssz.computeTransactionInclusionProof(
block.transactions.map((tx) => tx.sszRaw()),
txIndex
txIndex,
),
}
}
Expand Down
26 changes: 13 additions & 13 deletions packages/client/test/rpc/engine/newPayloadEip6493.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { TransactionFactory } from '@ethereumjs/tx'
import { createTx } from '@ethereumjs/tx'
import { bigIntToHex, hexToBytes } from '@ethereumjs/util'
import { assert, describe, it } from 'vitest'

import blocks from '../../testdata/blocks/beacon.json'
import genesisJSON from '../../testdata/geth-genesis/post-merge.json'
import { getRpcClient, setupChain } from '../helpers.js'
import { beaconData } from '../../testdata/blocks/beacon.js'
import { postMergeData } from '../../testdata/geth-genesis/post-merge.js'
import { getRPCClient, setupChain } from '../helpers.js'

const method = 'engine_newPayloadV4'
const [blockData] = blocks
const [blockData] = beaconData

const parentBeaconBlockRoot = '0x42942949c4ed512cd85c2cb54ca88591338cbb0564d3a2bea7961a639ef29d64'
const validForkChoiceState = {
Expand Down Expand Up @@ -48,9 +48,9 @@ describe(`${method}: call with executionPayloadV4`, () => {
it('valid data', async () => {
// get the genesis json with late enougt date with respect to block data in batchBlocks

const { pragueJson, pragueTime } = readyEip6493Genesis(genesisJSON)
const { pragueJson, pragueTime } = readyEip6493Genesis(postMergeData)
const { service, server, common } = await setupChain(pragueJson, 'post-merge', { engine: true })
const rpc = getRpcClient(server)
const rpc = getRPCClient(server)
const validBlock = {
...blockData,
timestamp: bigIntToHex(BigInt(pragueTime)),
Expand Down Expand Up @@ -78,7 +78,7 @@ describe(`${method}: call with executionPayloadV4`, () => {

// address 0x610adc49ecd66cbf176a8247ebd59096c031bd9f has been sufficiently funded in genesis
const pk = hexToBytes('0x9c9996335451aab4fc4eac58e31a8c300e095cdbcee532d53d09280e83360355')
const depositTx = TransactionFactory.fromTxData(
const depositTx = createTx(
{
data: '0x22895118000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000001208cd4e5a69709cf8ee5b1b73d6efbf3f33bcac92fb7e4ce62b2467542fb50a72d0000000000000000000000000000000000000000000000000000000000000030ac842878bb70009552a4cfcad801d6e659c50bd50d7d03306790cb455ce7363c5b6972f0159d170f625a99b2064dbefc000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020010000000000000000000000818ccb1c4eda80270b04d6df822b1e72dd83c3030000000000000000000000000000000000000000000000000000000000000060a747f75c72d0cf0d2b52504c7385b516f0523e2f0842416399f42b4aee5c6384a5674f6426b1cc3d0827886fa9b909e616f5c9f61f986013ed2b9bf37071cbae951136265b549f44e3c8e26233c0433e9124b7fd0dc86e82f9fedfc0a179d769',
value: 32000000000000000000n,
Expand All @@ -87,11 +87,11 @@ describe(`${method}: call with executionPayloadV4`, () => {
type: 2,
to: '0x00000000219ab540356cBB839Cbe05303d7705Fa',
},
{ common }
{ common },
).sign(pk)
await service.txPool.add(depositTx, true)

const normalLegacyTx = TransactionFactory.fromTxData(
const normalLegacyTx = createTx(
{
data: '0x',
value: 32000000000000000000n,
Expand All @@ -101,7 +101,7 @@ describe(`${method}: call with executionPayloadV4`, () => {
to: '0x10000000219ab540356cBB839Cbe05303d7705Fa',
nonce: 1,
},
{ common }
{ common },
).sign(pk)
await service.txPool.add(normalLegacyTx, true)

Expand All @@ -115,11 +115,11 @@ describe(`${method}: call with executionPayloadV4`, () => {
assert.ok(executionPayload.transactions.length === 2, 'two transactions should have been added')
assert.ok(
executionPayload.depositRequests?.length === 1,
'depositRequests should have 1 deposit request'
'depositRequests should have 1 deposit request',
)
assert.ok(
executionPayload.withdrawalRequests !== undefined,
'depositRequests field should be received'
'depositRequests field should be received',
)

res = await rpc.request(method, [executionPayload, [], parentBeaconBlockRoot])
Expand Down

0 comments on commit f314666

Please sign in to comment.