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
66481ca9
Unverified
Commit
66481ca9
authored
Jan 14, 2022
by
Javed Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l2geth: forward tx to sequencer
parent
3174f034
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
api.go
l2geth/internal/ethapi/api.go
+18
-5
docker-compose.yml
ops/docker-compose.yml
+2
-0
No files found.
l2geth/internal/ethapi/api.go
View file @
66481ca9
...
@@ -40,6 +40,7 @@ import (
...
@@ -40,6 +40,7 @@ import (
"github.com/ethereum-optimism/optimism/l2geth/core/types"
"github.com/ethereum-optimism/optimism/l2geth/core/types"
"github.com/ethereum-optimism/optimism/l2geth/core/vm"
"github.com/ethereum-optimism/optimism/l2geth/core/vm"
"github.com/ethereum-optimism/optimism/l2geth/crypto"
"github.com/ethereum-optimism/optimism/l2geth/crypto"
"github.com/ethereum-optimism/optimism/l2geth/ethclient"
"github.com/ethereum-optimism/optimism/l2geth/log"
"github.com/ethereum-optimism/optimism/l2geth/log"
"github.com/ethereum-optimism/optimism/l2geth/p2p"
"github.com/ethereum-optimism/optimism/l2geth/p2p"
"github.com/ethereum-optimism/optimism/l2geth/params"
"github.com/ethereum-optimism/optimism/l2geth/params"
...
@@ -1649,18 +1650,30 @@ func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args Sen
...
@@ -1649,18 +1650,30 @@ func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args Sen
// SendRawTransaction will add the signed transaction to the transaction pool.
// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
// The sender is responsible for signing the transaction and using the correct nonce.
func
(
s
*
PublicTransactionPoolAPI
)
SendRawTransaction
(
ctx
context
.
Context
,
encodedTx
hexutil
.
Bytes
)
(
common
.
Hash
,
error
)
{
func
(
s
*
PublicTransactionPoolAPI
)
SendRawTransaction
(
ctx
context
.
Context
,
encodedTx
hexutil
.
Bytes
)
(
common
.
Hash
,
error
)
{
if
s
.
b
.
IsVerifier
()
{
tx
:=
new
(
types
.
Transaction
)
return
common
.
Hash
{},
errors
.
New
(
"Cannot send raw transaction in verifier mode"
)
if
err
:=
rlp
.
DecodeBytes
(
encodedTx
,
tx
);
err
!=
nil
{
return
common
.
Hash
{},
err
}
}
if
s
.
b
.
IsSyncing
()
{
if
s
.
b
.
IsSyncing
()
{
return
common
.
Hash
{},
errors
.
New
(
"Cannot send raw transaction while syncing"
)
return
common
.
Hash
{},
errors
.
New
(
"Cannot send raw transaction while syncing"
)
}
}
tx
:=
new
(
types
.
Transaction
)
// Forward tx to sequencer if config is set
if
err
:=
rlp
.
DecodeBytes
(
encodedTx
,
tx
);
err
!=
nil
{
// TODO: add forwarding config
return
common
.
Hash
{},
err
if
s
.
b
.
IsVerifier
()
{
// TODO: replace with env var L2_URL
client
,
err
:=
ethclient
.
Dial
(
"http://l2geth:8545"
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
err
=
client
.
SendTransaction
(
context
.
Background
(),
tx
)
if
err
!=
nil
{
return
common
.
Hash
{},
err
}
return
tx
.
Hash
(),
nil
}
}
// L1Timestamp and L1BlockNumber will be set right before execution
// L1Timestamp and L1BlockNumber will be set right before execution
txMeta
:=
types
.
NewTransactionMeta
(
nil
,
0
,
nil
,
types
.
QueueOriginSequencer
,
nil
,
nil
,
encodedTx
)
txMeta
:=
types
.
NewTransactionMeta
(
nil
,
0
,
nil
,
types
.
QueueOriginSequencer
,
nil
,
nil
,
encodedTx
)
tx
.
SetTransactionMeta
(
txMeta
)
tx
.
SetTransactionMeta
(
txMeta
)
...
...
ops/docker-compose.yml
View file @
66481ca9
...
@@ -155,6 +155,7 @@ services:
...
@@ -155,6 +155,7 @@ services:
replica
:
replica
:
depends_on
:
depends_on
:
-
dtl
-
dtl
-
l2geth
deploy
:
deploy
:
replicas
:
1
replicas
:
1
build
:
build
:
...
@@ -165,6 +166,7 @@ services:
...
@@ -165,6 +166,7 @@ services:
-
./envs/geth.env
-
./envs/geth.env
environment
:
environment
:
ETH1_HTTP
:
http://l1_chain:8545
ETH1_HTTP
:
http://l1_chain:8545
L2_URL
:
http://l2geth:8545
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
ROLLUP_STATE_DUMP_PATH
:
http://deployer:8081/state-dump.latest.json
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_CLIENT_HTTP
:
http://dtl:7878
ROLLUP_BACKEND
:
'
l2'
ROLLUP_BACKEND
:
'
l2'
...
...
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