Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrust committed May 27, 2024
1 parent 06446d2 commit 2aa424a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/lib/prover.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ async function generateRandaoProof(block) {
block.receiptsRoot,
block.logsBloom,
"0x",
block.number == "0x0" ? "0x" : block.number,
block.number === "0x0" ? "0x" : block.number,
block.gasLimit,
block.gasUsed == "0x0" ? "0x" : block.gasUsed,
block.gasUsed === "0x0" ? "0x" : block.gasUsed,
block.timestamp,
block.extraData,
block.mixHash,
'0x0000000000000000',
block.baseFeePerGas == "0x0" ? "0x" : block.baseFeePerGas,
block.baseFeePerGas === "0x0" ? "0x" : block.baseFeePerGas,
block.withdrawalsRoot,
block.blobGasUsed == "0x0" ? "0x" : block.blobGasUsed,
block.excessBlobGas == "0x0" ? "0x" : block.excessBlobGas,
block.blobGasUsed === "0x0" ? "0x" : block.blobGasUsed,
block.excessBlobGas === "0x0" ? "0x" : block.excessBlobGas,
block.parentBeaconBlockRoot,
];

Expand Down
6 changes: 6 additions & 0 deletions test/randao-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ describe("Randao Test", function () {
let bn = await ethers.provider.getBlockNumber();
const blockNumber = ethers.utils.hexValue(bn);
const block = await ethers.provider.send('eth_getBlockByNumber', [blockNumber, false]);

// assert it is a cancun block
expect(block.blobGasUsed).to.exist;
expect(block.excessBlobGas).to.exist;
expect(block.parentBeaconBlockRoot).to.exist;

const encodedHeader = await generateRandaoProof(block);
const hash = keccak256(encodedHeader);
expect(hash).to.equal(block.hash);
Expand Down

0 comments on commit 2aa424a

Please sign in to comment.