Skip to content

Commit

Permalink
feat: update snapshot with 5 commitments
Browse files Browse the repository at this point in the history
  • Loading branch information
merklefruit committed Sep 27, 2024
1 parent cab76d5 commit 9f62934
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
9 changes: 5 additions & 4 deletions bolt-contracts/.gas-snapshot
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
BoltChallengerTest:testCommitmentDigestAndSignature() (gas: 4626)
BoltChallengerTest:testCommitmentSignature() (gas: 6754)
BoltChallengerTest:testOpenAlreadyExistingChallenge() (gas: 111032)
BoltChallengerTest:testOpenChallengeInvalidSignature() (gas: 23847)
BoltChallengerTest:testOpenChallengeSingleTx() (gas: 406156)
BoltChallengerTest:testOpenAlreadyExistingChallenge() (gas: 112649)
BoltChallengerTest:testOpenChallengeInvalidSignature() (gas: 25461)
BoltChallengerTest:testOpenChallengeSingleTx() (gas: 407773)
BoltChallengerTest:testOpenChallengeWithIncorrectBond() (gas: 17130)
BoltChallengerTest:testOpenChallengeWithLargebond() (gas: 17141)
BoltChallengerTest:testOpenChallengeWithSlotInTheFuture() (gas: 17517)
BoltChallengerTest:testProveAccountData() (gas: 355542)
BoltChallengerTest:testProveHeaderData() (gas: 46228)
BoltChallengerTest:testProveTransactionInclusion() (gas: 176543)
BoltChallengerTest:testResolveChallengeFullDefenseSingleTx() (gas: 697302)
BoltChallengerTest:testResolveChallengeFullDefenseSingleTx() (gas: 697131)
BoltChallengerTest:testResolveChallengeFullDefenseStackedTxs() (gas: 1166625)
BoltManagerEigenLayerTest:testGetNonExistentProposerStatus() (gas: 921620)
BoltManagerEigenLayerTest:testGetWhitelistedCollaterals() (gas: 99988)
BoltManagerEigenLayerTest:testNonWhitelistedCollateral() (gas: 103013)
Expand Down
19 changes: 16 additions & 3 deletions bolt-contracts/test/BoltChallenger.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -364,10 +364,12 @@ contract BoltChallengerTest is Test {
// Check out https://etherscan.io/block/20817618

uint256 inclusionBlockNumber = 20_817_618;
IBoltChallenger.SignedCommitment[] memory commitments = new IBoltChallenger.SignedCommitment[](3);
IBoltChallenger.SignedCommitment[] memory commitments = new IBoltChallenger.SignedCommitment[](5);
commitments[0] = _createRecentBoltCommitment(inclusionBlockNumber, 1);
commitments[1] = _createRecentBoltCommitment(inclusionBlockNumber, 2);
commitments[2] = _createRecentBoltCommitment(inclusionBlockNumber, 3);
commitments[3] = _createRecentBoltCommitment(inclusionBlockNumber, 4);
commitments[4] = _createRecentBoltCommitment(inclusionBlockNumber, 5);

// Sanity check senders of the transactions: they should all be the same
for (uint256 i = 0; i < commitments.length; i++) {
Expand All @@ -391,22 +393,33 @@ contract BoltChallengerTest is Test {
assertEq(challenges.length, 1);
bytes32 challengeID = challenges[0].id;

// headers
string memory rawPreviousHeader = vm.readFile("./test/testdata/header_20817617.json");
string memory rawInclusionHeader = vm.readFile("./test/testdata/header_20817618.json");

// account
string memory ethProof = vm.readFile("./test/testdata/eth_proof_20817617.json");

// transactions
string memory txProof1 = vm.readFile("./test/testdata/tx_mpt_proof_20817618_1.json");
string memory txProof2 = vm.readFile("./test/testdata/tx_mpt_proof_20817618_2.json");
string memory txProof3 = vm.readFile("./test/testdata/tx_mpt_proof_20817618_3.json");
string memory txProof4 = vm.readFile("./test/testdata/tx_mpt_proof_20817618_4.json");
string memory txProof5 = vm.readFile("./test/testdata/tx_mpt_proof_20817618_5.json");

bytes[] memory txProofs = new bytes[](3);
bytes[] memory txProofs = new bytes[](5);
txProofs[0] = _RLPEncodeList(vm.parseJsonBytesArray(txProof1, ".proof"));
txProofs[1] = _RLPEncodeList(vm.parseJsonBytesArray(txProof2, ".proof"));
txProofs[2] = _RLPEncodeList(vm.parseJsonBytesArray(txProof3, ".proof"));
txProofs[3] = _RLPEncodeList(vm.parseJsonBytesArray(txProof4, ".proof"));
txProofs[4] = _RLPEncodeList(vm.parseJsonBytesArray(txProof5, ".proof"));

uint256[] memory txIndexesInBlock = new uint256[](3);
uint256[] memory txIndexesInBlock = new uint256[](5);
txIndexesInBlock[0] = vm.parseJsonUint(txProof1, ".index");
txIndexesInBlock[1] = vm.parseJsonUint(txProof2, ".index");
txIndexesInBlock[2] = vm.parseJsonUint(txProof3, ".index");
txIndexesInBlock[3] = vm.parseJsonUint(txProof4, ".index");
txIndexesInBlock[4] = vm.parseJsonUint(txProof5, ".index");

IBoltChallenger.Proof memory proof = IBoltChallenger.Proof({
inclusionBlockNumber: inclusionBlockNumber,
Expand Down

0 comments on commit 9f62934

Please sign in to comment.