Skip to content

Commit e20b2cb

Browse files
authored
fix: added requestsHash to rpl block encoding (#100)
* fix: added requestsHash to rpl block encoding * fix: updated comment * fix: fixed types
1 parent 807e49c commit e20b2cb

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/utils/ether-v5/proofsHelpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ export function formatToProofRLP(rawData: string[]): string {
1212
);
1313
}
1414

15-
// IMPORTANT valid only for post-Dancun blocks:
15+
// IMPORTANT valid only for post-Pectra blocks:
1616
// https://eips.ethereum.org/EIPS/eip-4844#header-extension
1717
// https://eips.ethereum.org/EIPS/eip-4788#block-structure-and-validity
18+
// https://cantina.xyz/introduction/pectra-competition-resources/eip-7685
1819
export function prepareBLockRLP(rawBlock: any) {
1920
const rawData = [
2021
rawBlock.parentHash,
@@ -43,6 +44,7 @@ export function prepareBLockRLP(rawBlock: any) {
4344
? '0x'
4445
: BigNumber.from(rawBlock.excessBlobGas).toHexString(),
4546
rawBlock.parentBeaconBlockRoot,
47+
rawBlock.requestsHash,
4648
];
4749
return ethers.utils.RLP.encode(rawData);
4850
}

src/utils/viem/proofsHelpers.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,15 @@ export const formatToProofRLP = (rawData: Hex[]) => {
2424
return toRlp(rawData.map((d: Hex) => fromRlp(d, 'hex')));
2525
};
2626

27-
// IMPORTANT valid only for post-Dancun blocks:
27+
// IMPORTANT valid only for post-Pectra blocks:
2828
// https://eips.ethereum.org/EIPS/eip-4844#header-extension
2929
// https://eips.ethereum.org/EIPS/eip-4788#block-structure-and-validity
30+
// https://cantina.xyz/introduction/pectra-competition-resources/eip-7685
3031
export const prepareBLockRLP = (
31-
rawBlock: Block & { parentBeaconBlockRoot: Hex },
32+
rawBlock: Block & {
33+
parentBeaconBlockRoot: Hex;
34+
requestsHash: Hex;
35+
},
3236
) => {
3337
const rawData: Hex[] = [
3438
rawBlock.parentHash,
@@ -53,6 +57,7 @@ export const prepareBLockRLP = (
5357
// @ts-ignore
5458
rawBlock.excessBlobGas === '0x0' ? '0x' : toHex(rawBlock.excessBlobGas),
5559
rawBlock.parentBeaconBlockRoot,
60+
rawBlock.requestsHash,
5661
];
5762
return toRlp(rawData);
5863
};

0 commit comments

Comments
 (0)