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
f03df0a5
Unverified
Commit
f03df0a5
authored
Jan 10, 2023
by
mergify[bot]
Committed by
GitHub
Jan 10, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4643 from ethereum-optimism/fix/output-root-compute
op-node: ComputeL2OutputRoot cleanup
parents
585a94a8
d050d866
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
output_root.go
op-node/rollup/output_root.go
+19
-8
No files found.
op-node/rollup/output_root.go
View file @
f03df0a5
package
rollup
import
(
"bytes"
"github.com/ethereum-optimism/optimism/op-bindings/bindings"
"github.com/ethereum-optimism/optimism/op-node/eth"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
// ComputeL2OutputRoot computes the L2 output root
func
ComputeL2OutputRoot
(
l2OutputRootVersion
eth
.
Bytes32
,
blockHash
common
.
Hash
,
blockRoot
common
.
Hash
,
storageRoot
common
.
Hash
)
eth
.
Bytes32
{
var
buf
bytes
.
Buffer
buf
.
Write
(
l2OutputRootVersion
[
:
])
buf
.
Write
(
blockRoot
.
Bytes
())
buf
.
Write
(
storageRoot
[
:
])
buf
.
Write
(
blockHash
.
Bytes
())
return
eth
.
Bytes32
(
crypto
.
Keccak256Hash
(
buf
.
Bytes
()))
digest
:=
crypto
.
Keccak256Hash
(
l2OutputRootVersion
[
:
],
blockRoot
.
Bytes
(),
storageRoot
[
:
],
blockHash
.
Bytes
(),
)
return
eth
.
Bytes32
(
digest
)
}
// HashOutputRootProof computes the hash of the output root proof
func
HashOutputRootProof
(
proof
*
bindings
.
TypesOutputRootProof
)
eth
.
Bytes32
{
return
ComputeL2OutputRoot
(
proof
.
Version
,
proof
.
StateRoot
,
proof
.
MessagePasserStorageRoot
,
proof
.
LatestBlockhash
,
)
}
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