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
98cd5879
Unverified
Commit
98cd5879
authored
Oct 26, 2022
by
mergify[bot]
Committed by
GitHub
Oct 26, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into jg/channel_bank_pruning
parents
d8e30b15
225e1643
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
131 additions
and
46 deletions
+131
-46
fluffy-ducks-compare.md
.changeset/fluffy-ducks-compare.md
+5
-0
README.md
README.md
+65
-30
flags.go
indexer/flags/flags.go
+0
-7
config.go
op-chain-ops/genesis/config.go
+2
-1
channel_out.go
op-node/rollup/derive/channel_out.go
+1
-1
channel_out_test.go
op-node/rollup/derive/channel_out_test.go
+24
-0
CrossDomainMessenger.t.sol
...ntracts-bedrock/contracts/test/CrossDomainMessenger.t.sol
+2
-2
.gitignore
packages/migration-data/.gitignore
+1
-0
cli.ts
packages/migration-data/bin/cli.ts
+27
-0
derivation.md
specs/derivation.md
+4
-5
No files found.
.changeset/fluffy-ducks-compare.md
0 → 100644
View file @
98cd5879
---
'
@eth-optimism/indexer'
:
patch
---
Delete unused flags
README.md
View file @
98cd5879
This diff is collapsed.
Click to expand it.
indexer/flags/flags.go
View file @
98cd5879
...
@@ -22,12 +22,6 @@ var (
...
@@ -22,12 +22,6 @@ var (
Required
:
true
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"BUILD_ENV"
),
EnvVar
:
prefixEnvVar
(
"BUILD_ENV"
),
}
}
EthNetworkNameFlag
=
cli
.
StringFlag
{
Name
:
"eth-network-name"
,
Usage
:
"Ethereum network name"
,
Required
:
true
,
EnvVar
:
prefixEnvVar
(
"ETH_NETWORK_NAME"
),
}
ChainIDFlag
=
cli
.
StringFlag
{
ChainIDFlag
=
cli
.
StringFlag
{
Name
:
"chain-id"
,
Name
:
"chain-id"
,
Usage
:
"Ethereum chain ID"
,
Usage
:
"Ethereum chain ID"
,
...
@@ -188,7 +182,6 @@ var (
...
@@ -188,7 +182,6 @@ var (
var
requiredFlags
=
[]
cli
.
Flag
{
var
requiredFlags
=
[]
cli
.
Flag
{
BuildEnvFlag
,
BuildEnvFlag
,
EthNetworkNameFlag
,
ChainIDFlag
,
ChainIDFlag
,
L1EthRPCFlag
,
L1EthRPCFlag
,
L2EthRPCFlag
,
L2EthRPCFlag
,
...
...
op-chain-ops/genesis/config.go
View file @
98cd5879
...
@@ -3,6 +3,7 @@ package genesis
...
@@ -3,6 +3,7 @@ package genesis
import
(
import
(
"encoding/json"
"encoding/json"
"errors"
"errors"
"fmt"
"math/big"
"math/big"
"os"
"os"
"path/filepath"
"path/filepath"
...
@@ -84,7 +85,7 @@ type DeployConfig struct {
...
@@ -84,7 +85,7 @@ type DeployConfig struct {
func
NewDeployConfig
(
path
string
)
(
*
DeployConfig
,
error
)
{
func
NewDeployConfig
(
path
string
)
(
*
DeployConfig
,
error
)
{
file
,
err
:=
os
.
ReadFile
(
path
)
file
,
err
:=
os
.
ReadFile
(
path
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
fmt
.
Errorf
(
"deploy config at %s not found: %w"
,
path
,
err
)
}
}
var
config
DeployConfig
var
config
DeployConfig
...
...
op-node/rollup/derive/channel_out.go
View file @
98cd5879
...
@@ -84,7 +84,7 @@ func (co *ChannelOut) AddBlock(block *types.Block) error {
...
@@ -84,7 +84,7 @@ func (co *ChannelOut) AddBlock(block *types.Block) error {
return
err
return
err
}
}
// We encode to a temporary buffer to determine the encoded length to
// We encode to a temporary buffer to determine the encoded length to
// ensure that the total size of all RLP elements is less than MAX_RLP_BYTES_PER_CHANNEL
// ensure that the total size of all RLP elements is less than
or equal to
MAX_RLP_BYTES_PER_CHANNEL
var
buf
bytes
.
Buffer
var
buf
bytes
.
Buffer
if
err
:=
rlp
.
Encode
(
&
buf
,
batch
);
err
!=
nil
{
if
err
:=
rlp
.
Encode
(
&
buf
,
batch
);
err
!=
nil
{
return
err
return
err
...
...
op-node/rollup/derive/channel_out_test.go
View file @
98cd5879
package
derive
package
derive
import
(
import
(
"bytes"
"math/big"
"math/big"
"testing"
"testing"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/rlp"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/require"
)
)
...
@@ -25,3 +27,25 @@ func TestChannelOutAddBlock(t *testing.T) {
...
@@ -25,3 +27,25 @@ func TestChannelOutAddBlock(t *testing.T) {
require
.
Equal
(
t
,
ErrNotDepositTx
,
err
)
require
.
Equal
(
t
,
ErrNotDepositTx
,
err
)
})
})
}
}
// TestRLPByteLimit ensures that stream encoder is properly limiting the length.
// It will decode the input if `len(input) <= inputLimit`.
func
TestRLPByteLimit
(
t
*
testing
.
T
)
{
// Should succeed if `len(input) == inputLimit`
enc
:=
[]
byte
(
"
\x8b
hello world"
)
// RLP encoding of the string "hello world"
in
:=
bytes
.
NewBuffer
(
enc
)
var
out
string
stream
:=
rlp
.
NewStream
(
in
,
12
)
err
:=
stream
.
Decode
(
&
out
)
require
.
Nil
(
t
,
err
)
require
.
Equal
(
t
,
out
,
"hello world"
)
// Should fail if the `inputLimit = len(input) - 1`
enc
=
[]
byte
(
"
\x8b
hello world"
)
// RLP encoding of the string "hello world"
in
=
bytes
.
NewBuffer
(
enc
)
var
out2
string
stream
=
rlp
.
NewStream
(
in
,
11
)
err
=
stream
.
Decode
(
&
out2
)
require
.
Equal
(
t
,
err
,
rlp
.
ErrValueTooLarge
)
require
.
Equal
(
t
,
out2
,
""
)
}
packages/contracts-bedrock/contracts/test/CrossDomainMessenger.t.sol
View file @
98cd5879
...
@@ -8,12 +8,12 @@ import { Messenger_Initializer, Reverter, CallerCaller } from "./CommonTest.t.so
...
@@ -8,12 +8,12 @@ import { Messenger_Initializer, Reverter, CallerCaller } from "./CommonTest.t.so
contract CrossDomainMessenger_Test is Messenger_Initializer {
contract CrossDomainMessenger_Test is Messenger_Initializer {
// Ensure that baseGas passes for the max value of _minGasLimit,
// Ensure that baseGas passes for the max value of _minGasLimit,
// this is about 4 Billion.
// this is about 4 Billion.
function test_baseGas() external {
function test_baseGas() external
view
{
L1Messenger.baseGas(hex"ff", type(uint32).max);
L1Messenger.baseGas(hex"ff", type(uint32).max);
}
}
// Fuzz for other values which might cause a revert in baseGas.
// Fuzz for other values which might cause a revert in baseGas.
function testFuzz_baseGas(uint32 _minGasLimit) external {
function testFuzz_baseGas(uint32 _minGasLimit) external
view
{
L1Messenger.baseGas(hex"ff", _minGasLimit);
L1Messenger.baseGas(hex"ff", _minGasLimit);
}
}
}
}
packages/migration-data/.gitignore
View file @
98cd5879
/data/evm-messages.json
/data/evm-messages.json
/data/slots.json
/data/slots.json
/data/evm-addresses.json
packages/migration-data/bin/cli.ts
View file @
98cd5879
...
@@ -14,6 +14,33 @@ program
...
@@ -14,6 +14,33 @@ program
.
description
(
'
CLI for querying Bedrock migration data
'
)
.
description
(
'
CLI for querying Bedrock migration data
'
)
.
version
(
version
)
.
version
(
version
)
program
.
command
(
'
parse-state-dump
'
)
.
description
(
'
parses state dump to json
'
)
.
option
(
'
--file <file>
'
,
'
path to state dump file
'
)
.
action
(
async
(
options
)
=>
{
const
iface
=
getContractInterface
(
'
OVM_L2ToL1MessagePasser
'
)
const
dump
=
fs
.
readFileSync
(
options
.
file
,
'
utf-8
'
)
const
addrs
:
string
[]
=
[]
const
msgs
:
any
[]
=
[]
for
(
const
line
of
dump
.
split
(
'
\n
'
))
{
if
(
line
.
startsWith
(
'
ETH
'
))
{
addrs
.
push
(
line
.
split
(
'
|
'
)[
1
].
replace
(
'
\r
'
,
''
))
}
else
if
(
line
.
startsWith
(
'
MSG
'
))
{
const
msg
=
'
0x
'
+
line
.
split
(
'
|
'
)[
2
].
replace
(
'
\r
'
,
''
)
const
parsed
=
iface
.
decodeFunctionData
(
'
passMessageToL1
'
,
msg
)
msgs
.
push
({
who
:
line
.
split
(
'
|
'
)[
1
],
msg
:
parsed
.
_message
,
})
}
}
fs
.
writeFileSync
(
'
./data/evm-addresses.json
'
,
JSON
.
stringify
(
addrs
,
null
,
2
))
fs
.
writeFileSync
(
'
./data/evm-messages.json
'
,
JSON
.
stringify
(
msgs
,
null
,
2
))
})
program
program
.
command
(
'
evm-sent-messages
'
)
.
command
(
'
evm-sent-messages
'
)
.
description
(
'
queries messages sent after the EVM upgrade
'
)
.
description
(
'
queries messages sent after the EVM upgrade
'
)
...
...
specs/derivation.md
View file @
98cd5879
...
@@ -363,11 +363,10 @@ where:
...
@@ -363,11 +363,10 @@ where:
When decompressing a channel, we limit the amount of decompressed data to
`MAX_RLP_BYTES_PER_CHANNEL`
(currently
When decompressing a channel, we limit the amount of decompressed data to
`MAX_RLP_BYTES_PER_CHANNEL`
(currently
10,000,000 bytes), in order to avoid "zip-bomb" types of attack (where a small compressed input decompresses to a
10,000,000 bytes), in order to avoid "zip-bomb" types of attack (where a small compressed input decompresses to a
humongous amount of data). If the decompressed data exceeds the limit, things proceeds as thought the channel contained
humongous amount of data). If the decompressed data exceeds the limit, things proceeds as though the channel contained
only the first
`MAX_RLP_BYTES_PER_CHANNEL`
decompressed bytes.
only the first
`MAX_RLP_BYTES_PER_CHANNEL`
decompressed bytes. The limit is set on RLP decoding, so all batches that
can be decoded in
`MAX_RLP_BYTES_PER_CHANNEL`
will be accepted ven if the size of the channel is greater than
When decoding batches, all batches that can be completly decoded below
`MAX_RLP_BYTES_PER_CHANNEL`
will be accepted
`MAX_RLP_BYTES_PER_CHANNEL`
. The exact requirement is that
`length(input) <= MAX_RLP_BYTES_PER_CHANNEL`
.
even if the size of the channel is greater than
`MAX_RLP_BYTES_PER_CHANNEL`
.
While the above pseudocode implies that all batches are known in advance, it is possible to perform streaming
While the above pseudocode implies that all batches are known in advance, it is possible to perform streaming
compression and decompression of RLP-encoded batches. This means it is possible to start including channel frames in a
compression and decompression of RLP-encoded batches. This means it is possible to start including channel frames in a
...
...
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