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
a3e012d3
Unverified
Commit
a3e012d3
authored
Dec 13, 2023
by
felipe
Committed by
GitHub
Dec 13, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8597 from ethereum-optimism/felipe/ufm-deps
chore(ufm): update deps
parents
5fb16e2f
621e4e74
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
38 deletions
+94
-38
go.mod
op-ufm/go.mod
+25
-17
go.sum
op-ufm/go.sum
+45
-0
signer.go
op-ufm/pkg/metrics/clients/signer.go
+4
-3
roundtrip.go
op-ufm/pkg/provider/roundtrip.go
+20
-18
No files found.
op-ufm/go.mod
View file @
a3e012d3
module github.com/ethereum-optimism/optimism/op-ufm
go 1.20
go 1.21
toolchain go1.21.3
require (
cloud.google.com/go/kms v1.12.1
github.com/BurntSushi/toml v1.3.2
github.com/ethereum-optimism/optimism
/op-service v0.10.14
github.com/ethereum/go-ethereum v1.1
2
.1
github.com/ethereum-optimism/optimism
v1.2.0
github.com/ethereum/go-ethereum v1.1
3
.1
github.com/gorilla/mux v1.8.0
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.1
6
.0
github.com/prometheus/client_golang v1.1
7
.0
github.com/rs/cors v1.9.0
)
...
...
@@ -18,6 +20,7 @@ require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.0 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.10.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
...
...
@@ -25,15 +28,16 @@ require (
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230
209160836-829675f94811
// indirect
github.com/cockroachdb/pebble v0.0.0-20230
906160148-46873a6a7a06
// indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
...
...
@@ -49,34 +53,38 @@ require (
github.com/gorilla/websocket v1.5.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/klauspost/compress v1.1
5.15
// indirect
github.com/klauspost/compress v1.1
6.7
// indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-runewidth v0.0.1
3
// indirect
github.com/mattn/go-runewidth v0.0.1
4
// indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/prometheus/client_model v0.
3.0
// indirect
github.com/prometheus/common v0.4
2
.0 // indirect
github.com/prometheus/procfs v0.1
0
.1 // indirect
github.com/rivo/uniseg v0.
3.4
// indirect
github.com/rogpeppe/go-internal v1.
9
.0 // indirect
github.com/prometheus/client_model v0.
4.1-0.20230718164431-9a2bf3000d16
// indirect
github.com/prometheus/common v0.4
4
.0 // indirect
github.com/prometheus/procfs v0.1
1
.1 // indirect
github.com/rivo/uniseg v0.
4.3
// indirect
github.com/rogpeppe/go-internal v1.
10
.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
github.com/tklauser/go-sysconf v0.3.1
0
// indirect
github.com/tklauser/numcpus v0.
5.0
// indirect
github.com/tklauser/go-sysconf v0.3.1
2
// indirect
github.com/tklauser/numcpus v0.
6.1
// indirect
github.com/urfave/cli v1.22.9 // indirect
github.com/urfave/cli/v2 v2.25.7 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.13.0 // indirect
google.golang.org/api v0.132.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230706204954-ccb25ca9f130 // indirect
...
...
op-ufm/go.sum
View file @
a3e012d3
This diff is collapsed.
Click to expand it.
op-ufm/pkg/metrics/clients/signer.go
View file @
a3e012d3
...
...
@@ -6,9 +6,10 @@ import (
"time"
"github.com/ethereum-optimism/optimism/op-ufm/pkg/metrics"
"github.com/ethereum/go-ethereum/common"
optls
"github.com/ethereum-optimism/optimism/op-service/tls"
signer
"github.com/ethereum-optimism/optimism/op-service/signer"
optls
"github.com/ethereum-optimism/optimism/op-service/tls"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/log"
)
...
...
@@ -29,9 +30,9 @@ func NewSignerClient(providerName string, logger log.Logger, endpoint string, tl
return
&
InstrumentedSignerClient
{
c
:
c
,
providerName
:
providerName
},
nil
}
func
(
i
*
InstrumentedSignerClient
)
SignTransaction
(
ctx
context
.
Context
,
chainId
*
big
.
Int
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
func
(
i
*
InstrumentedSignerClient
)
SignTransaction
(
ctx
context
.
Context
,
chainId
*
big
.
Int
,
from
*
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
start
:=
time
.
Now
()
tx
,
err
:=
i
.
c
.
SignTransaction
(
ctx
,
chainId
,
tx
)
tx
,
err
:=
i
.
c
.
SignTransaction
(
ctx
,
chainId
,
*
from
,
tx
)
if
err
!=
nil
{
metrics
.
RecordErrorDetails
(
i
.
providerName
,
"signer.SignTransaction"
,
err
)
return
nil
,
err
...
...
op-ufm/pkg/provider/roundtrip.go
View file @
a3e012d3
...
...
@@ -57,7 +57,7 @@ func (p *Provider) RoundTrip(ctx context.Context) {
}
}
tx
,
err
:=
p
.
createTx
(
ctx
,
client
,
nonce
)
from
,
tx
,
err
:=
p
.
createTx
(
ctx
,
client
,
nonce
)
if
err
!=
nil
{
log
.
Error
(
"cant create tx"
,
"provider"
,
p
.
name
,
...
...
@@ -67,7 +67,7 @@ func (p *Provider) RoundTrip(ctx context.Context) {
}
nonce
=
tx
.
Nonce
()
signedTx
,
err
:=
p
.
sign
(
ctx
,
tx
)
signedTx
,
err
:=
p
.
sign
(
ctx
,
from
,
tx
)
if
err
!=
nil
{
log
.
Error
(
"cant sign tx"
,
"provider"
,
p
.
name
,
...
...
@@ -192,16 +192,16 @@ func (p *Provider) RoundTrip(ctx context.Context) {
"gasUsed"
,
receipt
.
GasUsed
)
}
func
(
p
*
Provider
)
createTx
(
ctx
context
.
Context
,
client
*
iclients
.
InstrumentedEthClient
,
nonce
uint64
)
(
*
types
.
Transaction
,
error
)
{
func
(
p
*
Provider
)
createTx
(
ctx
context
.
Context
,
client
*
iclients
.
InstrumentedEthClient
,
nonce
uint64
)
(
*
common
.
Address
,
*
types
.
Transaction
,
error
)
{
var
err
error
if
nonce
==
0
{
nonce
,
err
=
client
.
PendingNonceAt
(
ctx
,
p
.
walletConfig
.
Address
)
if
err
!=
nil
{
log
.
Error
(
"cant get no
u
nce"
,
log
.
Error
(
"cant get nonce"
,
"provider"
,
p
.
name
,
"nonce"
,
nonce
,
"err"
,
err
)
return
nil
,
err
return
nil
,
nil
,
err
}
}
...
...
@@ -210,17 +210,21 @@ func (p *Provider) createTx(ctx context.Context, client *iclients.InstrumentedEt
log
.
Error
(
"cant get gas tip cap"
,
"provider"
,
p
.
name
,
"err"
,
err
)
return
nil
,
err
return
nil
,
nil
,
err
}
gasTipCap
=
new
(
big
.
Int
)
.
Mul
(
gasTipCap
,
big
.
NewInt
(
110
))
gasTipCap
=
new
(
big
.
Int
)
.
Div
(
gasTipCap
,
big
.
NewInt
(
100
))
// adjust gas tip cap by 110%
const
GasTipCapAdjustmentMultiplier
=
110
const
GasTipCapAdjustmentDivisor
=
100
gasTipCap
=
new
(
big
.
Int
)
.
Mul
(
gasTipCap
,
big
.
NewInt
(
GasTipCapAdjustmentMultiplier
))
gasTipCap
=
new
(
big
.
Int
)
.
Div
(
gasTipCap
,
big
.
NewInt
(
GasTipCapAdjustmentDivisor
))
head
,
err
:=
client
.
HeaderByNumber
(
ctx
,
nil
)
if
err
!=
nil
{
log
.
Error
(
"cant get base fee from head"
,
"provider"
,
p
.
name
,
"err"
,
err
)
return
nil
,
err
return
nil
,
nil
,
err
}
baseFee
:=
head
.
BaseFee
...
...
@@ -252,7 +256,7 @@ func (p *Provider) createTx(ctx context.Context, client *iclients.InstrumentedEt
log
.
Error
(
"cant estimate gas"
,
"provider"
,
p
.
name
,
"err"
,
err
)
return
nil
,
err
return
nil
,
nil
,
err
}
dynamicTx
.
Gas
=
gas
tx
:=
types
.
NewTx
(
dynamicTx
)
...
...
@@ -268,14 +272,15 @@ func (p *Provider) createTx(ctx context.Context, client *iclients.InstrumentedEt
"gasFeeCap"
,
dynamicTx
.
GasFeeCap
,
)
return
tx
,
nil
return
&
addr
,
tx
,
nil
}
func
(
p
*
Provider
)
sign
(
ctx
context
.
Context
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
func
(
p
*
Provider
)
sign
(
ctx
context
.
Context
,
from
*
common
.
Address
,
tx
*
types
.
Transaction
)
(
*
types
.
Transaction
,
error
)
{
if
p
.
walletConfig
.
SignerMethod
==
"static"
{
log
.
Debug
(
"using static signer"
)
privateKey
,
err
:=
crypto
.
HexToECDSA
(
p
.
walletConfig
.
PrivateKey
)
if
err
!=
nil
{
log
.
Error
(
"failed to parse private key"
,
"err"
,
err
)
return
nil
,
err
}
return
types
.
SignTx
(
tx
,
types
.
LatestSignerForChainID
(
&
p
.
walletConfig
.
ChainID
),
privateKey
)
...
...
@@ -286,18 +291,15 @@ func (p *Provider) sign(ctx context.Context, tx *types.Transaction) (*types.Tran
TLSKey
:
p
.
signerConfig
.
TLSKey
,
}
client
,
err
:=
iclients
.
NewSignerClient
(
p
.
name
,
log
.
Root
(),
p
.
signerConfig
.
URL
,
tlsConfig
)
log
.
Debug
(
"signerclient"
,
"client"
,
client
,
"err"
,
err
)
if
err
!=
nil
{
return
nil
,
err
if
err
!=
nil
||
client
==
nil
{
log
.
Error
(
"failed to create signer client"
,
"err"
,
err
)
}
if
client
==
nil
{
return
nil
,
errors
.
New
(
"could not initialize signer client"
)
}
signedTx
,
err
:=
client
.
SignTransaction
(
ctx
,
&
p
.
walletConfig
.
ChainID
,
tx
)
signedTx
,
err
:=
client
.
SignTransaction
(
ctx
,
&
p
.
walletConfig
.
ChainID
,
from
,
tx
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
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