Skip to content

Commit 7dba16c

Browse files
MariusVanDerWijdenlightclient
authored andcommitted
all: 4844 devnet 6 integration
1 parent cde462c commit 7dba16c

File tree

20 files changed

+281
-22
lines changed

20 files changed

+281
-22
lines changed

consensus/beacon/consensus.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,14 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
379379
return nil, errors.New("withdrawals set before Shanghai activation")
380380
}
381381
}
382+
if chain.Config().IsCancun(header.Number, header.Time) {
383+
var blobs int
384+
for _, tx := range txs {
385+
blobs += len(tx.BlobHashes())
386+
}
387+
blobGasUsed := uint64(blobs * params.BlobTxBlobGasPerBlob)
388+
header.BlobGasUsed = &blobGasUsed
389+
}
382390
// Finalize and assemble the block.
383391
beacon.Finalize(chain, header, state, txs, uncles, withdrawals)
384392

consensus/misc/eip4844/eip4844_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ func TestCalcExcessBlobGas(t *testing.T) {
4545
// The excess blob gas should decrease by however much the target was
4646
// under-shot, capped at zero.
4747
{params.BlobTxTargetBlobGasPerBlock, params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob, params.BlobTxTargetBlobGasPerBlock},
48-
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, params.BlobTxBlobGasPerBlob},
49-
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 2, 0},
48+
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, 2 * params.BlobTxBlobGasPerBlob},
49+
{params.BlobTxTargetBlobGasPerBlock, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 2, params.BlobTxBlobGasPerBlob},
5050
{params.BlobTxBlobGasPerBlob - 1, (params.BlobTxTargetBlobGasPerBlock / params.BlobTxBlobGasPerBlob) - 1, 0},
5151
}
5252
for _, tt := range tests {
@@ -64,8 +64,9 @@ func TestCalcBlobFee(t *testing.T) {
6464
}{
6565
{0, 1},
6666
{1542706, 1},
67-
{1542707, 2},
68-
{10 * 1024 * 1024, 111},
67+
{1542707, 1},
68+
{3085414, 2},
69+
{10 * 1024 * 1024, 23},
6970
}
7071
for i, tt := range tests {
7172
have := CalcBlobFee(tt.excessBlobGas)

core/genesis.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,14 @@ func (g *Genesis) ToBlock() *types.Block {
496496
}
497497
}
498498
}
499+
if g.Config != nil && g.Config.IsCancun(big.NewInt(int64(g.Number)), g.Timestamp) {
500+
if g.ExcessBlobGas == nil {
501+
var excessBlobGas uint64
502+
head.ExcessBlobGas = &excessBlobGas
503+
} else {
504+
head.ExcessBlobGas = g.ExcessBlobGas
505+
}
506+
}
499507
return types.NewBlock(head, nil, nil, nil, trie.NewStackTrie(nil)).WithWithdrawals(withdrawals)
500508
}
501509

core/txpool/blobpool/blobpool.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@ func (p *BlobPool) reinject(addr common.Address, txhash common.Hash) {
954954
}
955955
p.lookup[meta.hash] = meta.id
956956
p.stored += uint64(meta.size)
957+
958+
p.eventFeed.Send(core.NewTxsEvent{Txs: types.Transactions{tx}})
957959
}
958960

959961
// SetGasTip implements txpool.SubPool, allowing the blob pool's gas requirements
@@ -1036,7 +1038,6 @@ func (p *BlobPool) validateTx(tx *types.Transaction) error {
10361038
// Ensure the transaction adheres to the stateful pool filters (nonce, balance)
10371039
stateOpts := &txpool.ValidationOptionsWithState{
10381040
State: p.state,
1039-
10401041
FirstNonceGap: func(addr common.Address) uint64 {
10411042
// Nonce gaps are not permitted in the blob pool, the first gap will
10421043
// be the next nonce shifted by however many transactions we already
@@ -1297,6 +1298,7 @@ func (p *BlobPool) add(tx *types.Transaction) (err error) {
12971298
}
12981299
p.updateStorageMetrics()
12991300

1301+
p.eventFeed.Send(core.NewTxsEvent{Txs: types.Transactions{tx}})
13001302
return nil
13011303
}
13021304

core/txpool/blobpool/slotter_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ func TestNewSlotter(t *testing.T) {
4646
10*blobSize + txAvgSize, // 1-4 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
4747
11*blobSize + txAvgSize, // 1-4 blobs + unexpectedly large tx infos < 4 blobs + max tx metadata size
4848
12*blobSize + txAvgSize, // 1-4 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
49+
13*blobSize + txAvgSize, // 1-4 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
50+
14*blobSize + txAvgSize, // 1-4 blobs + unexpectedly large tx infos >= 4 blobs + max tx metadata size
4951
}
5052
if len(shelves) != len(want) {
5153
t.Errorf("shelves count mismatch: have %d, want %d", len(shelves), len(want))

core/types/types_test.go

Lines changed: 57 additions & 1 deletion
Large diffs are not rendered by default.

eth/fetcher/tx_fetcher_test.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1287,7 +1287,11 @@ func testTransactionFetcher(t *testing.T, tt txFetcherTest) {
12871287
}
12881288

12891289
case doTxEnqueue:
1290-
if err := fetcher.Enqueue(step.peer, step.txs, step.direct); err != nil {
1290+
var txs []*types.BlobTxWithBlobs
1291+
for _, tx := range step.txs {
1292+
txs = append(txs, types.NewBlobTxWithBlobs(tx, nil, nil, nil))
1293+
}
1294+
if err := fetcher.Enqueue(step.peer, txs, step.direct); err != nil {
12911295
t.Errorf("step %d: %v", i, err)
12921296
}
12931297
<-wait // Fetcher needs to process this, wait until it's done

eth/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ func (h *handler) BroadcastTransactions(txs types.Transactions) {
625625
peers := h.peers.peersWithoutTransaction(tx.Hash())
626626

627627
var numDirect int
628-
if tx.Size() <= txMaxBroadcastSize {
628+
if tx.Size() <= txMaxBroadcastSize && tx.Type() != types.BlobTxType {
629629
numDirect = int(math.Sqrt(float64(len(peers))))
630630
}
631631
// Send the tx unconditionally to a subset of our peers

eth/handler_eth_test.go

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ import (
3030
"github.com/ethereum/go-ethereum/core/rawdb"
3131
"github.com/ethereum/go-ethereum/core/types"
3232
"github.com/ethereum/go-ethereum/core/vm"
33+
"github.com/ethereum/go-ethereum/crypto/kzg4844"
3334
"github.com/ethereum/go-ethereum/eth/downloader"
3435
"github.com/ethereum/go-ethereum/eth/protocols/eth"
3536
"github.com/ethereum/go-ethereum/event"
3637
"github.com/ethereum/go-ethereum/p2p"
3738
"github.com/ethereum/go-ethereum/p2p/enode"
3839
"github.com/ethereum/go-ethereum/params"
40+
"github.com/holiman/uint256"
3941
)
4042

4143
// testEthHandler is a mock event handler to listen for inbound network requests
@@ -71,7 +73,11 @@ func (h *testEthHandler) Handle(peer *eth.Peer, packet eth.Packet) error {
7173
return nil
7274

7375
case *eth.PooledTransactionsPacket:
74-
h.txBroadcasts.Send(([]*types.Transaction)(*packet))
76+
var txs []*types.Transaction
77+
for _, tx := range *packet {
78+
txs = append(txs, tx.Transaction)
79+
}
80+
h.txBroadcasts.Send(txs)
7581
return nil
7682

7783
default:
@@ -454,6 +460,87 @@ func testTransactionPropagation(t *testing.T, protocol uint) {
454460
}
455461
}
456462

463+
func TestBlobTransactionPropagation68(t *testing.T) { testBlobTransactionPropagation(t, eth.ETH68) }
464+
465+
func testBlobTransactionPropagation(t *testing.T, protocol uint) {
466+
t.Parallel()
467+
468+
// Create a source handler to send transactions from and a number of sinks
469+
// to receive them. We need multiple sinks since a one-to-one peering would
470+
// broadcast all transactions without announcement.
471+
source := newTestHandler()
472+
source.handler.snapSync.Store(false) // Avoid requiring snap, otherwise some will be dropped below
473+
defer source.close()
474+
475+
sinks := make([]*testHandler, 10)
476+
for i := 0; i < len(sinks); i++ {
477+
sinks[i] = newTestHandler()
478+
defer sinks[i].close()
479+
480+
sinks[i].handler.acceptTxs.Store(true) // mark synced to accept transactions
481+
}
482+
// Interconnect all the sink handlers with the source handler
483+
for i, sink := range sinks {
484+
sink := sink // Closure for gorotuine below
485+
486+
sourcePipe, sinkPipe := p2p.MsgPipe()
487+
defer sourcePipe.Close()
488+
defer sinkPipe.Close()
489+
490+
sourcePeer := eth.NewPeer(protocol, p2p.NewPeerPipe(enode.ID{byte(i + 1)}, "", nil, sourcePipe), sourcePipe, source.txpool)
491+
sinkPeer := eth.NewPeer(protocol, p2p.NewPeerPipe(enode.ID{0}, "", nil, sinkPipe), sinkPipe, sink.txpool)
492+
defer sourcePeer.Close()
493+
defer sinkPeer.Close()
494+
495+
go source.handler.runEthPeer(sourcePeer, func(peer *eth.Peer) error {
496+
return eth.Handle((*ethHandler)(source.handler), peer)
497+
})
498+
go sink.handler.runEthPeer(sinkPeer, func(peer *eth.Peer) error {
499+
return eth.Handle((*ethHandler)(sink.handler), peer)
500+
})
501+
}
502+
// Subscribe to all the transaction pools
503+
txChs := make([]chan core.NewTxsEvent, len(sinks))
504+
for i := 0; i < len(sinks); i++ {
505+
txChs[i] = make(chan core.NewTxsEvent, 1024)
506+
507+
sub := sinks[i].txpool.SubscribeNewTxsEvent(txChs[i])
508+
defer sub.Unsubscribe()
509+
}
510+
// Fill the source pool with transactions and wait for them at the sinks
511+
txs := make([]*txpool.Transaction, 1024)
512+
for nonce := range txs {
513+
tx := types.NewTx(&types.BlobTx{
514+
Nonce: uint64(nonce),
515+
To: common.Address{},
516+
GasTipCap: uint256.NewInt(0),
517+
GasFeeCap: uint256.NewInt(0),
518+
Gas: 100000,
519+
Value: uint256.NewInt(0),
520+
BlobHashes: make([]common.Hash, 1),
521+
ChainID: uint256.NewInt(0),
522+
Data: nil,
523+
})
524+
tx, _ = types.SignTx(tx, types.NewCancunSigner(common.Big0), testKey)
525+
526+
txs[nonce] = &txpool.Transaction{Tx: tx, BlobTxBlobs: make([]kzg4844.Blob, 1), BlobTxCommits: make([]kzg4844.Commitment, 1), BlobTxProofs: make([]kzg4844.Proof, 1)}
527+
}
528+
source.txpool.Add(txs, false, false)
529+
530+
// Iterate through all the sinks and ensure they all got the transactions
531+
for i := range sinks {
532+
for arrived, timeout := 0, false; arrived < len(txs) && !timeout; {
533+
select {
534+
case event := <-txChs[i]:
535+
arrived += len(event.Txs)
536+
case <-time.After(2 * time.Second):
537+
t.Errorf("sink %d: transaction propagation timed out: have %d, want %d", i, arrived, len(txs))
538+
timeout = true
539+
}
540+
}
541+
}
542+
}
543+
457544
// Tests that blocks are broadcast to a sqrt number of peers only.
458545
func TestBroadcastBlock1Peer(t *testing.T) { testBroadcastBlock(t, 1, 1) }
459546
func TestBroadcastBlock2Peers(t *testing.T) { testBroadcastBlock(t, 2, 1) }

eth/protocols/eth/broadcast.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ func (p *Peer) broadcastTransactions() {
8080
size common.StorageSize
8181
)
8282
for i := 0; i < len(queue) && size < maxTxPacketSize; i++ {
83+
// Do not broadcast blob transactions
8384
if tx := p.txpool.Get(queue[i]); tx != nil {
8485
txs = append(txs, tx)
8586
size += common.StorageSize(tx.Size())

eth/protocols/eth/handler_test.go

Lines changed: 69 additions & 0 deletions
Large diffs are not rendered by default.

eth/protocols/eth/protocol_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ func TestEth66EmptyMessages(t *testing.T) {
108108
ReceiptsPacket66{1111, ReceiptsPacket([][]*types.Receipt{})},
109109
// Transactions
110110
GetPooledTransactionsPacket66{1111, GetPooledTransactionsPacket([]common.Hash{})},
111-
PooledTransactionsPacket66{1111, PooledTransactionsPacket([]*types.Transaction{})},
111+
PooledTransactionsPacket66{1111, PooledTransactionsPacket([]*types.BlobTxWithBlobs{})},
112112
PooledTransactionsRLPPacket66{1111, PooledTransactionsRLPPacket([]rlp.RawValue{})},
113113
} {
114114
if have, _ := rlp.EncodeToBytes(msg); !bytes.Equal(have, want) {
@@ -125,6 +125,7 @@ func TestEth66Messages(t *testing.T) {
125125
blockBody *BlockBody
126126
blockBodyRlp rlp.RawValue
127127
txs []*types.Transaction
128+
poolTxs []*types.BlobTxWithBlobs
128129
txRlps []rlp.RawValue
129130
hashes []common.Hash
130131
receipts []*types.Receipt
@@ -153,6 +154,7 @@ func TestEth66Messages(t *testing.T) {
153154
}
154155
txs = append(txs, tx)
155156
txRlps = append(txRlps, rlpdata)
157+
poolTxs = append(poolTxs, types.NewBlobTxWithBlobs(tx, nil, nil, nil))
156158
}
157159
}
158160
// init the block body data, both object and rlp form
@@ -251,7 +253,7 @@ func TestEth66Messages(t *testing.T) {
251253
common.FromHex("f847820457f842a000000000000000000000000000000000000000000000000000000000deadc0dea000000000000000000000000000000000000000000000000000000000feedbeef"),
252254
},
253255
{
254-
PooledTransactionsPacket66{1111, PooledTransactionsPacket(txs)},
256+
PooledTransactionsPacket66{1111, PooledTransactionsPacket(poolTxs)},
255257
common.FromHex("f8d7820457f8d2f867088504a817c8088302e2489435353535353535353535353535353535353535358202008025a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c12a064b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10f867098504a817c809830334509435353535353535353535353535353535353535358202d98025a052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afba052f8f61201b2b11a78d6e866abc9c3db2ae8631fa656bfe5cb53668255367afb"),
256258
},
257259
{

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHH
8888
github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
8989
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80 h1:DuBDHVjgGMPki7bAyh91+3cF1Vh34sAEdH8JQgbc2R0=
9090
github.com/crate-crypto/go-ipa v0.0.0-20230601170251-1830d0757c80/go.mod h1:gzbVz57IDJgQ9rLQwfSk696JGWof8ftznEL9GoAv3NI=
91+
github.com/crate-crypto/go-kzg-4844 v0.2.0 h1:UVuHOE+5tIWrim4zf/Xaa43+MIsDCPyW76QhUpiMGj4=
92+
github.com/crate-crypto/go-kzg-4844 v0.2.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4=
9193
github.com/crate-crypto/go-kzg-4844 v0.3.0 h1:UBlWE0CgyFqqzTI+IFyCzA7A3Zw4iip6uzRv5NIXG0A=
9294
github.com/crate-crypto/go-kzg-4844 v0.3.0/go.mod h1:SBP7ikXEgDnUPONgm33HtuDZEDtWa3L4QtN1ocJSEQ4=
9395
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=

graphql/graphql.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1310,8 +1310,7 @@ func (r *Resolver) SendRawTransaction(ctx context.Context, args struct{ Data hex
13101310
if err := tx.UnmarshalBinary(args.Data); err != nil {
13111311
return common.Hash{}, err
13121312
}
1313-
hash, err := ethapi.SubmitTransaction(ctx, r.backend, tx)
1314-
return hash, err
1313+
return ethapi.SubmitTransaction(ctx, r.backend, tx)
13151314
}
13161315

13171316
// FilterCriteria encapsulates the arguments to `logs` on the root resolver object.

internal/ethapi/api.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
18581858
if err := b.SendTx(ctx, tx); err != nil {
18591859
return common.Hash{}, err
18601860
}
1861+
18611862
// Print a log with full tx details for manual investigations and interventions
18621863
head := b.CurrentBlock()
18631864
signer := types.MakeSigner(b.ChainConfig(), head.Number, head.Time)
@@ -1928,6 +1929,9 @@ func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionAr
19281929
// The sender is responsible for signing the transaction and using the correct nonce.
19291930
func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error) {
19301931
tx := new(types.Transaction)
1932+
if len(input) < 1 {
1933+
return common.Hash{}, errors.New("input to short")
1934+
}
19311935
if err := tx.UnmarshalBinary(input); err != nil {
19321936
return common.Hash{}, err
19331937
}

internal/ethapi/api_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import (
4343
"github.com/ethereum/go-ethereum/core/types"
4444
"github.com/ethereum/go-ethereum/core/vm"
4545
"github.com/ethereum/go-ethereum/crypto"
46+
"github.com/ethereum/go-ethereum/crypto/kzg4844"
4647
"github.com/ethereum/go-ethereum/ethdb"
4748
"github.com/ethereum/go-ethereum/event"
4849
"github.com/ethereum/go-ethereum/internal/blocktest"
@@ -560,6 +561,9 @@ func (b testBackend) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) even
560561
func (b testBackend) SendTx(ctx context.Context, signedTx *types.Transaction) error {
561562
panic("implement me")
562563
}
564+
func (b testBackend) SendBlobTx(ctx context.Context, signedTx *types.Transaction, blobTxBlobs []kzg4844.Blob, blobTxCommits []kzg4844.Commitment, blobTxProofs []kzg4844.Proof) error {
565+
panic("implement me")
566+
}
563567
func (b testBackend) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) {
564568
tx, blockHash, blockNumber, index := rawdb.ReadTransaction(b.db, txHash)
565569
return tx, blockHash, blockNumber, index, nil

internal/ethapi/backend.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ type Backend interface {
7575

7676
// Transaction pool API
7777
SendTx(ctx context.Context, signedTx *types.Transaction) error
78+
7879
GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error)
7980
GetPoolTransactions() (types.Transactions, error)
8081
GetPoolTransaction(txHash common.Hash) *types.Transaction

internal/ethapi/transaction_args_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import (
3434
"github.com/ethereum/go-ethereum/core/state"
3535
"github.com/ethereum/go-ethereum/core/types"
3636
"github.com/ethereum/go-ethereum/core/vm"
37+
"github.com/ethereum/go-ethereum/crypto/kzg4844"
3738
"github.com/ethereum/go-ethereum/ethdb"
3839
"github.com/ethereum/go-ethereum/event"
3940
"github.com/ethereum/go-ethereum/params"
@@ -316,6 +317,9 @@ func (b *backendMock) SubscribeChainSideEvent(ch chan<- core.ChainSideEvent) eve
316317
return nil
317318
}
318319
func (b *backendMock) SendTx(ctx context.Context, signedTx *types.Transaction) error { return nil }
320+
func (b *backendMock) SendBlobTx(ctx context.Context, signedTx *types.Transaction, blobTxBlobs []kzg4844.Blob, blobTxCommits []kzg4844.Commitment, blobTxProofs []kzg4844.Proof) error {
321+
return nil
322+
}
319323
func (b *backendMock) GetTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, common.Hash, uint64, uint64, error) {
320324
return nil, [32]byte{}, 0, 0, nil
321325
}

les/api_backend.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"github.com/ethereum/go-ethereum/core/state"
3333
"github.com/ethereum/go-ethereum/core/types"
3434
"github.com/ethereum/go-ethereum/core/vm"
35+
"github.com/ethereum/go-ethereum/crypto/kzg4844"
3536
"github.com/ethereum/go-ethereum/eth/gasprice"
3637
"github.com/ethereum/go-ethereum/eth/tracers"
3738
"github.com/ethereum/go-ethereum/ethdb"
@@ -199,6 +200,10 @@ func (b *LesApiBackend) SendTx(ctx context.Context, signedTx *types.Transaction)
199200
return b.eth.txPool.Add(ctx, signedTx)
200201
}
201202

203+
func (b *LesApiBackend) SendBlobTx(ctx context.Context, signedTx *types.Transaction, blobTxBlobs []kzg4844.Blob, blobTxCommits []kzg4844.Commitment, blobTxProofs []kzg4844.Proof) error {
204+
return errors.New("blob transactions not implemented on LES")
205+
}
206+
202207
func (b *LesApiBackend) RemoveTx(txHash common.Hash) {
203208
b.eth.txPool.RemoveTx(txHash)
204209
}

params/protocol_params.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,15 @@ const (
164164
RefundQuotient uint64 = 2
165165
RefundQuotientEIP3529 uint64 = 5
166166

167-
BlobTxBytesPerFieldElement = 32 // Size in bytes of a field element
168-
BlobTxFieldElementsPerBlob = 4096 // Number of field elements stored in a single data blob
169-
BlobTxHashVersion = 0x01 // Version byte of the commitment hash
170-
MaxBlobGasPerBlock = 1 << 19 // Maximum consumable blob gas for data blobs per block
171-
BlobTxTargetBlobGasPerBlock = 1 << 18 // Target consumable blob gas for data blobs per block (for 1559-like pricing)
172-
BlobTxBlobGasPerBlob = 1 << 17 // Gas consumption of a single data blob (== blob byte size)
173-
BlobTxMinBlobGasprice = 1 // Minimum gas price for data blobs
174-
BlobTxBlobGaspriceUpdateFraction = 2225652 // Controls the maximum rate of change for blob gas price
175-
BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile.
167+
BlobTxBytesPerFieldElement = 32 // Size in bytes of a field element
168+
BlobTxFieldElementsPerBlob = 4096 // Number of field elements stored in a single data blob
169+
BlobTxHashVersion = 0x01 // Version byte of the commitment hash
170+
BlobTxBlobGasPerBlob = 1 << 17 // Gas consumption of a single data blob (== blob byte size)
171+
MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block
172+
BlobTxTargetBlobGasPerBlock = 3 * BlobTxBlobGasPerBlob // Target consumable data gas for data blobs per block (for 1559-like pricing)
173+
BlobTxMinBlobGasprice = 1 // Minimum gas price for data blobs
174+
BlobTxBlobGaspriceUpdateFraction = 3338477 // Controls the maximum rate of change for data gas price
175+
BlobTxPointEvaluationPrecompileGas = 50000 // Gas price for the point evaluation precompile.
176176
)
177177

178178
// Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations

0 commit comments

Comments
 (0)