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
3fb9b845
Unverified
Commit
3fb9b845
authored
Oct 01, 2023
by
OptimismBot
Committed by
GitHub
Oct 01, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7493 from ethereum-optimism/ctb/block-oracle-version
contracts-bedrock: add `ISemver` to `BlockOracle`
parents
5f5a652c
7052ed4b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
7 deletions
+44
-7
blockoracle.go
op-bindings/bindings/blockoracle.go
+33
-2
blockoracle_more.go
op-bindings/bindings/blockoracle_more.go
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+3
-3
semver-lock.json
packages/contracts-bedrock/semver-lock.json
+1
-0
BlockOracle.sol
packages/contracts-bedrock/src/dispute/BlockOracle.sol
+6
-1
No files found.
op-bindings/bindings/blockoracle.go
View file @
3fb9b845
...
...
@@ -36,8 +36,8 @@ type BlockOracleBlockInfo struct {
// BlockOracleMetaData contains all meta data concerning the BlockOracle contract.
var
BlockOracleMetaData
=
&
bind
.
MetaData
{
ABI
:
"[{
\"
inputs
\"
:[],
\"
name
\"
:
\"
BlockHashNotPresent
\"
,
\"
type
\"
:
\"
error
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
Hash
\"
,
\"
name
\"
:
\"
blockHash
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
Timestamp
\"
,
\"
name
\"
:
\"
childTimestamp
\"
,
\"
type
\"
:
\"
uint64
\"
}],
\"
name
\"
:
\"
Checkpoint
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
checkpoint
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
blockNumber_
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
load
\"
,
\"
outputs
\"
:[{
\"
components
\"
:[{
\"
internalType
\"
:
\"
Hash
\"
,
\"
name
\"
:
\"
hash
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
Timestamp
\"
,
\"
name
\"
:
\"
childTimestamp
\"
,
\"
type
\"
:
\"
uint64
\"
}],
\"
internalType
\"
:
\"
structBlockOracle.BlockInfo
\"
,
\"
name
\"
:
\"
blockInfo_
\"
,
\"
type
\"
:
\"
tuple
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}]"
,
Bin
:
"0x608060405234801561001057600080fd5b506102
1c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c806399d548aa1461003b578063c2c4c5c114610078575b600080fd5b61004e6100493660046101b8565b61008e565b604080518251815260209283015167ffffffffffffffff1692810192909252015b60405180910390f35b61008061010d565b60405190815260200161006f565b604080518082018252600080825260209182018190528381528082528281208351808501909452805480855260019091015467ffffffffffffffff169284019290925203610108576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600061011a6001436101d1565b60408051808201825282408082524267ffffffffffffffff81811660208086018281526000898152918290528782209651875551600190960180547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016969093169590951790915593519495509093909291849186917fb67ff58b33060fd371a35ae2d9f1c3cdaec9b8197969f6efe2594a1ff4ba68c691a4505090565b6000602082840312156101ca57600080fd5b5035919050565b60008282101561020a
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea164736f6c634300080f000a"
,
ABI
:
"[{
\"
inputs
\"
:[],
\"
name
\"
:
\"
BlockHashNotPresent
\"
,
\"
type
\"
:
\"
error
\"
},{
\"
anonymous
\"
:false,
\"
inputs
\"
:[{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
Hash
\"
,
\"
name
\"
:
\"
blockHash
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
indexed
\"
:true,
\"
internalType
\"
:
\"
Timestamp
\"
,
\"
name
\"
:
\"
childTimestamp
\"
,
\"
type
\"
:
\"
uint64
\"
}],
\"
name
\"
:
\"
Checkpoint
\"
,
\"
type
\"
:
\"
event
\"
},{
\"
inputs
\"
:[],
\"
name
\"
:
\"
checkpoint
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
blockNumber_
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
stateMutability
\"
:
\"
nonpayable
\"
,
\"
type
\"
:
\"
function
\"
},{
\"
inputs
\"
:[{
\"
internalType
\"
:
\"
uint256
\"
,
\"
name
\"
:
\"
_blockNumber
\"
,
\"
type
\"
:
\"
uint256
\"
}],
\"
name
\"
:
\"
load
\"
,
\"
outputs
\"
:[{
\"
components
\"
:[{
\"
internalType
\"
:
\"
Hash
\"
,
\"
name
\"
:
\"
hash
\"
,
\"
type
\"
:
\"
bytes32
\"
},{
\"
internalType
\"
:
\"
Timestamp
\"
,
\"
name
\"
:
\"
childTimestamp
\"
,
\"
type
\"
:
\"
uint64
\"
}],
\"
internalType
\"
:
\"
structBlockOracle.BlockInfo
\"
,
\"
name
\"
:
\"
blockInfo_
\"
,
\"
type
\"
:
\"
tuple
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}
,{
\"
inputs
\"
:[],
\"
name
\"
:
\"
version
\"
,
\"
outputs
\"
:[{
\"
internalType
\"
:
\"
string
\"
,
\"
name
\"
:
\"\"
,
\"
type
\"
:
\"
string
\"
}],
\"
stateMutability
\"
:
\"
view
\"
,
\"
type
\"
:
\"
function
\"
}
]"
,
Bin
:
"0x608060405234801561001057600080fd5b506102
e7806100206000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c806354fd4d501461004657806399d548aa14610098578063c2c4c5c1146100d0575b600080fd5b6100826040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b60405161008f9190610210565b60405180910390f35b6100ab6100a6366004610283565b6100e6565b604080518251815260209283015167ffffffffffffffff16928101929092520161008f565b6100d8610165565b60405190815260200161008f565b604080518082018252600080825260209182018190528381528082528281208351808501909452805480855260019091015467ffffffffffffffff169284019290925203610160576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600061017260014361029c565b60408051808201825282408082524267ffffffffffffffff81811660208086018281526000898152918290528782209651875551600190960180547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016969093169590951790915593519495509093909291849186917fb67ff58b33060fd371a35ae2d9f1c3cdaec9b8197969f6efe2594a1ff4ba68c691a4505090565b600060208083528351808285015260005b8181101561023d57858101830151858201604001528201610221565b8181111561024f576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561029557600080fd5b5035919050565b6000828210156102d5
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea164736f6c634300080f000a"
,
}
// BlockOracleABI is the input ABI used to generate the binding from.
...
...
@@ -238,6 +238,37 @@ func (_BlockOracle *BlockOracleCallerSession) Load(_blockNumber *big.Int) (Block
return
_BlockOracle
.
Contract
.
Load
(
&
_BlockOracle
.
CallOpts
,
_blockNumber
)
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() view returns(string)
func
(
_BlockOracle
*
BlockOracleCaller
)
Version
(
opts
*
bind
.
CallOpts
)
(
string
,
error
)
{
var
out
[]
interface
{}
err
:=
_BlockOracle
.
contract
.
Call
(
opts
,
&
out
,
"version"
)
if
err
!=
nil
{
return
*
new
(
string
),
err
}
out0
:=
*
abi
.
ConvertType
(
out
[
0
],
new
(
string
))
.
(
*
string
)
return
out0
,
err
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() view returns(string)
func
(
_BlockOracle
*
BlockOracleSession
)
Version
()
(
string
,
error
)
{
return
_BlockOracle
.
Contract
.
Version
(
&
_BlockOracle
.
CallOpts
)
}
// Version is a free data retrieval call binding the contract method 0x54fd4d50.
//
// Solidity: function version() view returns(string)
func
(
_BlockOracle
*
BlockOracleCallerSession
)
Version
()
(
string
,
error
)
{
return
_BlockOracle
.
Contract
.
Version
(
&
_BlockOracle
.
CallOpts
)
}
// Checkpoint is a paid mutator transaction binding the contract method 0xc2c4c5c1.
//
// Solidity: function checkpoint() returns(uint256 blockNumber_)
...
...
op-bindings/bindings/blockoracle_more.go
View file @
3fb9b845
...
...
@@ -13,7 +13,7 @@ const BlockOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\"
var
BlockOracleStorageLayout
=
new
(
solc
.
StorageLayout
)
var
BlockOracleDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
365760003560e01c806399d548aa1461003b578063c2c4c5c114610078575b600080fd5b61004e6100493660046101b8565b61008e565b604080518251815260209283015167ffffffffffffffff1692810192909252015b60405180910390f35b61008061010d565b60405190815260200161006f565b604080518082018252600080825260209182018190528381528082528281208351808501909452805480855260019091015467ffffffffffffffff169284019290925203610108576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600061011a6001436101d1565b60408051808201825282408082524267ffffffffffffffff81811660208086018281526000898152918290528782209651875551600190960180547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016969093169590951790915593519495509093909291849186917fb67ff58b33060fd371a35ae2d9f1c3cdaec9b8197969f6efe2594a1ff4ba68c691a4505090565b6000602082840312156101ca57600080fd5b5035919050565b60008282101561020a
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea164736f6c634300080f000a"
var
BlockOracleDeployedBin
=
"0x608060405234801561001057600080fd5b50600436106100
415760003560e01c806354fd4d501461004657806399d548aa14610098578063c2c4c5c1146100d0575b600080fd5b6100826040518060400160405280600581526020017f302e302e3100000000000000000000000000000000000000000000000000000081525081565b60405161008f9190610210565b60405180910390f35b6100ab6100a6366004610283565b6100e6565b604080518251815260209283015167ffffffffffffffff16928101929092520161008f565b6100d8610165565b60405190815260200161008f565b604080518082018252600080825260209182018190528381528082528281208351808501909452805480855260019091015467ffffffffffffffff169284019290925203610160576040517f37cf270500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b919050565b600061017260014361029c565b60408051808201825282408082524267ffffffffffffffff81811660208086018281526000898152918290528782209651875551600190960180547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016969093169590951790915593519495509093909291849186917fb67ff58b33060fd371a35ae2d9f1c3cdaec9b8197969f6efe2594a1ff4ba68c691a4505090565b600060208083528351808285015260005b8181101561023d57858101830151858201604001528201610221565b8181111561024f576000604083870101525b50601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016929092016040019392505050565b60006020828403121561029557600080fd5b5035919050565b6000828210156102d5
577f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b50039056fea164736f6c634300080f000a"
func
init
()
{
if
err
:=
json
.
Unmarshal
([]
byte
(
BlockOracleStorageLayoutJSON
),
BlockOracleStorageLayout
);
err
!=
nil
{
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
3fb9b845
...
...
@@ -16,8 +16,8 @@ AssetReceiverTest:test_withdrawETHwithAmount_unauthorized_reverts() (gas: 10738)
AttestationStationTest:test_attest_bulk_succeeds() (gas: 703749)
AttestationStationTest:test_attest_individual_succeeds() (gas: 632087)
AttestationStationTest:test_attest_single_succeeds() (gas: 651325)
BlockOracle_Test:test_checkpointAndLoad_succeeds() (gas: 583
41
)
BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 128
05
)
BlockOracle_Test:test_checkpointAndLoad_succeeds() (gas: 583
96
)
BlockOracle_Test:test_load_noBlockHash_reverts() (gas: 128
27
)
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)
...
...
@@ -108,7 +108,7 @@ FaultDisputeGame_Test:test_gameData_succeeds() (gas: 32755)
FaultDisputeGame_Test:test_gameType_succeeds() (gas: 8265)
FaultDisputeGame_Test:test_initialize_correctData_succeeds() (gas: 57712)
FaultDisputeGame_Test:test_initialize_firstOutput_reverts() (gas: 210563)
FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228
368
)
FaultDisputeGame_Test:test_initialize_l1HeadTooOld_reverts() (gas: 228
401
)
FaultDisputeGame_Test:test_move_clockCorrectness_succeeds() (gas: 594268)
FaultDisputeGame_Test:test_move_clockTimeExceeded_reverts() (gas: 23175)
FaultDisputeGame_Test:test_move_defendRoot_reverts() (gas: 13366)
...
...
packages/contracts-bedrock/semver-lock.json
View file @
3fb9b845
...
...
@@ -18,6 +18,7 @@
"src/L2/L2StandardBridge.sol"
:
"0xfe01bcb1ddc947b9b8a7093d0971854b9fa8d49da5bd933a3dd106167907f882"
,
"src/L2/L2ToL1MessagePasser.sol"
:
"0xafc710b4d320ef450586d96a61cbd58cac814cb3b0c4fdc280eace3efdcdf321"
,
"src/L2/SequencerFeeVault.sol"
:
"0xc2f733c1128d06ad60bf1e1d98c8f684a4825b11875ccdf2376ede33f5aad4e6"
,
"src/dispute/BlockOracle.sol"
:
"0x7e724b1ee0116dfd744f556e6237af449c2f40c6426d6f1462ae2a47589283bb"
,
"src/dispute/DisputeGameFactory.sol"
:
"0xfdfa141408d7f8de7e230ff4bef088e30d0e4d569ca743d60d292abdd21ff270"
,
"src/dispute/FaultDisputeGame.sol"
:
"0xfdf4be4d6ed4bcbf6492c43fdbfd04d0c62ebee11b8fe9ee2e7757bde8f7383d"
,
"src/legacy/DeployerWhitelist.sol"
:
"0x0a6840074734c9d167321d3299be18ef911a415e4c471fa92af7d6cfaa8336d4"
,
...
...
packages/contracts-bedrock/src/dispute/BlockOracle.sol
View file @
3fb9b845
...
...
@@ -3,10 +3,11 @@ pragma solidity 0.8.15;
import "src/libraries/DisputeTypes.sol";
import "src/libraries/DisputeErrors.sol";
import { ISemver } from "src/universal/ISemver.sol";
/// @title BlockOracle
/// @notice Stores a map of block numbers => block hashes for use in dispute resolution
contract BlockOracle {
contract BlockOracle
is ISemver
{
/// @notice The BlockInfo struct contains a block's hash and child timestamp.
struct BlockInfo {
Hash hash;
...
...
@@ -19,6 +20,10 @@ contract BlockOracle {
/// @notice Maps block numbers to block hashes and timestamps
mapping(uint256 => BlockInfo) internal blocks;
/// @notice Semantic version.
/// @custom:semver 0.0.1
string public constant version = "0.0.1";
/// @notice Loads a block hash for a given block number, assuming that the block number
/// has been stored in the oracle.
/// @param _blockNumber The block number to load the block hash and timestamp for.
...
...
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