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
6f1d8d9a
Unverified
Commit
6f1d8d9a
authored
Mar 05, 2023
by
mergify[bot]
Committed by
GitHub
Mar 05, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5052 from mdehoog/michael/fix-address-comparison
[op-signer] Populate from address in TransactionArgs
parents
55230429
42e92639
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
5 deletions
+8
-5
signature.go
op-service/crypto/signature.go
+3
-2
client.go
op-signer/client/client.go
+3
-2
transaction_args.go
op-signer/client/transaction_args.go
+2
-1
No files found.
op-service/crypto/signature.go
View file @
6f1d8d9a
package
crypto
package
crypto
import
(
import
(
"bytes"
"context"
"context"
"crypto/ecdsa"
"crypto/ecdsa"
"errors"
"errors"
...
@@ -56,10 +57,10 @@ func SignerFactoryFromConfig(l log.Logger, privateKey, mnemonic, hdPath string,
...
@@ -56,10 +57,10 @@ func SignerFactoryFromConfig(l log.Logger, privateKey, mnemonic, hdPath string,
fromAddress
=
common
.
HexToAddress
(
signerConfig
.
Address
)
fromAddress
=
common
.
HexToAddress
(
signerConfig
.
Address
)
signer
=
func
(
chainID
*
big
.
Int
)
SignerFn
{
signer
=
func
(
chainID
*
big
.
Int
)
SignerFn
{
return
func
(
ctx
context
.
Context
,
address
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
return
func
(
ctx
context
.
Context
,
address
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
if
address
.
String
()
!=
signerConfig
.
Address
{
if
!
bytes
.
Equal
(
address
[
:
],
fromAddress
[
:
])
{
return
nil
,
fmt
.
Errorf
(
"attempting to sign for %s, expected %s: "
,
address
,
signerConfig
.
Address
)
return
nil
,
fmt
.
Errorf
(
"attempting to sign for %s, expected %s: "
,
address
,
signerConfig
.
Address
)
}
}
return
signerClient
.
SignTransaction
(
ctx
,
chainID
,
tx
)
return
signerClient
.
SignTransaction
(
ctx
,
chainID
,
address
,
tx
)
}
}
}
}
}
else
{
}
else
{
...
...
op-signer/client/client.go
View file @
6f1d8d9a
...
@@ -12,6 +12,7 @@ import (
...
@@ -12,6 +12,7 @@ import (
optls
"github.com/ethereum-optimism/optimism/op-service/tls"
optls
"github.com/ethereum-optimism/optimism/op-service/tls"
"github.com/ethereum-optimism/optimism/op-service/tls/certman"
"github.com/ethereum-optimism/optimism/op-service/tls/certman"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/log"
...
@@ -91,8 +92,8 @@ func (s *SignerClient) pingVersion() (string, error) {
...
@@ -91,8 +92,8 @@ func (s *SignerClient) pingVersion() (string, error) {
return
v
,
nil
return
v
,
nil
}
}
func
(
s
*
SignerClient
)
SignTransaction
(
ctx
context
.
Context
,
chainId
*
big
.
Int
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
func
(
s
*
SignerClient
)
SignTransaction
(
ctx
context
.
Context
,
chainId
*
big
.
Int
,
from
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
args
:=
NewTransactionArgsFromTransaction
(
chainId
,
tx
)
args
:=
NewTransactionArgsFromTransaction
(
chainId
,
from
,
tx
)
var
result
hexutil
.
Bytes
var
result
hexutil
.
Bytes
if
err
:=
s
.
client
.
CallContext
(
ctx
,
&
result
,
"eth_signTransaction"
,
args
);
err
!=
nil
{
if
err
:=
s
.
client
.
CallContext
(
ctx
,
&
result
,
"eth_signTransaction"
,
args
);
err
!=
nil
{
...
...
op-signer/client/transaction_args.go
View file @
6f1d8d9a
...
@@ -31,12 +31,13 @@ type TransactionArgs struct {
...
@@ -31,12 +31,13 @@ type TransactionArgs struct {
}
}
// NewTransactionArgsFromTransaction creates a TransactionArgs struct from an EIP-1559 transaction
// NewTransactionArgsFromTransaction creates a TransactionArgs struct from an EIP-1559 transaction
func
NewTransactionArgsFromTransaction
(
chainId
*
big
.
Int
,
tx
*
types
.
Transaction
)
*
TransactionArgs
{
func
NewTransactionArgsFromTransaction
(
chainId
*
big
.
Int
,
from
common
.
Address
,
tx
*
types
.
Transaction
)
*
TransactionArgs
{
data
:=
hexutil
.
Bytes
(
tx
.
Data
())
data
:=
hexutil
.
Bytes
(
tx
.
Data
())
nonce
:=
hexutil
.
Uint64
(
tx
.
Nonce
())
nonce
:=
hexutil
.
Uint64
(
tx
.
Nonce
())
gas
:=
hexutil
.
Uint64
(
tx
.
Gas
())
gas
:=
hexutil
.
Uint64
(
tx
.
Gas
())
accesses
:=
tx
.
AccessList
()
accesses
:=
tx
.
AccessList
()
args
:=
&
TransactionArgs
{
args
:=
&
TransactionArgs
{
From
:
&
from
,
Input
:
&
data
,
Input
:
&
data
,
Nonce
:
&
nonce
,
Nonce
:
&
nonce
,
Value
:
(
*
hexutil
.
Big
)(
tx
.
Value
()),
Value
:
(
*
hexutil
.
Big
)(
tx
.
Value
()),
...
...
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