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
9b126419
Unverified
Commit
9b126419
authored
Jun 13, 2023
by
mergify[bot]
Committed by
GitHub
Jun 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into refcell/array/factory
parents
9be82ac9
dee1d2fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
registry.go
op-bindings/bindings/registry.go
+30
-0
types.go
op-node/rollup/types.go
+4
-4
No files found.
op-bindings/bindings/registry.go
View file @
9b126419
...
@@ -2,15 +2,20 @@ package bindings
...
@@ -2,15 +2,20 @@ package bindings
import
(
import
(
"fmt"
"fmt"
"strings"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/ethereum-optimism/optimism/op-bindings/solc"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
)
)
// layouts respresents the set of storage layouts. It is populated in an init function.
var
layouts
=
make
(
map
[
string
]
*
solc
.
StorageLayout
)
var
layouts
=
make
(
map
[
string
]
*
solc
.
StorageLayout
)
// deployedBytecodes represents the set of deployed bytecodes. It is populated
// in an init function.
var
deployedBytecodes
=
make
(
map
[
string
]
string
)
var
deployedBytecodes
=
make
(
map
[
string
]
string
)
// GetStorageLayout returns the storage layout of a contract by name.
func
GetStorageLayout
(
name
string
)
(
*
solc
.
StorageLayout
,
error
)
{
func
GetStorageLayout
(
name
string
)
(
*
solc
.
StorageLayout
,
error
)
{
layout
:=
layouts
[
name
]
layout
:=
layouts
[
name
]
if
layout
==
nil
{
if
layout
==
nil
{
...
@@ -19,11 +24,36 @@ func GetStorageLayout(name string) (*solc.StorageLayout, error) {
...
@@ -19,11 +24,36 @@ func GetStorageLayout(name string) (*solc.StorageLayout, error) {
return
layout
,
nil
return
layout
,
nil
}
}
// GetDeployedBytecode returns the deployed bytecode of a contract by name.
func
GetDeployedBytecode
(
name
string
)
([]
byte
,
error
)
{
func
GetDeployedBytecode
(
name
string
)
([]
byte
,
error
)
{
bc
:=
deployedBytecodes
[
name
]
bc
:=
deployedBytecodes
[
name
]
if
bc
==
""
{
if
bc
==
""
{
return
nil
,
fmt
.
Errorf
(
"%s: deployed bytecode not found"
,
name
)
return
nil
,
fmt
.
Errorf
(
"%s: deployed bytecode not found"
,
name
)
}
}
if
!
isHex
(
bc
)
{
return
nil
,
fmt
.
Errorf
(
"%s: invalid deployed bytecode"
,
name
)
}
return
common
.
FromHex
(
bc
),
nil
return
common
.
FromHex
(
bc
),
nil
}
}
// isHexCharacter returns bool of c being a valid hexadecimal.
func
isHexCharacter
(
c
byte
)
bool
{
return
(
'0'
<=
c
&&
c
<=
'9'
)
||
(
'a'
<=
c
&&
c
<=
'f'
)
||
(
'A'
<=
c
&&
c
<=
'F'
)
}
// isHex validates whether each byte is valid hexadecimal string.
func
isHex
(
str
string
)
bool
{
if
len
(
str
)
%
2
!=
0
{
return
false
}
str
=
strings
.
TrimPrefix
(
str
,
"0x"
)
for
_
,
c
:=
range
[]
byte
(
str
)
{
if
!
isHexCharacter
(
c
)
{
return
false
}
}
return
true
}
op-node/rollup/types.go
View file @
9b126419
...
@@ -142,7 +142,7 @@ func (cfg *Config) CheckL1ChainID(ctx context.Context, client L1Client) error {
...
@@ -142,7 +142,7 @@ func (cfg *Config) CheckL1ChainID(ctx context.Context, client L1Client) error {
return
err
return
err
}
}
if
cfg
.
L1ChainID
.
Cmp
(
id
)
!=
0
{
if
cfg
.
L1ChainID
.
Cmp
(
id
)
!=
0
{
return
fmt
.
Errorf
(
"incorrect L1 RPC chain id %d, expected %d"
,
cfg
.
L1ChainID
,
id
)
return
fmt
.
Errorf
(
"incorrect L1 RPC chain id %d, expected %d"
,
id
,
cfg
.
L1ChainID
)
}
}
return
nil
return
nil
}
}
...
@@ -154,7 +154,7 @@ func (cfg *Config) CheckL1GenesisBlockHash(ctx context.Context, client L1Client)
...
@@ -154,7 +154,7 @@ func (cfg *Config) CheckL1GenesisBlockHash(ctx context.Context, client L1Client)
return
err
return
err
}
}
if
l1GenesisBlockRef
.
Hash
!=
cfg
.
Genesis
.
L1
.
Hash
{
if
l1GenesisBlockRef
.
Hash
!=
cfg
.
Genesis
.
L1
.
Hash
{
return
fmt
.
Errorf
(
"incorrect L1 genesis block hash %
d, expected %d"
,
cfg
.
Genesis
.
L1
.
Hash
,
l1GenesisBlockRef
.
Hash
)
return
fmt
.
Errorf
(
"incorrect L1 genesis block hash %
s, expected %s"
,
l1GenesisBlockRef
.
Hash
,
cfg
.
Genesis
.
L1
.
Hash
)
}
}
return
nil
return
nil
}
}
...
@@ -171,7 +171,7 @@ func (cfg *Config) CheckL2ChainID(ctx context.Context, client L2Client) error {
...
@@ -171,7 +171,7 @@ func (cfg *Config) CheckL2ChainID(ctx context.Context, client L2Client) error {
return
err
return
err
}
}
if
cfg
.
L2ChainID
.
Cmp
(
id
)
!=
0
{
if
cfg
.
L2ChainID
.
Cmp
(
id
)
!=
0
{
return
fmt
.
Errorf
(
"incorrect L2 RPC chain id
, expected from config %d, obtained from client %d"
,
cfg
.
L2ChainID
,
id
)
return
fmt
.
Errorf
(
"incorrect L2 RPC chain id
%d, expected %d"
,
id
,
cfg
.
L2ChainID
)
}
}
return
nil
return
nil
}
}
...
@@ -183,7 +183,7 @@ func (cfg *Config) CheckL2GenesisBlockHash(ctx context.Context, client L2Client)
...
@@ -183,7 +183,7 @@ func (cfg *Config) CheckL2GenesisBlockHash(ctx context.Context, client L2Client)
return
err
return
err
}
}
if
l2GenesisBlockRef
.
Hash
!=
cfg
.
Genesis
.
L2
.
Hash
{
if
l2GenesisBlockRef
.
Hash
!=
cfg
.
Genesis
.
L2
.
Hash
{
return
fmt
.
Errorf
(
"incorrect L2 genesis block hash %
d, expected %d"
,
cfg
.
Genesis
.
L2
.
Hash
,
l2GenesisBlockRef
.
Hash
)
return
fmt
.
Errorf
(
"incorrect L2 genesis block hash %
s, expected %s"
,
l2GenesisBlockRef
.
Hash
,
cfg
.
Genesis
.
L2
.
Hash
)
}
}
return
nil
return
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