Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 3 additions & 1 deletion src/utils/ether-v5/proofsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ export function formatToProofRLP(rawData: string[]): string {
);
}

// IMPORTANT valid only for post-Dancun blocks:
// IMPORTANT valid only for post-Pectra blocks:
// https://eips.ethereum.org/EIPS/eip-4844#header-extension
// https://eips.ethereum.org/EIPS/eip-4788#block-structure-and-validity
// https://cantina.xyz/introduction/pectra-competition-resources/eip-7685
export function prepareBLockRLP(rawBlock: any) {
const rawData = [
rawBlock.parentHash,
Expand Down Expand Up @@ -43,6 +44,7 @@ export function prepareBLockRLP(rawBlock: any) {
? '0x'
: BigNumber.from(rawBlock.excessBlobGas).toHexString(),
rawBlock.parentBeaconBlockRoot,
rawBlock.requestsHash,
];
return ethers.utils.RLP.encode(rawData);
}
Expand Down
9 changes: 7 additions & 2 deletions src/utils/viem/proofsHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@ export const formatToProofRLP = (rawData: Hex[]) => {
return toRlp(rawData.map((d: Hex) => fromRlp(d, 'hex')));
};

// IMPORTANT valid only for post-Dancun blocks:
// IMPORTANT valid only for post-Pectra blocks:
// https://eips.ethereum.org/EIPS/eip-4844#header-extension
// https://eips.ethereum.org/EIPS/eip-4788#block-structure-and-validity
// https://cantina.xyz/introduction/pectra-competition-resources/eip-7685
export const prepareBLockRLP = (
rawBlock: Block & { parentBeaconBlockRoot: Hex },
rawBlock: Block & {
parentBeaconBlockRoot: Hex;
requestsHash: Hex;
},
) => {
const rawData: Hex[] = [
rawBlock.parentHash,
Expand All @@ -53,6 +57,7 @@ export const prepareBLockRLP = (
// @ts-ignore
rawBlock.excessBlobGas === '0x0' ? '0x' : toHex(rawBlock.excessBlobGas),
rawBlock.parentBeaconBlockRoot,
rawBlock.requestsHash,
];
return toRlp(rawData);
};
Expand Down
Loading