Skip to content

Commit

Permalink
vm/eip7002: correctly encode request [no ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed May 4, 2024
1 parent 65a97d9 commit 6357645
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/vm/src/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
bytesToHex,
bytesToInt,
setLengthLeft,
unpadBytes,
} from '@ethereumjs/util'

import type { RunTxResult } from './types'
Expand Down Expand Up @@ -85,7 +86,7 @@ const accumulateEIP7002Requests = async (vm: VM, requests: CLRequest[]): Promise
const slicedBytes = resultsBytes.slice(startByte, startByte + 76)
const sourceAddress = slicedBytes.slice(0, 20) // 20 Bytes
const validatorPubkey = slicedBytes.slice(20, 68) // 48 Bytes
const amount = slicedBytes.slice(68, 76) // 8 Bytes / Uint64
const amount = unpadBytes(slicedBytes.slice(68, 76)) // 8 Bytes / Uint64
const rlpData = RLP.encode([sourceAddress, validatorPubkey, amount])
const request = new CLRequest(withdrawalRequestType, rlpData)
requests.push(request)
Expand Down

0 comments on commit 6357645

Please sign in to comment.