rename protocol version from eth71 to eth72

This commit is contained in:
healthykim 2026-04-11 18:22:27 +09:00
parent daee525741
commit f6657afa3b
12 changed files with 21 additions and 21 deletions

View file

@ -130,7 +130,7 @@ type blobTxMeta struct {
id uint64 // Storage ID in the pool's persistent store
storageSize uint32 // Byte size in the pool's persistent store
size uint64 // RLP-encoded size of transaction including the attached blob
sizeWithoutBlob uint64 // RLP-encoded size of transaction without blob data (for ETH/71)
sizeWithoutBlob uint64 // RLP-encoded size of transaction without blob data (for ETH/72)
custody *types.CustodyBitmap
@ -1500,7 +1500,7 @@ func (p *BlobPool) getRLP(hash common.Hash) []byte {
// - (1) Store them separately on disk, tracking both IDs.
// - (2) Keep transactions in memory and store cells on disk.
//
// However, this approach does not fit well with eth71 peers, since blobs
// However, this approach does not fit well with eth72 peers, since blobs
// must be included in that case. It may require decoding and re-encoding,
// as well as double disk I/O each time.
func (p *BlobPool) Get(hash common.Hash, includeBlob bool) *types.Transaction {

View file

@ -67,7 +67,7 @@ func NewBlobBuffer(addToPool func(*PooledBlobTx) error, dropPeer func(string)) *
}
}
// AddTx buffers a blob transaction (without blobs) from an ETH/71 peer.
// AddTx buffers a blob transaction (without blobs) from an ETH/72 peer.
// If cells are already buffered, verification and pool insertion are attempted.
func (b *BlobBuffer) AddTx(tx *types.Transaction, peer string) error {
b.evict()

View file

@ -13,7 +13,7 @@ import (
)
// makeV1Tx creates a V1 blob transaction with cell proofs, then strips blobs
// (simulating what ETH/71 peers send).
// (simulating what ETH/72 peers send).
func makeV1Tx(t *testing.T, nonce uint64, blobCount int, blobOffset int, key *ecdsa.PrivateKey) *types.Transaction {
t.Helper()
tx := makeMultiBlobTx(nonce, 1, 1, 1, blobCount, blobOffset, key, types.BlobSidecarVersion1)

View file

@ -24,7 +24,7 @@ import (
type txMetadata struct {
id uint64 // the billy id of transction
size uint64 // the RLP encoded size of transaction (blobs are included)
sizeWithoutBlob uint64 // the RLP encoded size without blob data (for ETH/71 announcements)
sizeWithoutBlob uint64 // the RLP encoded size without blob data (for ETH/72 announcements)
custody types.CustodyBitmap
}

View file

@ -88,7 +88,7 @@ type PendingFilter struct {
type TxMetadata struct {
Type uint8 // The type of the transaction
Size uint64 // The length of the 'rlp encoding' of a transaction (including blobs)
SizeWithoutBlob uint64 // The length without blob data (for ETH/71 announcements)
SizeWithoutBlob uint64 // The length without blob data (for ETH/72 announcements)
}
// SubPool represents a specialized transaction pool that lives on its own (e.g.
@ -133,7 +133,7 @@ type SubPool interface {
Get(hash common.Hash, includeBlob bool) *types.Transaction
// GetRLP returns a RLP-encoded transaction if it is contained in the pool.
// If includeBlob is false, blob data is stripped from blob transactions (ETH/71).
// If includeBlob is false, blob data is stripped from blob transactions (ETH/72).
GetRLP(hash common.Hash, includeBlob bool) []byte
// GetMetadata returns the transaction type and transaction size with the

View file

@ -200,12 +200,12 @@ func newHandler(config *handlerConfig) (*handler, error) {
addTxs := func(peer string, txs []*types.Transaction) []error {
errs := make([]error, len(txs))
p := h.peers.peer(peer)
isETH71 := p != nil && p.Version() >= eth.ETH71
isETH72 := p != nil && p.Version() >= eth.ETH72
var poolTxs []*types.Transaction
var index []int
for i, tx := range txs {
if isETH71 && tx.Type() == types.BlobTxType {
if isETH72 && tx.Type() == types.BlobTxType {
errs[i] = h.blobBuffer.AddTx(tx, peer)
} else {
poolTxs = append(poolTxs, tx)

View file

@ -113,9 +113,9 @@ func handleTransactions(peer *eth.Peer, list []*types.Transaction, directBroadca
// If we receive any blob transactions missing sidecars, or with
// sidecars that don't correspond to the versioned hashes reported
// in the header, disconnect from the sending peer.
if peer.Version() >= eth.ETH71 {
if peer.Version() >= eth.ETH72 {
if tx.BlobTxSidecar() != nil && len(tx.BlobTxSidecar().Blobs) != 0 {
return fmt.Errorf("not allowed to respond with full-blob transaction under eth71")
return fmt.Errorf("not allowed to respond with full-blob transaction under eth72")
}
} else {
if tx.BlobTxSidecar() == nil {

View file

@ -133,7 +133,7 @@ func (p *Peer) announceTransactions() {
}
pending = append(pending, queue[count])
pendingTypes = append(pendingTypes, meta.Type)
if p.version >= ETH71 && meta.SizeWithoutBlob > 0 {
if p.version >= ETH72 && meta.SizeWithoutBlob > 0 {
pendingSizes = append(pendingSizes, uint32(meta.SizeWithoutBlob))
} else {
pendingSizes = append(pendingSizes, uint32(meta.Size))

View file

@ -194,7 +194,7 @@ var eth69 = map[uint64]msgHandler{
BlockRangeUpdateMsg: handleBlockRangeUpdate,
}
var eth71 = map[uint64]msgHandler{
var eth72 = map[uint64]msgHandler{
TransactionsMsg: handleTransactions,
NewPooledTransactionHashesMsg: handleNewPooledTransactionHashes71,
GetBlockHeadersMsg: handleGetBlockHeaders,
@ -227,8 +227,8 @@ func handleMessage(backend Backend, peer *Peer) error {
switch peer.version {
case ETH69:
handlers = eth69
case ETH71:
handlers = eth71
case ETH72:
handlers = eth72
default:
return fmt.Errorf("unknown eth protocol version: %v", peer.version)
}

View file

@ -523,7 +523,7 @@ func handleGetPooledTransactions(backend Backend, msg Decoder, peer *Peer) error
if err := msg.Decode(&query); err != nil {
return err
}
hashes, txs := answerGetPooledTransactions(backend, query.GetPooledTransactionsRequest, peer.version < ETH71)
hashes, txs := answerGetPooledTransactions(backend, query.GetPooledTransactionsRequest, peer.version < ETH72)
return peer.ReplyPooledTransactionsRLP(query.RequestId, hashes, txs)
}

View file

@ -172,7 +172,7 @@ func (p *Peer) AsyncSendTransactions(hashes []common.Hash) {
func (p *Peer) sendPooledTransactionHashes(hashes []common.Hash, types []byte, sizes []uint32, cells types.CustodyBitmap) error {
// Mark all the transactions as known, but ensure we don't overflow our limits
p.knownTxs.Add(hashes...)
if p.version >= ETH71 {
if p.version >= ETH72 {
return p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket71{Types: types, Sizes: sizes, Hashes: hashes, Mask: cells})
}
return p2p.Send(p.rw, NewPooledTransactionHashesMsg, NewPooledTransactionHashesPacket70{Types: types, Sizes: sizes, Hashes: hashes})

View file

@ -31,7 +31,7 @@ import (
// Constants to match up protocol versions and messages
const (
ETH69 = 69
ETH71 = 71
ETH72 = 72
)
// ProtocolName is the official short name of the `eth` protocol used during
@ -40,11 +40,11 @@ const ProtocolName = "eth"
// ProtocolVersions are the supported versions of the `eth` protocol (first
// is primary).
var ProtocolVersions = []uint{ETH71, ETH69}
var ProtocolVersions = []uint{ETH72, ETH69}
// protocolLengths are the number of implemented message corresponding to
// different protocol versions.
var protocolLengths = map[uint]uint64{ETH69: 18, ETH71: 20}
var protocolLengths = map[uint]uint64{ETH69: 18, ETH72: 20}
// maxMessageSize is the maximum cap on the size of a protocol message.
const maxMessageSize = 10 * 1024 * 1024
@ -241,7 +241,7 @@ type NewPooledTransactionHashesPacket70 struct {
Hashes []common.Hash
}
// NewPooledTransactionHashesPacket71 represents a transaction announcement packet on eth/71
// NewPooledTransactionHashesPacket71 represents a transaction announcement packet on ETH/72
// with an additional custody bitmap field for cell-based blob data availability.
type NewPooledTransactionHashesPacket71 struct {
Types []byte