Skip to content

Commit

Permalink
(BIDS-2454) Update dependencies and solve breaking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
D13ce committed Sep 6, 2023
1 parent 7e539bd commit 9cfeef0
Show file tree
Hide file tree
Showing 5 changed files with 301 additions and 99 deletions.
31 changes: 16 additions & 15 deletions eth1data/eth1data.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
"github.com/ethereum/go-ethereum/accounts/abi"
"github.com/ethereum/go-ethereum/accounts/abi/bind"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
geth_types "github.com/ethereum/go-ethereum/core/types"
"github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -87,37 +88,37 @@ func GetEth1Transaction(hash common.Hash) (*types.Eth1TxData, error) {
txPageData.BlockNumber = header.Number.Int64()
txPageData.Timestamp = time.Unix(int64(header.Time), 0)

msg, err := tx.AsMessage(geth_types.NewLondonSigner(tx.ChainId()), header.BaseFee)
msg, err := core.TransactionToMessage(tx, geth_types.NewLondonSigner(tx.ChainId()), header.BaseFee)
if err != nil {
return nil, fmt.Errorf("error converting tx %v to message: %v", hash, err)
}
txPageData.From = msg.From()
txPageData.Nonce = msg.Nonce()
txPageData.From = msg.From
txPageData.Nonce = msg.Nonce
txPageData.Type = receipt.Type
txPageData.TypeFormatted = utils.FormatTransactionType(receipt.Type)
txPageData.TxnPosition = receipt.TransactionIndex

txPageData.Gas.MaxPriorityFee = msg.GasTipCap().Bytes()
txPageData.Gas.MaxFee = msg.GasFeeCap().Bytes()
txPageData.Gas.MaxPriorityFee = msg.GasTipCap.Bytes()
txPageData.Gas.MaxFee = msg.GasFeeCap.Bytes()
if header.BaseFee != nil {
txPageData.Gas.BlockBaseFee = header.BaseFee.Bytes()
}
txPageData.Gas.Used = receipt.GasUsed
txPageData.Gas.Limit = msg.Gas()
txPageData.Gas.UsedPerc = float64(receipt.GasUsed) / float64(msg.Gas())
txPageData.Gas.Limit = msg.GasLimit
txPageData.Gas.UsedPerc = float64(receipt.GasUsed) / float64(msg.GasLimit)
if receipt.Type >= 2 {
tmp := new(big.Int)
tmp.Add(tmp, header.BaseFee)
if t := *new(big.Int).Sub(msg.GasFeeCap(), tmp); t.Cmp(msg.GasTipCap()) == -1 {
if t := *new(big.Int).Sub(msg.GasFeeCap, tmp); t.Cmp(msg.GasTipCap) == -1 {
tmp.Add(tmp, &t)
} else {
tmp.Add(tmp, msg.GasTipCap())
tmp.Add(tmp, msg.GasTipCap)
}
txPageData.Gas.EffectiveFee = tmp.Bytes()
txPageData.Gas.TxFee = tmp.Mul(tmp, big.NewInt(int64(receipt.GasUsed))).Bytes()
} else {
txPageData.Gas.EffectiveFee = msg.GasFeeCap().Bytes()
txPageData.Gas.TxFee = msg.GasFeeCap().Mul(msg.GasFeeCap(), big.NewInt(int64(receipt.GasUsed))).Bytes()
txPageData.Gas.EffectiveFee = msg.GasFeeCap.Bytes()
txPageData.Gas.TxFee = msg.GasFeeCap.Mul(msg.GasFeeCap, big.NewInt(int64(receipt.GasUsed))).Bytes()
}

if receipt.Status != 1 {
Expand All @@ -135,17 +136,17 @@ func GetEth1Transaction(hash common.Hash) (*types.Eth1TxData, error) {
if err != nil {
return nil, fmt.Errorf("error loading token transfers from tx %v: %v", hash, err)
}
txPageData.InternalTxns, err = db.BigtableClient.GetInternalTransfersForTransaction(tx.Hash().Bytes(), msg.From().Bytes())
txPageData.InternalTxns, err = db.BigtableClient.GetInternalTransfersForTransaction(tx.Hash().Bytes(), msg.From.Bytes())
if err != nil {
return nil, fmt.Errorf("error loading internal transfers from tx %v: %v", hash, err)
}
}
txPageData.FromName, err = db.BigtableClient.GetAddressName(msg.From().Bytes())
txPageData.FromName, err = db.BigtableClient.GetAddressName(msg.From.Bytes())
if err != nil {
return nil, fmt.Errorf("error retrieveing from name for tx %v: %v", hash, err)
}
if msg.To() != nil {
txPageData.ToName, err = db.BigtableClient.GetAddressName(msg.To().Bytes())
if msg.To != nil {
txPageData.ToName, err = db.BigtableClient.GetAddressName(msg.To.Bytes())
if err != nil {
return nil, fmt.Errorf("error retrieveing to name for tx %v: %v", hash, err)
}
Expand Down
72 changes: 48 additions & 24 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ require (
github.com/awa/go-iap v1.3.7
github.com/aybabtme/uniplot v0.0.0-20151203143629-039c559e5e7e
github.com/davecgh/go-spew v1.1.1
github.com/ethereum/go-ethereum v1.11.3
github.com/ethereum/go-ethereum v1.12.2
github.com/evanw/esbuild v0.8.23
github.com/go-redis/redis/v8 v8.11.5
github.com/gobitfly/eth-rewards v0.1.2-0.20230403064929-411ddc40a5f7
Expand Down Expand Up @@ -55,13 +55,13 @@ require (
github.com/swaggo/http-swagger v1.3.0
github.com/swaggo/swag v1.8.3
github.com/urfave/negroni v1.0.0
github.com/wealdtech/go-ens/v3 v3.5.5
github.com/wealdtech/go-ens/v3 v3.6.0
github.com/wealdtech/go-eth2-types/v2 v2.8.1
github.com/wealdtech/go-eth2-util v1.8.1
github.com/zesik/proxyaddr v0.0.0-20161218060608-ec32c535184d
golang.org/x/crypto v0.7.0
golang.org/x/sync v0.1.0
golang.org/x/text v0.8.0
golang.org/x/crypto v0.13.0
golang.org/x/sync v0.3.0
golang.org/x/text v0.13.0
google.golang.org/api v0.102.0
google.golang.org/protobuf v1.28.1
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -70,7 +70,7 @@ require (
require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0
golang.org/x/exp v0.0.0-20230206171751-46f607a40771
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
)

require (
Expand All @@ -79,41 +79,65 @@ require (
cloud.google.com/go/compute/metadata v0.2.1 // indirect
cloud.google.com/go/iam v0.7.0 // indirect
cloud.google.com/go/longrunning v0.3.0 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/VictoriaMetrics/fastcache v1.6.0 // indirect
github.com/alessio/shellescape v1.4.1 // indirect
github.com/bits-and-blooms/bitset v1.7.0 // indirect
github.com/census-instrumentation/opencensus-proto v0.2.1 // indirect
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4 // indirect
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1 // 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-20230209160836-829675f94811 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.10.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/deckarep/golang-set/v2 v2.3.1 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1 // indirect
github.com/envoyproxy/protoc-gen-validate v0.1.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/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.3 // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/ipfs/go-cid v0.3.2 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-runewidth v0.0.14 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.2.0 // indirect
github.com/multiformats/go-multibase v0.1.1 // indirect
github.com/multiformats/go-multihash v0.2.1 // indirect
github.com/multiformats/go-multibase v0.2.0 // indirect
github.com/multiformats/go-multihash v0.2.3 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect
github.com/protolambda/zssz v0.1.5 // indirect
github.com/prysmaticlabs/fastssz v0.0.0-20221107182844-78142813af44 // indirect
github.com/prysmaticlabs/gohashtree v0.0.2-alpha // indirect
github.com/rivo/uniseg v0.4.3 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rs/cors v1.8.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/urfave/cli v1.22.12 // indirect
github.com/wealdtech/go-bytesutil v1.2.1 // indirect
github.com/wealdtech/go-merkletree v1.0.1-0.20190605192610-2bb163c2ea2a // indirect
github.com/wealdtech/go-multicodec v1.4.0 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
github.com/yusufpapurcu/wmi v1.2.3 // indirect
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect
google.golang.org/grpc v1.52.3 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
lukechampine.com/blake3 v1.2.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)

require (
Expand All @@ -126,11 +150,11 @@ require (
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coocood/freecache v1.2.3
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/ferranbt/fastssz v0.1.3 // indirect
github.com/go-chi/chi v4.0.2+incompatible // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/spec v0.20.6 // indirect
Expand All @@ -139,9 +163,9 @@ require (
github.com/goccy/go-yaml v1.10.0 // indirect
github.com/golang/glog v1.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/uuid v1.3.0
github.com/google/uuid v1.3.1
github.com/googleapis/gax-go/v2 v2.6.0 // indirect
github.com/gorilla/securecookie v1.1.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
Expand All @@ -157,13 +181,13 @@ require (
github.com/jackc/puddle v1.3.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/klauspost/compress v1.16.0
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/highwayhash v1.0.2 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/patrickmn/go-cache v2.1.0+incompatible
github.com/prometheus/client_model v0.3.0 // indirect
Expand All @@ -172,17 +196,17 @@ require (
github.com/r3labs/sse/v2 v2.7.4 // indirect
github.com/rs/zerolog v1.26.1 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/supranational/blst v0.3.10 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/swaggo/files v0.0.0-20220610200504-28940afbdbfe // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d
github.com/thomaso-mirodin/intmath v0.0.0-20160323211736-5dc6d854e46e // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/tklauser/go-sysconf v0.3.12 // indirect
github.com/tklauser/numcpus v0.6.1 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/tools v0.7.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gonum.org/v1/gonum v0.12.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
Loading

0 comments on commit 9cfeef0

Please sign in to comment.