Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
ec4f0683
Commit
ec4f0683
authored
Jul 31, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
:broom:
parent
713e73a7
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
18 deletions
+13
-18
blockhashoracle.go
op-bindings/bindings/blockhashoracle.go
+1
-1
blockhashoracle_more.go
op-bindings/bindings/blockhashoracle_more.go
+1
-1
disputegamefactory.go
op-bindings/bindings/disputegamefactory.go
+1
-1
disputegamefactory_more.go
op-bindings/bindings/disputegamefactory_more.go
+1
-1
deploy.go
op-e2e/e2eutils/disputegame/deploy.go
+3
-1
helper.go
op-e2e/e2eutils/disputegame/helper.go
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+1
-1
BlockHashOracle.sol
packages/contracts-bedrock/src/dispute/BlockHashOracle.sol
+2
-9
BlockHashOracle.t.sol
packages/contracts-bedrock/test/BlockHashOracle.t.sol
+2
-2
No files found.
op-bindings/bindings/blockhashoracle.go
View file @
ec4f0683
...
...
@@ -31,7 +31,7 @@ var (
// BlockHashOracleMetaData contains all meta data concerning the BlockHashOracle contract.
var
BlockHashOracleMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
name
\"
:
\"
BlockHashNotPresent
\"
,
\"
type
\"
:
\"
error
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
BlockNumberOOB
\"
,
\"
type
\"
:
\"
error
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
load
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
Hash
\"
,
\"
name
\"
:
\"
blockHash_
\"
,
\"
type
\"
:
\"
bytes32
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
store
\"
,
\"
outputs
\"
:[],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x608060405234801561001057600080fd5b5061013
4806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636057361d1461003b57806399d548aa14610050575b600080fd5b61004e61004936600461010e565b610075565b005b61006361005e36600461010e565b6100c0565b60405190815260200160405180910390f35b8040806100ae576040517fd82756d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009182526020829052604090912055565b60008181526020819052604081205490819003610109576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600060208284031215610120
57600080fd5b503591905056fea164736f6c634300080f000a"
,
Bin
:
"0x608060405234801561001057600080fd5b5061013
8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80636057361d1461003b57806399d548aa14610050575b600080fd5b61004e610049366004610112565b610075565b005b61006361005e366004610112565b6100c4565b60405190815260200160405180910390f35b804060008190036100b2576040517fd82756d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009182526020829052604090912055565b6000818152602081905260408120549081900361010d576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600060208284031215610124
57600080fd5b503591905056fea164736f6c634300080f000a"
,
}
// BlockHashOracleABI is the input ABI used to generate the binding from.
...
...
op-bindings/bindings/blockhashoracle_more.go
View file @
ec4f0683
...
...
@@ -13,7 +13,7 @@ const BlockHashOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contra
var
BlockHashOracleStorageLayout
=
new
(
solc
.
StorageLayout
)
var
BlockHashOracleDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636057361d1461003b57806399d548aa14610050575b600080fd5b61004e6100493660046101
0e565b610075565b005b61006361005e36600461010e565b6100c0565b60405190815260200160405180910390f35b8040806100ae576040517fd82756d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009182526020829052604090912055565b60008181526020819052604081205490819003610109576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600060208284031215610120
57600080fd5b503591905056fea164736f6c634300080f000a"
var
BlockHashOracleDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100365760003560e01c80636057361d1461003b57806399d548aa14610050575b600080fd5b61004e6100493660046101
12565b610075565b005b61006361005e366004610112565b6100c4565b60405190815260200160405180910390f35b804060008190036100b2576040517fd82756d800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60009182526020829052604090912055565b6000818152602081905260408120549081900361010d576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600060208284031215610124
57600080fd5b503591905056fea164736f6c634300080f000a"
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
BlockHashOracleStorageLayoutJSON
),
BlockHashOracleStorageLayout
);
err
!=
nil
{
...
...
op-bindings/bindings/disputegamefactory.go
View file @
ec4f0683
This diff is collapsed.
Click to expand it.
op-bindings/bindings/disputegamefactory_more.go
View file @
ec4f0683
This diff is collapsed.
Click to expand it.
op-e2e/e2eutils/disputegame/deploy.go
View file @
ec4f0683
...
...
@@ -51,10 +51,12 @@ func deployDisputeGameContracts(require *require.Assertions, ctx context.Context
require
.
NoError
(
err
)
// Deploy the block hash oracle
_
,
tx
,
blockHashOracle
,
err
:
=
bindings
.
DeployBlockHashOracle
(
opts
,
client
)
_
,
tx
,
_
,
err
=
bindings
.
DeployBlockHashOracle
(
opts
,
client
)
require
.
NoError
(
err
)
blockHashOracleAddr
,
err
:=
bind
.
WaitDeployed
(
ctx
,
client
,
tx
)
require
.
NoError
(
err
)
blockHashOracle
,
err
:=
bindings
.
NewBlockHashOracle
(
blockHashOracleAddr
,
client
)
require
.
NoError
(
err
)
// Store the genesis block hash in the oracle
tx
,
err
=
blockHashOracle
.
Store
(
opts
,
big
.
NewInt
(
0
))
...
...
op-e2e/e2eutils/disputegame/helper.go
View file @
ec4f0683
...
...
@@ -33,7 +33,7 @@ const (
StatusDefenderWins
)
var
alphaExtraData
=
common
.
Hex2Bytes
(
"0
x0
0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000"
)
var
alphaExtraData
=
common
.
Hex2Bytes
(
"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000"
)
var
alphabetVMAbsolutePrestate
=
common
.
Hex2Bytes
(
"0000000000000000000000000000000000000000000000000000000000000060"
)
var
alphabetVMAbsolutePrestateClaim
=
crypto
.
Keccak256Hash
(
alphabetVMAbsolutePrestate
)
var
CorrectAlphabet
=
"abcdefghijklmnop"
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
ec4f0683
...
...
@@ -16,7 +16,7 @@ AssetReceiverTest:test_withdrawETHwithAmount_unauthorized_reverts() (gas: 10738)
AttestationStationTest:test_attest_bulk_succeeds() (gas: 703740)
AttestationStationTest:test_attest_individual_succeeds() (gas: 632078)
AttestationStationTest:test_attest_single_succeeds() (gas: 651316)
BlockHashOracle_Test:test_load_reverts() (gas: 10436)
BlockHashOracle_Test:test_load_
noBlockHash_
reverts() (gas: 10436)
Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 9413)
Bytes_slice_Test:test_slice_acrossWords_works() (gas: 1430)
Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17240)
...
...
packages/contracts-bedrock/src/dispute/BlockHashOracle.sol
View file @
ec4f0683
...
...
@@ -16,10 +16,7 @@ contract BlockHashOracle {
/// @return blockHash_ The block hash for the given block number.
function load(uint256 _blockNumber) external view returns (Hash blockHash_) {
blockHash_ = blockHashes[_blockNumber];
if (Hash.unwrap(blockHash_) == 0) {
revert BlockHashNotPresent();
}
if (Hash.unwrap(blockHash_) == 0) revert BlockHashNotPresent();
}
/// @notice Stores a block hash for a given block number, assuming that the block number
...
...
@@ -27,11 +24,7 @@ contract BlockHashOracle {
/// @param _blockNumber The block number to persist the block hash for.
function store(uint256 _blockNumber) external {
bytes32 blockHash = blockhash(_blockNumber);
if (blockHash == bytes32(0)) {
revert BlockNumberOOB();
}
if (blockHash == 0) revert BlockNumberOOB();
blockHashes[_blockNumber] = Hash.wrap(blockHash);
}
}
packages/contracts-bedrock/test/BlockHashOracle.t.sol
View file @
ec4f0683
...
...
@@ -24,7 +24,7 @@ contract BlockHashOracle_Test is Test {
/// @notice Tests that loading a block hash for a block number outside the range of the
/// `BLOCKHASH` opcode fails.
function testFuzz_store_reverts(uint256 _blockNumber) public {
function testFuzz_store_
oob_
reverts(uint256 _blockNumber) public {
// Fast forward another 256 blocks.
vm.roll(block.number + 256);
// Bound the block number to the set { 0, ..., 255 } ∪ { 512, ..., type(uint256).max }
...
...
@@ -39,7 +39,7 @@ contract BlockHashOracle_Test is Test {
/// @notice Tests that the `load` function reverts if the block hash for the given block
/// number has not been stored.
function test_load_reverts() public {
function test_load_
noBlockHash_
reverts() public {
vm.expectRevert(BlockHashNotPresent.selector);
oracle.load(0);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment