Skip to content

Commit

Permalink
feat(protocol): add TaikoL1.getBlockProvers (#340)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidtaikocha authored Nov 26, 2022
1 parent c8c3c94 commit c54f810
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/protocol/contracts/L1/TaikoL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,14 @@ contract TaikoL1 is EssentialContract, IHeaderSync, V1Events {
return LibAnchorSignature.signTransaction(hash, k);
}

function getBlockProvers(uint256 id, bytes32 parentHash)
public
view
returns (address[] memory)
{
return state.forkChoices[id][parentHash].provers;
}

function getConstants()
public
pure
Expand Down
13 changes: 13 additions & 0 deletions packages/protocol/test/L1/TaikoL1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,19 @@ describe("TaikoL1", function () {
expect(hash).to.be.eq(genesisHash)
})
})

describe("getBlockProvers()", async function () {
it("should return empty list when there is no proof for that block", async function () {
const { taikoL1 } = await deployTaikoL1Fixture()

const provers = await taikoL1.getBlockProvers(
Math.ceil(Math.random() * 1024),
randomBytes32()
)

expect(provers).to.be.empty
})
})
})

function randomBytes32() {
Expand Down

0 comments on commit c54f810

Please sign in to comment.