Skip to content

Commit

Permalink
Merge pull request #8 from OffchainLabs/block-benchmarks
Browse files Browse the repository at this point in the history
Block benchmarks
  • Loading branch information
rachel-bousfield authored Aug 7, 2023
2 parents 2284688 + 92fd087 commit 48f4559
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 11 deletions.
32 changes: 32 additions & 0 deletions src/mocks/Benchmarks.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2022-2023, Offchain Labs, Inc.
// For license information, see https://github.com/nitro/blob/master/LICENSE
// SPDX-License-Identifier: BUSL-1.1

pragma solidity ^0.8.0;

contract Benchmarks {
function fillBlockRecover() external payable {
bytes32 bridgeToNova = 0xeddecf107b5740cef7f5a01e3ea7e287665c4e75a8eb6afae2fda2e3d4367786;
address cryptoIsCute = 0x361594F5429D23ECE0A88E4fBE529E1c49D524d8;
uint8 v = 27;
bytes32 r = 0xc6178c2de1078cd36c3bd302cde755340d7f17fcb3fcc0b9c333ba03b217029f;
bytes32 s = 0x5fdbcefe2675e96219cdae57a7894280bf80fd40d44ce146a35e169ea6a78fd3;
while (true) {
require(ecrecover(bridgeToNova, v, r, s) == cryptoIsCute, "WRONG_ARBINAUT");
}
}

function fillBlockHash() external payable {
bytes32 hash = 0xeddecf107b5740cef7f5a01e3ea7e287665c4e75a8eb6afae2fda2e3d4367786;
while (true) {
hash = keccak256(abi.encodePacked(hash));
}
}

function fillBlockQuickStep() external payable {
uint256 value = 0;
while (true) {
value = msg.value;
}
}
}
11 changes: 0 additions & 11 deletions src/mocks/Program.sol
Original file line number Diff line number Diff line change
Expand Up @@ -87,15 +87,4 @@ contract ProgramTest {
}
return result;
}

function fillBlock() external payable {
bytes32 bridgeToNova = 0xeddecf107b5740cef7f5a01e3ea7e287665c4e75a8eb6afae2fda2e3d4367786;
address cryptoIsCute = 0x361594F5429D23ECE0A88E4fBE529E1c49D524d8;
uint8 v = 27;
bytes32 r = 0xc6178c2de1078cd36c3bd302cde755340d7f17fcb3fcc0b9c333ba03b217029f;
bytes32 s = 0x5fdbcefe2675e96219cdae57a7894280bf80fd40d44ce146a35e169ea6a78fd3;
while (true) {
require(ecrecover(bridgeToNova, v, r, s) == cryptoIsCute, "WRONG_ARBINAUT");
}
}
}

0 comments on commit 48f4559

Please sign in to comment.