From e4745d01b46562026ca0ffee7aed17e475979c3f Mon Sep 17 00:00:00 2001 From: Ivan Belyakov Date: Tue, 30 Jan 2024 20:50:46 +0100 Subject: [PATCH] fix(wallet): handle BlobTxType transaction. Update go-ethereum version Closes #4636 --- go.mod | 2 +- go.sum | 4 +-- services/wallet/transfer/downloader.go | 4 +++ .../go-ethereum/core/types/dummy_tx_blob.go | 28 +++++++++++++++++++ .../go-ethereum/core/types/transaction.go | 4 +++ .../core/types/transaction_marshalling.go | 2 ++ vendor/modules.txt | 2 +- 7 files changed, 42 insertions(+), 4 deletions(-) create mode 100644 vendor/github.com/ethereum/go-ethereum/core/types/dummy_tx_blob.go diff --git a/go.mod b/go.mod index 877cec6b4..d2ffe4a2c 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/status-im/status-go go 1.19 -replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.11 +replace github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.13 replace github.com/rjeczalik/notify => github.com/status-im/notify v1.0.2-status diff --git a/go.sum b/go.sum index 4cff04919..92c8065c5 100644 --- a/go.sum +++ b/go.sum @@ -1986,8 +1986,8 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/status-im/doubleratchet v3.0.0+incompatible h1:aJ1ejcSERpSzmWZBgtfYtiU2nF0Q8ZkGyuEPYETXkCY= github.com/status-im/doubleratchet v3.0.0+incompatible/go.mod h1:1sqR0+yhiM/bd+wrdX79AOt2csZuJOni0nUDzKNuqOU= -github.com/status-im/go-ethereum v1.10.25-status.11 h1:casDsgnrkXzyO9SQVyFsT+63XuInyFXzfEHRW/9eEVY= -github.com/status-im/go-ethereum v1.10.25-status.11/go.mod h1:Dt4K5JYMhJRdtXJwBEyGZLZn9iz/chSOZyjVmt5ZhwQ= +github.com/status-im/go-ethereum v1.10.25-status.13 h1:BIQB1MEY5m/D0pd4zXF1psKgyHMmnC+HZ+liJfB4tmY= +github.com/status-im/go-ethereum v1.10.25-status.13/go.mod h1:Dt4K5JYMhJRdtXJwBEyGZLZn9iz/chSOZyjVmt5ZhwQ= github.com/status-im/go-multiaddr-ethv4 v1.2.5 h1:pN+ey6wYKbvNNu5/xq9+VL0N8Yq0pZUTbZp0URg+Yn4= github.com/status-im/go-multiaddr-ethv4 v1.2.5/go.mod h1:Fhe/18yWU5QwlAYiOO3Bb1BLe0bn5YobcNBHsjRr4kk= github.com/status-im/go-sqlcipher/v4 v4.5.4-status.2 h1:Oi9JTAI2DZEe5UKlpUcvKBCCSn3ULsLIrix7jPnEoPE= diff --git a/services/wallet/transfer/downloader.go b/services/wallet/transfer/downloader.go index cd8b895b0..75e6cc51c 100644 --- a/services/wallet/transfer/downloader.go +++ b/services/wallet/transfer/downloader.go @@ -225,6 +225,10 @@ func (d *ETHDownloader) getTransfersInBlock(ctx context.Context, blk *types.Bloc } for _, tx := range blk.Transactions() { + // Skip dummy blob transactions, as they are not supported by us + if tx.Type() == types.BlobTxType { + continue + } if tx.ChainId().Cmp(big.NewInt(0)) != 0 && tx.ChainId().Cmp(d.chainClient.ToBigInt()) != 0 { log.Info("chain id mismatch", "tx hash", tx.Hash(), "tx chain id", tx.ChainId(), "expected chain id", d.chainClient.NetworkID()) continue diff --git a/vendor/github.com/ethereum/go-ethereum/core/types/dummy_tx_blob.go b/vendor/github.com/ethereum/go-ethereum/core/types/dummy_tx_blob.go new file mode 100644 index 000000000..a89617fea --- /dev/null +++ b/vendor/github.com/ethereum/go-ethereum/core/types/dummy_tx_blob.go @@ -0,0 +1,28 @@ +package types + +import ( + "math/big" + "github.com/ethereum/go-ethereum/common" +) + +type DummyBlobTx struct { +} + +// accessors for innerTx. +func (tx *DummyBlobTx) txType() byte { return BlobTxType } +func (tx *DummyBlobTx) chainID() *big.Int { return nil } +func (tx *DummyBlobTx) accessList() AccessList { return AccessList{} } +func (tx *DummyBlobTx) data() []byte { return nil } +func (tx *DummyBlobTx) gas() uint64 { return 0 } +func (tx *DummyBlobTx) gasFeeCap() *big.Int { return nil } +func (tx *DummyBlobTx) gasTipCap() *big.Int { return nil } +func (tx *DummyBlobTx) gasPrice() *big.Int { return nil } +func (tx *DummyBlobTx) value() *big.Int { return nil } +func (tx *DummyBlobTx) nonce() uint64 { return 0 } +func (tx *DummyBlobTx) to() *common.Address { return nil } +func (tx *DummyBlobTx) isSystemTx() bool { return false } +func (tx *DummyBlobTx) copy() TxData { return nil } +func (tx *DummyBlobTx) effectiveGasPrice(dst *big.Int, baseFee *big.Int) *big.Int { return nil } +func (tx *DummyBlobTx) isFake() bool { return true } +func (tx *DummyBlobTx) rawSignatureValues() (v, r, s *big.Int) { return nil, nil, nil } +func (tx *DummyBlobTx) setSignatureValues(chainID, v, r, s *big.Int) {} diff --git a/vendor/github.com/ethereum/go-ethereum/core/types/transaction.go b/vendor/github.com/ethereum/go-ethereum/core/types/transaction.go index 6315f1386..39fa2d969 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/types/transaction.go +++ b/vendor/github.com/ethereum/go-ethereum/core/types/transaction.go @@ -46,6 +46,7 @@ const ( LegacyTxType = iota AccessListTxType DynamicFeeTxType + BlobTxType = 0x3 ArbitrumDepositTxType = 100 ArbitrumUnsignedTxType = 101 ArbitrumContractTxType = 102 @@ -257,6 +258,9 @@ func (tx *Transaction) decodeTyped(b []byte, l2Parsing bool) (TxData, error) { var inner DynamicFeeTx err := rlp.DecodeBytes(b[1:], &inner) return &inner, err + case BlobTxType: + var inner DummyBlobTx + return &inner, nil default: return nil, ErrTxTypeNotSupported } diff --git a/vendor/github.com/ethereum/go-ethereum/core/types/transaction_marshalling.go b/vendor/github.com/ethereum/go-ethereum/core/types/transaction_marshalling.go index b73965e19..db669ca1d 100644 --- a/vendor/github.com/ethereum/go-ethereum/core/types/transaction_marshalling.go +++ b/vendor/github.com/ethereum/go-ethereum/core/types/transaction_marshalling.go @@ -692,6 +692,8 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { if dec.Nonce != nil { inner = &optimismDepositTxWithNonce{OptimismDepositTx: itx, EffectiveNonce: uint64(*dec.Nonce)} } + case BlobTxType: + inner = &DummyBlobTx{} default: return ErrTxTypeNotSupported } diff --git a/vendor/modules.txt b/vendor/modules.txt index 3f6a54d8b..b8f586112 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -211,7 +211,7 @@ github.com/edsrzf/mmap-go ## explicit; go 1.14 github.com/elastic/gosigar github.com/elastic/gosigar/sys/windows -# github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.11 +# github.com/ethereum/go-ethereum v1.10.26 => github.com/status-im/go-ethereum v1.10.25-status.13 ## explicit; go 1.17 github.com/ethereum/go-ethereum github.com/ethereum/go-ethereum/accounts