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
68852920
Unverified
Commit
68852920
authored
Dec 27, 2023
by
Roberto Bayardo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
handle the new Ecotone system config update event log type
parent
2aa13672
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
65 additions
and
0 deletions
+65
-0
system_config.go
op-node/rollup/derive/system_config.go
+34
-0
system_config_test.go
op-node/rollup/derive/system_config_test.go
+27
-0
types.go
op-service/eth/types.go
+4
-0
No files found.
op-node/rollup/derive/system_config.go
View file @
68852920
...
...
@@ -2,8 +2,10 @@ package derive
import
(
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"github.com/hashicorp/go-multierror"
...
...
@@ -21,12 +23,15 @@ var (
SystemConfigUpdateGasConfig
=
common
.
Hash
{
31
:
1
}
SystemConfigUpdateGasLimit
=
common
.
Hash
{
31
:
2
}
SystemConfigUpdateUnsafeBlockSigner
=
common
.
Hash
{
31
:
3
}
SystemConfigUpdateGasConfigEcotone
=
common
.
Hash
{
31
:
4
}
)
var
(
ConfigUpdateEventABI
=
"ConfigUpdate(uint256,uint8,bytes)"
ConfigUpdateEventABIHash
=
crypto
.
Keccak256Hash
([]
byte
(
ConfigUpdateEventABI
))
ConfigUpdateEventVersion0
=
common
.
Hash
{}
empty24
=
make
([]
byte
,
24
)
)
// UpdateSystemConfigWithL1Receipts filters all L1 receipts to find config updates and applies the config updates to the given sysCfg
...
...
@@ -133,6 +138,35 @@ func ProcessSystemConfigUpdateLogEvent(destSysCfg *eth.SystemConfig, ev *types.L
case
SystemConfigUpdateUnsafeBlockSigner
:
// Ignored in derivation. This configurable applies to runtime configuration outside of the derivation.
return
nil
case
SystemConfigUpdateGasConfigEcotone
:
// TODO(optimism#8801): pull this deserialazation logic out into a public handler for solidity
// diff/fuzz testing
if
pointer
,
err
:=
solabi
.
ReadUint64
(
reader
);
err
!=
nil
||
pointer
!=
32
{
return
NewCriticalError
(
errors
.
New
(
"invalid pointer field"
))
}
if
length
,
err
:=
solabi
.
ReadUint64
(
reader
);
err
!=
nil
||
length
!=
8
{
return
NewCriticalError
(
errors
.
New
(
"invalid length field"
))
}
packed
:=
make
([]
byte
,
8
)
_
,
err
:=
io
.
ReadFull
(
reader
,
packed
)
if
err
!=
nil
{
return
NewCriticalError
(
errors
.
New
(
"invalid packed scalars field"
))
}
// confirm there is 32-8=24 bytes of 0-padding left
zeros
:=
make
([]
byte
,
24
)
_
,
err
=
io
.
ReadFull
(
reader
,
zeros
)
if
err
!=
nil
{
return
NewCriticalError
(
errors
.
New
(
"didn't find expected padding"
))
}
if
!
bytes
.
Equal
(
zeros
,
empty24
)
{
return
NewCriticalError
(
fmt
.
Errorf
(
"expected padding to be all zeros, got %x"
,
zeros
))
}
if
!
solabi
.
EmptyReader
(
reader
)
{
return
NewCriticalError
(
errors
.
New
(
"too many bytes"
))
}
destSysCfg
.
BasefeeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
0
:
4
])
destSysCfg
.
BlobBasefeeScalar
=
binary
.
BigEndian
.
Uint32
(
packed
[
4
:
8
])
return
nil
default
:
return
fmt
.
Errorf
(
"unrecognized L1 sysCfg update type: %s"
,
updateType
)
}
...
...
op-node/rollup/derive/system_config_test.go
View file @
68852920
...
...
@@ -138,6 +138,33 @@ func TestProcessSystemConfigUpdateLogEvent(t *testing.T) {
},
err
:
false
,
},
{
// The ecotone scalars should be updated
name
:
"SystemConfigUpdateGasConfigEcotone"
,
log
:
&
types
.
Log
{
Topics
:
[]
common
.
Hash
{
ConfigUpdateEventABIHash
,
ConfigUpdateEventVersion0
,
SystemConfigUpdateGasConfigEcotone
,
},
},
hook
:
func
(
t
*
testing
.
T
,
log
*
types
.
Log
)
*
types
.
Log
{
basefeeScalar
:=
big
.
NewInt
(
0xaa
)
blobBasefeeScalar
:=
big
.
NewInt
(
0xbb
)
packed
:=
make
([]
byte
,
8
)
basefeeScalar
.
FillBytes
(
packed
[
0
:
4
])
blobBasefeeScalar
.
FillBytes
(
packed
[
4
:
8
])
data
,
err
:=
bytesArgs
.
Pack
(
packed
)
require
.
NoError
(
t
,
err
)
log
.
Data
=
data
return
log
},
config
:
eth
.
SystemConfig
{
BasefeeScalar
:
0xaa
,
BlobBasefeeScalar
:
0xbb
,
},
err
:
false
,
},
{
name
:
"SystemConfigOneTopic"
,
log
:
&
types
.
Log
{
...
...
op-service/eth/types.go
View file @
68852920
...
...
@@ -316,6 +316,10 @@ type SystemConfig struct {
Scalar
Bytes32
`json:"scalar"`
// GasLimit identifies the L2 block gas limit
GasLimit
uint64
`json:"gasLimit"`
// BasefeeScalar scales the L1 calldata fee after the Ecotone upgrade
BasefeeScalar
uint32
`json:"basefeeScalar"`
// BlobBasefeeScalar scales the L1 blob fee after the Ecotone upgrade
BlobBasefeeScalar
uint32
`json:"blobBasefeeScalar"`
// More fields can be added for future SystemConfig versions.
}
...
...
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