Skip to content

Commit

Permalink
Merge pull request ethereum#105 from status-im/fix/blob_tx_dummy_fix
Browse files Browse the repository at this point in the history
Add a dummy BlobTxType=0x3 implementation until go-ethereum rebased
  • Loading branch information
IvanBelyakoff committed Jan 30, 2024
1 parent adb7c40 commit 88568a4
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
28 changes: 28 additions & 0 deletions core/types/dummy_tx_blob.go
Original file line number Diff line number Diff line change
@@ -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) {}
4 changes: 4 additions & 0 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const (
LegacyTxType = iota
AccessListTxType
DynamicFeeTxType
BlobTxType = 0x3
ArbitrumDepositTxType = 100
ArbitrumUnsignedTxType = 101
ArbitrumContractTxType = 102
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 2 additions & 0 deletions core/types/transaction_marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 88568a4

Please sign in to comment.