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
5ecdd804
Unverified
Commit
5ecdd804
authored
Jun 02, 2022
by
mergify[bot]
Committed by
GitHub
Jun 02, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into fix/geth-types
parents
17962ca9
1aca58c4
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
36 additions
and
22 deletions
+36
-22
wise-rabbits-drive.md
.changeset/wise-rabbits-drive.md
+5
-0
payload_attributes.go
op-node/rollup/derive/payload_attributes.go
+8
-7
step.go
op-node/rollup/driver/step.go
+7
-3
foundry.toml
packages/contracts-bedrock/foundry.toml
+1
-2
package.json
packages/contracts-bedrock/package.json
+4
-5
constants.ts
packages/contracts-bedrock/src/constants.ts
+0
-0
generateProofs.ts
packages/contracts-bedrock/src/generateProofs.ts
+0
-0
index.ts
packages/contracts-bedrock/src/index.ts
+3
-0
trie-test-generator.ts
packages/contracts-bedrock/src/trie-test-generator.ts
+0
-0
utils.ts
packages/contracts-bedrock/src/utils.ts
+0
-0
deposits.ts
packages/contracts-bedrock/tasks/deposits.ts
+1
-1
helpers.spec.ts
packages/contracts-bedrock/test/helpers.spec.ts
+1
-1
tsconfig.json
packages/contracts-bedrock/tsconfig.json
+6
-3
No files found.
.changeset/wise-rabbits-drive.md
0 → 100644
View file @
5ecdd804
---
'
@eth-optimism/contracts-bedrock'
:
patch
---
Initial release
op-node/rollup/derive/payload_attributes.go
View file @
5ecdd804
...
@@ -226,32 +226,33 @@ func UserDeposits(receipts []*types.Receipt, depositContractAddr common.Address)
...
@@ -226,32 +226,33 @@ func UserDeposits(receipts []*types.Receipt, depositContractAddr common.Address)
return
out
,
errs
return
out
,
errs
}
}
func
BatchesFromEVMTransactions
(
config
*
rollup
.
Config
,
txLists
[]
types
.
Transactions
)
([]
*
BatchData
,
error
)
{
func
BatchesFromEVMTransactions
(
config
*
rollup
.
Config
,
txLists
[]
types
.
Transactions
)
([]
*
BatchData
,
[]
error
)
{
var
out
[]
*
BatchData
var
out
[]
*
BatchData
var
errs
[]
error
l1Signer
:=
config
.
L1Signer
()
l1Signer
:=
config
.
L1Signer
()
for
_
,
txs
:=
range
txLists
{
for
i
,
txs
:=
range
txLists
{
for
_
,
tx
:=
range
txs
{
for
j
,
tx
:=
range
txs
{
if
to
:=
tx
.
To
();
to
!=
nil
&&
*
to
==
config
.
BatchInboxAddress
{
if
to
:=
tx
.
To
();
to
!=
nil
&&
*
to
==
config
.
BatchInboxAddress
{
seqDataSubmitter
,
err
:=
l1Signer
.
Sender
(
tx
)
// optimization: only derive sender if To is correct
seqDataSubmitter
,
err
:=
l1Signer
.
Sender
(
tx
)
// optimization: only derive sender if To is correct
if
err
!=
nil
{
if
err
!=
nil
{
// TODO: log error
errs
=
append
(
errs
,
fmt
.
Errorf
(
"invalid signature: tx list: %d, tx: %d, err: %w"
,
i
,
j
,
err
))
continue
// bad signature, ignore
continue
// bad signature, ignore
}
}
// some random L1 user might have sent a transaction to our batch inbox, ignore them
// some random L1 user might have sent a transaction to our batch inbox, ignore them
if
seqDataSubmitter
!=
config
.
BatchSenderAddress
{
if
seqDataSubmitter
!=
config
.
BatchSenderAddress
{
// TODO: log/record metric
errs
=
append
(
errs
,
fmt
.
Errorf
(
"unauthorized batch submitter: tx list: %d, tx: %d"
,
i
,
j
))
continue
// not an authorized batch submitter, ignore
continue
// not an authorized batch submitter, ignore
}
}
batches
,
err
:=
DecodeBatches
(
config
,
bytes
.
NewReader
(
tx
.
Data
()))
batches
,
err
:=
DecodeBatches
(
config
,
bytes
.
NewReader
(
tx
.
Data
()))
if
err
!=
nil
{
if
err
!=
nil
{
// TODO: log/record metric
errs
=
append
(
errs
,
fmt
.
Errorf
(
"invalid batch: tx list: %d, tx: %d, err: %w"
,
i
,
j
,
err
))
continue
continue
}
}
out
=
append
(
out
,
batches
...
)
out
=
append
(
out
,
batches
...
)
}
}
}
}
}
}
return
out
,
nil
return
out
,
errs
}
}
func
FilterBatches
(
config
*
rollup
.
Config
,
epoch
rollup
.
Epoch
,
minL2Time
uint64
,
maxL2Time
uint64
,
batches
[]
*
BatchData
)
(
out
[]
*
BatchData
)
{
func
FilterBatches
(
config
*
rollup
.
Config
,
epoch
rollup
.
Epoch
,
minL2Time
uint64
,
maxL2Time
uint64
,
batches
[]
*
BatchData
)
(
out
[]
*
BatchData
)
{
...
...
op-node/rollup/driver/step.go
View file @
5ecdd804
...
@@ -198,10 +198,14 @@ func (d *outputImpl) insertEpoch(ctx context.Context, l2Head eth.L2BlockRef, l2S
...
@@ -198,10 +198,14 @@ func (d *outputImpl) insertEpoch(ctx context.Context, l2Head eth.L2BlockRef, l2S
if
err
!=
nil
{
if
err
!=
nil
{
return
l2Head
,
l2SafeHead
,
false
,
fmt
.
Errorf
(
"failed to fetch transactions from %s: %v"
,
l1Input
,
err
)
return
l2Head
,
l2SafeHead
,
false
,
fmt
.
Errorf
(
"failed to fetch transactions from %s: %v"
,
l1Input
,
err
)
}
}
batches
,
err
:=
derive
.
BatchesFromEVMTransactions
(
&
d
.
Config
,
transactions
)
batches
,
errs
:=
derive
.
BatchesFromEVMTransactions
(
&
d
.
Config
,
transactions
)
if
err
!=
nil
{
// Some input to derive.BatchesFromEVMTransactions may be invalid and produce errors.
return
l2Head
,
l2SafeHead
,
false
,
fmt
.
Errorf
(
"failed to fetch create batches from transactions: %w"
,
err
)
// We log the errors, but keep going as this process is designed to be resilient to these errors
// and we have defaults in case no valid (or partial) batches were submitted.
for
i
,
err
:=
range
errs
{
d
.
log
.
Error
(
"Failed to decode batch"
,
"err_idx"
,
i
,
"err"
,
err
)
}
}
// Make batches contiguous
// Make batches contiguous
minL2Time
:=
uint64
(
l2Info
.
Timestamp
)
+
d
.
Config
.
BlockTime
minL2Time
:=
uint64
(
l2Info
.
Timestamp
)
+
d
.
Config
.
BlockTime
maxL2Time
:=
l1Info
.
Time
()
+
d
.
Config
.
MaxSequencerDrift
maxL2Time
:=
l1Info
.
Time
()
+
d
.
Config
.
MaxSequencerDrift
...
...
packages/contracts-bedrock/foundry.toml
View file @
5ecdd804
[default]
[default]
src
=
'contracts'
src
=
'contracts'
# We need to build seperate artifacts for forge and hh, because they each expect a different
# structure for the artifacts directory.
out
=
'forge-artifacts'
out
=
'forge-artifacts'
optimizer
=
true
optimizer
=
true
optimizer_runs
=
999999
optimizer_runs
=
999999
...
@@ -14,4 +12,5 @@ remappings = [
...
@@ -14,4 +12,5 @@ remappings = [
'forge-std/=node_modules/forge-std/src'
,
'forge-std/=node_modules/forge-std/src'
,
'ds-test/=node_modules/ds-test/src'
'ds-test/=node_modules/ds-test/src'
]
]
extra_output
=
[
'devdoc'
,
'userdoc'
,
'metadata'
,
'storageLayout'
]
bytecode_hash
=
"none"
bytecode_hash
=
"none"
packages/contracts-bedrock/package.json
View file @
5ecdd804
...
@@ -25,13 +25,12 @@
...
@@ -25,13 +25,12 @@
},
},
"scripts"
:
{
"scripts"
:
{
"build:forge"
:
"forge build"
,
"build:forge"
:
"forge build"
,
"build"
:
"yarn hardhat compile"
,
"build"
:
"hardhat compile && tsc && hardhat typechain"
,
"test:hh"
:
"yarn hardhat test"
,
"build:ts"
:
"tsc"
,
"test"
:
"yarn test:forge"
,
"test"
:
"forge test"
,
"test:forge"
:
"forge test"
,
"gas-snapshot"
:
"forge snapshot"
,
"gas-snapshot"
:
"forge snapshot"
,
"slither"
:
"slither ."
,
"slither"
:
"slither ."
,
"clean"
:
"rm -rf ./artifacts ./forge-artifacts ./cache ./coverage ./tsconfig.tsbuildinfo"
,
"clean"
:
"rm -rf ./
dist ./
artifacts ./forge-artifacts ./cache ./coverage ./tsconfig.tsbuildinfo"
,
"lint:ts:check"
:
"eslint ."
,
"lint:ts:check"
:
"eslint ."
,
"lint:contracts:check"
:
"yarn solhint -f table 'contracts/**/*.sol'"
,
"lint:contracts:check"
:
"yarn solhint -f table 'contracts/**/*.sol'"
,
"lint:check"
:
"yarn lint:contracts:check && yarn lint:ts:check"
,
"lint:check"
:
"yarn lint:contracts:check && yarn lint:ts:check"
,
...
...
packages/contracts-bedrock/
helpers
/constants.ts
→
packages/contracts-bedrock/
src
/constants.ts
View file @
5ecdd804
File moved
packages/contracts-bedrock/
helpers
/generateProofs.ts
→
packages/contracts-bedrock/
src
/generateProofs.ts
View file @
5ecdd804
File moved
packages/contracts-bedrock/src/index.ts
0 → 100644
View file @
5ecdd804
export
*
from
'
./utils
'
export
*
from
'
./generateProofs
'
export
*
from
'
./constants
'
packages/contracts-bedrock/
helpers
/trie-test-generator.ts
→
packages/contracts-bedrock/
src
/trie-test-generator.ts
View file @
5ecdd804
File moved
packages/contracts-bedrock/
helpers
/utils.ts
→
packages/contracts-bedrock/
src
/utils.ts
View file @
5ecdd804
File moved
packages/contracts-bedrock/tasks/deposits.ts
View file @
5ecdd804
...
@@ -2,7 +2,7 @@ import { task, types } from 'hardhat/config'
...
@@ -2,7 +2,7 @@ import { task, types } from 'hardhat/config'
import
{
Contract
,
providers
,
utils
,
Wallet
,
Event
}
from
'
ethers
'
import
{
Contract
,
providers
,
utils
,
Wallet
,
Event
}
from
'
ethers
'
import
dotenv
from
'
dotenv
'
import
dotenv
from
'
dotenv
'
import
{
DepositTx
}
from
'
../
helpers/index
'
import
{
DepositTx
}
from
'
../
src
'
dotenv
.
config
()
dotenv
.
config
()
...
...
packages/contracts-bedrock/test/helpers.spec.ts
View file @
5ecdd804
import
{
expect
}
from
'
chai
'
import
{
expect
}
from
'
chai
'
import
{
BigNumber
}
from
'
ethers
'
import
{
BigNumber
}
from
'
ethers
'
import
{
DepositTx
,
SourceHashDomain
}
from
'
../
helpers
'
import
{
DepositTx
,
SourceHashDomain
}
from
'
../
src
'
describe
(
'
Helpers
'
,
()
=>
{
describe
(
'
Helpers
'
,
()
=>
{
describe
(
'
DepositTx
'
,
()
=>
{
describe
(
'
DepositTx
'
,
()
=>
{
...
...
packages/contracts-bedrock/tsconfig.json
View file @
5ecdd804
{
{
"extends"
:
"../../tsconfig.json"
,
"extends"
:
"../../tsconfig.json"
,
"include"
:
[
"./scripts/"
,
"./helpers/"
],
"compilerOptions"
:
{
"compilerOptions"
:
{
"rootDir"
:
"."
,
"rootDir"
:
".
/src
"
,
"outDir"
:
"./dist"
"outDir"
:
"./dist"
}
},
"exclude"
:
[
"hardhat.config.ts"
,
"deploy"
,
"tasks"
,
"test"
],
"include"
:
[
"src/**/*"
]
}
}
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