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
fdcb651b
Unverified
Commit
fdcb651b
authored
Apr 13, 2023
by
OptimismBot
Committed by
GitHub
Apr 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5431 from ethereum-optimism/aj/fpp-pointers
op-program: Use pointers for receiver types
parents
7312bbf3
d64f5993
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
17 deletions
+17
-17
client.go
op-program/client/l1/client.go
+6
-6
engine.go
op-program/client/l2/engine.go
+8
-8
fetcher.go
op-program/host/l1/fetcher.go
+3
-3
No files found.
op-program/client/l1/client.go
View file @
fdcb651b
...
...
@@ -31,7 +31,7 @@ func NewOracleL1Client(logger log.Logger, oracle Oracle, l1Head common.Hash) *Or
}
}
func
(
o
OracleL1Client
)
L1BlockRefByLabel
(
ctx
context
.
Context
,
label
eth
.
BlockLabel
)
(
eth
.
L1BlockRef
,
error
)
{
func
(
o
*
OracleL1Client
)
L1BlockRefByLabel
(
ctx
context
.
Context
,
label
eth
.
BlockLabel
)
(
eth
.
L1BlockRef
,
error
)
{
if
label
!=
eth
.
Unsafe
&&
label
!=
eth
.
Safe
&&
label
!=
eth
.
Finalized
{
return
eth
.
L1BlockRef
{},
fmt
.
Errorf
(
"%w: %s"
,
ErrUnknownLabel
,
label
)
}
...
...
@@ -39,7 +39,7 @@ func (o OracleL1Client) L1BlockRefByLabel(ctx context.Context, label eth.BlockLa
return
o
.
head
,
nil
}
func
(
o
OracleL1Client
)
L1BlockRefByNumber
(
ctx
context
.
Context
,
number
uint64
)
(
eth
.
L1BlockRef
,
error
)
{
func
(
o
*
OracleL1Client
)
L1BlockRefByNumber
(
ctx
context
.
Context
,
number
uint64
)
(
eth
.
L1BlockRef
,
error
)
{
if
number
>
o
.
head
.
Number
{
return
eth
.
L1BlockRef
{},
fmt
.
Errorf
(
"%w: block number %d"
,
ErrNotFound
,
number
)
}
...
...
@@ -50,20 +50,20 @@ func (o OracleL1Client) L1BlockRefByNumber(ctx context.Context, number uint64) (
return
block
,
nil
}
func
(
o
OracleL1Client
)
L1BlockRefByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
L1BlockRef
,
error
)
{
func
(
o
*
OracleL1Client
)
L1BlockRefByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
L1BlockRef
,
error
)
{
return
eth
.
InfoToL1BlockRef
(
o
.
oracle
.
HeaderByBlockHash
(
hash
)),
nil
}
func
(
o
OracleL1Client
)
InfoByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
BlockInfo
,
error
)
{
func
(
o
*
OracleL1Client
)
InfoByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
BlockInfo
,
error
)
{
return
o
.
oracle
.
HeaderByBlockHash
(
hash
),
nil
}
func
(
o
OracleL1Client
)
FetchReceipts
(
ctx
context
.
Context
,
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Receipts
,
error
)
{
func
(
o
*
OracleL1Client
)
FetchReceipts
(
ctx
context
.
Context
,
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Receipts
,
error
)
{
info
,
rcpts
:=
o
.
oracle
.
ReceiptsByBlockHash
(
blockHash
)
return
info
,
rcpts
,
nil
}
func
(
o
OracleL1Client
)
InfoAndTxsByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Transactions
,
error
)
{
func
(
o
*
OracleL1Client
)
InfoAndTxsByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Transactions
,
error
)
{
info
,
txs
:=
o
.
oracle
.
TransactionsByBlockHash
(
hash
)
return
info
,
txs
,
nil
}
op-program/client/l2/engine.go
View file @
fdcb651b
...
...
@@ -33,19 +33,19 @@ func NewOracleEngine(rollupCfg *rollup.Config, logger log.Logger, backend engine
}
}
func
(
o
OracleEngine
)
GetPayload
(
ctx
context
.
Context
,
payloadId
eth
.
PayloadID
)
(
*
eth
.
ExecutionPayload
,
error
)
{
func
(
o
*
OracleEngine
)
GetPayload
(
ctx
context
.
Context
,
payloadId
eth
.
PayloadID
)
(
*
eth
.
ExecutionPayload
,
error
)
{
return
o
.
api
.
GetPayloadV1
(
ctx
,
payloadId
)
}
func
(
o
OracleEngine
)
ForkchoiceUpdate
(
ctx
context
.
Context
,
state
*
eth
.
ForkchoiceState
,
attr
*
eth
.
PayloadAttributes
)
(
*
eth
.
ForkchoiceUpdatedResult
,
error
)
{
func
(
o
*
OracleEngine
)
ForkchoiceUpdate
(
ctx
context
.
Context
,
state
*
eth
.
ForkchoiceState
,
attr
*
eth
.
PayloadAttributes
)
(
*
eth
.
ForkchoiceUpdatedResult
,
error
)
{
return
o
.
api
.
ForkchoiceUpdatedV1
(
ctx
,
state
,
attr
)
}
func
(
o
OracleEngine
)
NewPayload
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayload
)
(
*
eth
.
PayloadStatusV1
,
error
)
{
func
(
o
*
OracleEngine
)
NewPayload
(
ctx
context
.
Context
,
payload
*
eth
.
ExecutionPayload
)
(
*
eth
.
PayloadStatusV1
,
error
)
{
return
o
.
api
.
NewPayloadV1
(
ctx
,
payload
)
}
func
(
o
OracleEngine
)
PayloadByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
*
eth
.
ExecutionPayload
,
error
)
{
func
(
o
*
OracleEngine
)
PayloadByHash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
*
eth
.
ExecutionPayload
,
error
)
{
block
:=
o
.
backend
.
GetBlockByHash
(
hash
)
if
block
==
nil
{
return
nil
,
ErrNotFound
...
...
@@ -53,7 +53,7 @@ func (o OracleEngine) PayloadByHash(ctx context.Context, hash common.Hash) (*eth
return
eth
.
BlockAsPayload
(
block
)
}
func
(
o
OracleEngine
)
PayloadByNumber
(
ctx
context
.
Context
,
n
uint64
)
(
*
eth
.
ExecutionPayload
,
error
)
{
func
(
o
*
OracleEngine
)
PayloadByNumber
(
ctx
context
.
Context
,
n
uint64
)
(
*
eth
.
ExecutionPayload
,
error
)
{
hash
:=
o
.
backend
.
GetCanonicalHash
(
n
)
if
hash
==
(
common
.
Hash
{})
{
return
nil
,
ErrNotFound
...
...
@@ -61,7 +61,7 @@ func (o OracleEngine) PayloadByNumber(ctx context.Context, n uint64) (*eth.Execu
return
o
.
PayloadByHash
(
ctx
,
hash
)
}
func
(
o
OracleEngine
)
L2BlockRefByLabel
(
ctx
context
.
Context
,
label
eth
.
BlockLabel
)
(
eth
.
L2BlockRef
,
error
)
{
func
(
o
*
OracleEngine
)
L2BlockRefByLabel
(
ctx
context
.
Context
,
label
eth
.
BlockLabel
)
(
eth
.
L2BlockRef
,
error
)
{
var
header
*
types
.
Header
switch
label
{
case
eth
.
Unsafe
:
...
...
@@ -83,7 +83,7 @@ func (o OracleEngine) L2BlockRefByLabel(ctx context.Context, label eth.BlockLabe
return
derive
.
L2BlockToBlockRef
(
block
,
&
o
.
rollupCfg
.
Genesis
)
}
func
(
o
OracleEngine
)
L2BlockRefByHash
(
ctx
context
.
Context
,
l2Hash
common
.
Hash
)
(
eth
.
L2BlockRef
,
error
)
{
func
(
o
*
OracleEngine
)
L2BlockRefByHash
(
ctx
context
.
Context
,
l2Hash
common
.
Hash
)
(
eth
.
L2BlockRef
,
error
)
{
block
:=
o
.
backend
.
GetBlockByHash
(
l2Hash
)
if
block
==
nil
{
return
eth
.
L2BlockRef
{},
ErrNotFound
...
...
@@ -91,7 +91,7 @@ func (o OracleEngine) L2BlockRefByHash(ctx context.Context, l2Hash common.Hash)
return
derive
.
L2BlockToBlockRef
(
block
,
&
o
.
rollupCfg
.
Genesis
)
}
func
(
o
OracleEngine
)
SystemConfigByL2Hash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
SystemConfig
,
error
)
{
func
(
o
*
OracleEngine
)
SystemConfigByL2Hash
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
eth
.
SystemConfig
,
error
)
{
payload
,
err
:=
o
.
PayloadByHash
(
ctx
,
hash
)
if
err
!=
nil
{
return
eth
.
SystemConfig
{},
err
...
...
op-program/host/l1/fetcher.go
View file @
fdcb651b
...
...
@@ -30,7 +30,7 @@ func NewFetchingL1Oracle(ctx context.Context, logger log.Logger, source Source)
}
}
func
(
o
FetchingL1Oracle
)
HeaderByBlockHash
(
blockHash
common
.
Hash
)
eth
.
BlockInfo
{
func
(
o
*
FetchingL1Oracle
)
HeaderByBlockHash
(
blockHash
common
.
Hash
)
eth
.
BlockInfo
{
o
.
logger
.
Trace
(
"HeaderByBlockHash"
,
"hash"
,
blockHash
)
info
,
err
:=
o
.
source
.
InfoByHash
(
o
.
ctx
,
blockHash
)
if
err
!=
nil
{
...
...
@@ -42,7 +42,7 @@ func (o FetchingL1Oracle) HeaderByBlockHash(blockHash common.Hash) eth.BlockInfo
return
info
}
func
(
o
FetchingL1Oracle
)
TransactionsByBlockHash
(
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Transactions
)
{
func
(
o
*
FetchingL1Oracle
)
TransactionsByBlockHash
(
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Transactions
)
{
o
.
logger
.
Trace
(
"TransactionsByBlockHash"
,
"hash"
,
blockHash
)
info
,
txs
,
err
:=
o
.
source
.
InfoAndTxsByHash
(
o
.
ctx
,
blockHash
)
if
err
!=
nil
{
...
...
@@ -54,7 +54,7 @@ func (o FetchingL1Oracle) TransactionsByBlockHash(blockHash common.Hash) (eth.Bl
return
info
,
txs
}
func
(
o
FetchingL1Oracle
)
ReceiptsByBlockHash
(
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Receipts
)
{
func
(
o
*
FetchingL1Oracle
)
ReceiptsByBlockHash
(
blockHash
common
.
Hash
)
(
eth
.
BlockInfo
,
types
.
Receipts
)
{
o
.
logger
.
Trace
(
"ReceiptsByBlockHash"
,
"hash"
,
blockHash
)
info
,
rcpts
,
err
:=
o
.
source
.
FetchReceipts
(
o
.
ctx
,
blockHash
)
if
err
!=
nil
{
...
...
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