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
43ab823d
Commit
43ab823d
authored
Jul 28, 2022
by
Mark Tyneway
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
contracts-bedrock: PR review comments
parent
9edfdd58
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
genesis-l2.ts
packages/contracts-bedrock/tasks/genesis-l2.ts
+11
-1
No files found.
packages/contracts-bedrock/tasks/genesis-l2.ts
View file @
43ab823d
...
@@ -113,7 +113,7 @@ const replaceImmutables = async (
...
@@ -113,7 +113,7 @@ const replaceImmutables = async (
outputContract
.
evm
.
deployedBytecode
.
immutableReferences
outputContract
.
evm
.
deployedBytecode
.
immutableReferences
const
names
=
{}
const
names
=
{}
// Recursively fin
e
all of the immutables by traversing the solc output ast
// Recursively fin
d
all of the immutables by traversing the solc output ast
const
findNames
=
(
ast
:
any
)
=>
{
const
findNames
=
(
ast
:
any
)
=>
{
// Add the name of the variable if it is an immutable
// Add the name of the variable if it is an immutable
const
isImmutable
=
ast
.
mutability
===
'
immutable
'
const
isImmutable
=
ast
.
mutability
===
'
immutable
'
...
@@ -159,6 +159,12 @@ const replaceImmutables = async (
...
@@ -159,6 +159,12 @@ const replaceImmutables = async (
// Insert the value at each one
// Insert the value at each one
for
(
const
offset
of
offsets
)
{
for
(
const
offset
of
offsets
)
{
if
(
offset
.
length
!==
32
)
{
throw
new
Error
(
`Immutable slicing must be updated to handle arbitrary size immutables`
)
}
deployedBytecode
=
ethers
.
utils
.
hexConcat
([
deployedBytecode
=
ethers
.
utils
.
hexConcat
([
hexDataSlice
(
deployedBytecode
,
0
,
offset
.
start
),
hexDataSlice
(
deployedBytecode
,
0
,
offset
.
start
),
hexZeroPad
(
value
,
32
),
hexZeroPad
(
value
,
32
),
...
@@ -434,6 +440,10 @@ task('genesis-l2', 'create a genesis config')
...
@@ -434,6 +440,10 @@ task('genesis-l2', 'create a genesis config')
?
await
replaceImmutables
(
hre
,
name
,
immutableConfig
)
?
await
replaceImmutables
(
hre
,
name
,
immutableConfig
)
:
artifact
.
deployedBytecode
:
artifact
.
deployedBytecode
assertEvenLength
(
deployedBytecode
)
// TODO(tynes): initialize contracts that should be initialized
// in the implementations here
alloc
[
allocAddr
]
=
{
alloc
[
allocAddr
]
=
{
nonce
:
'
0x00
'
,
nonce
:
'
0x00
'
,
balance
:
'
0x00
'
,
balance
:
'
0x00
'
,
...
...
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