Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.3.7 #51

Merged
merged 16 commits into from
Aug 12, 2024
Merged
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/6874
)](https://pkg.go.dev/github.com/maticnetwork/bor)
[![Go Report Card](https://goreportcard.com/badge/github.com/maticnetwork/bor)](https://goreportcard.com/report/github.com/maticnetwork/bor)
![MIT License](https://img.shields.io/github/license/maticnetwork/bor)
[![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Polygon%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat-square)](https://discord.com/invite/0xPolygonDevs)
[![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Polygon%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat-square)](https://discord.gg/0xpolygon)
[![Twitter Follow](https://img.shields.io/twitter/follow/0xPolygon.svg?style=social)](https://twitter.com/0xPolygon)

### Installing bor using packaging
2 changes: 1 addition & 1 deletion accounts/keystore/account_cache_test.go
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ var (
}
)

// waitWatcherStarts waits up to 1s for the keystore watcher to start.
// waitWatcherStart waits up to 1s for the keystore watcher to start.
func waitWatcherStart(ks *KeyStore) bool {
// On systems where file watch is not supported, just return "ok".
if !ks.cache.watcher.enabled() {
4 changes: 2 additions & 2 deletions accounts/keystore/keystore_test.go
Original file line number Diff line number Diff line change
@@ -372,7 +372,7 @@ func TestWalletNotifications(t *testing.T) {
checkEvents(t, wantEvents, events)
}

// TestImportExport tests the import functionality of a keystore.
// TestImportECDSA tests the import functionality of a keystore.
func TestImportECDSA(t *testing.T) {
t.Parallel()
_, ks := tmpKeyStore(t, true)
@@ -395,7 +395,7 @@ func TestImportECDSA(t *testing.T) {
}
}

// TestImportECDSA tests the import and export functionality of a keystore.
// TestImportExport tests the import and export functionality of a keystore.
func TestImportExport(t *testing.T) {
t.Parallel()
_, ks := tmpKeyStore(t, true)
2 changes: 1 addition & 1 deletion core/txpool/legacypool/list_test.go
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ func TestFilterTxConditional(t *testing.T) {
// and add to the list.
tx2 := transaction(1, 1000, key)

var options types.OptionsAA4337
var options types.OptionsPIP15

options.KnownAccounts = types.KnownAccounts{
common.Address{19: 1}: &types.Value{
8 changes: 4 additions & 4 deletions core/types/block.go
Original file line number Diff line number Diff line change
@@ -189,8 +189,8 @@ func (h *Header) EmptyReceipts() bool {
return h.ReceiptHash == EmptyReceiptsHash
}

// ValidateBlockNumberOptions4337 validates the block range passed as in the options parameter in the conditional transaction (EIP-4337)
func (h *Header) ValidateBlockNumberOptions4337(minBlockNumber *big.Int, maxBlockNumber *big.Int) error {
// ValidateBlockNumberOptionsPIP15 validates the block range passed as in the options parameter in the conditional transaction (PIP-15)
func (h *Header) ValidateBlockNumberOptionsPIP15(minBlockNumber *big.Int, maxBlockNumber *big.Int) error {
currentBlockNumber := h.Number

if minBlockNumber != nil {
@@ -208,8 +208,8 @@ func (h *Header) ValidateBlockNumberOptions4337(minBlockNumber *big.Int, maxBloc
return nil
}

// ValidateBlockNumberOptions4337 validates the timestamp range passed as in the options parameter in the conditional transaction (EIP-4337)
func (h *Header) ValidateTimestampOptions4337(minTimestamp *uint64, maxTimestamp *uint64) error {
// ValidateBlockNumberOptionsPIP15 validates the timestamp range passed as in the options parameter in the conditional transaction (PIP-15)
func (h *Header) ValidateTimestampOptionsPIP15(minTimestamp *uint64, maxTimestamp *uint64) error {
currentBlockTime := h.Time

if minTimestamp != nil {
12 changes: 6 additions & 6 deletions core/types/block_test.go
Original file line number Diff line number Diff line change
@@ -435,7 +435,7 @@ func TestRlpDecodeParentHash(t *testing.T) {
}
}

func TestValidateBlockNumberOptions4337(t *testing.T) {
func TestValidateBlockNumberOptionsPIP15(t *testing.T) {
t.Parallel()

testsPass := []struct {
@@ -503,19 +503,19 @@ func TestValidateBlockNumberOptions4337(t *testing.T) {
}

for _, test := range testsPass {
if err := test.header.ValidateBlockNumberOptions4337(test.minBlockNumber, test.maxBlockNumber); err != nil {
if err := test.header.ValidateBlockNumberOptionsPIP15(test.minBlockNumber, test.maxBlockNumber); err != nil {
t.Fatalf("test number %v should not have failed. err: %v", test.number, err)
}
}

for _, test := range testsFail {
if err := test.header.ValidateBlockNumberOptions4337(test.minBlockNumber, test.maxBlockNumber); err == nil {
if err := test.header.ValidateBlockNumberOptionsPIP15(test.minBlockNumber, test.maxBlockNumber); err == nil {
t.Fatalf("test number %v should have failed. err is nil", test.number)
}
}
}

func TestValidateTimestampOptions4337(t *testing.T) {
func TestValidateTimestampOptionsPIP15(t *testing.T) {
t.Parallel()

u64Ptr := func(n uint64) *uint64 {
@@ -587,13 +587,13 @@ func TestValidateTimestampOptions4337(t *testing.T) {
}

for _, test := range testsPass {
if err := test.header.ValidateTimestampOptions4337(test.minTimestamp, test.maxTimestamp); err != nil {
if err := test.header.ValidateTimestampOptionsPIP15(test.minTimestamp, test.maxTimestamp); err != nil {
t.Fatalf("test number %v should not have failed. err: %v", test.number, err)
}
}

for _, test := range testsFail {
if err := test.header.ValidateTimestampOptions4337(test.minTimestamp, test.maxTimestamp); err == nil {
if err := test.header.ValidateTimestampOptionsPIP15(test.minTimestamp, test.maxTimestamp); err == nil {
t.Fatalf("test number %v should have failed. err is nil", test.number)
}
}
17 changes: 9 additions & 8 deletions core/types/transaction.go
Original file line number Diff line number Diff line change
@@ -56,8 +56,9 @@ type Transaction struct {
inner TxData // Consensus contents of a transaction
time time.Time // Time first seen locally (spam avoidance)

// knownAccounts (EIP-4337)
optionsAA4337 *OptionsAA4337
// BOR specific - DO NOT REMOVE
// knownAccounts (PIP-15)
optionsPIP15 *OptionsPIP15

// caches
hash atomic.Value
@@ -105,14 +106,14 @@ type TxData interface {
decode([]byte) error
}

// PutOptions stores the optionsAA4337 field of the conditional transaction (EIP-4337)
func (tx *Transaction) PutOptions(options *OptionsAA4337) {
tx.optionsAA4337 = options
// PutOptions stores the optionsPIP15 field of the conditional transaction (PIP-15)
func (tx *Transaction) PutOptions(options *OptionsPIP15) {
tx.optionsPIP15 = options
}

// GetOptions returns the optionsAA4337 field of the conditional transaction (EIP-4337)
func (tx *Transaction) GetOptions() *OptionsAA4337 {
return tx.optionsAA4337
// GetOptions returns the optionsPIP15 field of the conditional transaction (PIP-15)
func (tx *Transaction) GetOptions() *OptionsPIP15 {
return tx.optionsPIP15
}

// EncodeRLP implements rlp.Encoder
2 changes: 1 addition & 1 deletion core/types/transaction_conditional.go
Original file line number Diff line number Diff line change
@@ -112,7 +112,7 @@ func InsertKnownAccounts[T common.Hash | map[common.Hash]common.Hash](accounts K
}
}

type OptionsAA4337 struct {
type OptionsPIP15 struct {
KnownAccounts KnownAccounts `json:"knownAccounts"`
BlockNumberMin *big.Int `json:"blockNumberMin"`
BlockNumberMax *big.Int `json:"blockNumberMax"`
9 changes: 7 additions & 2 deletions eth/protocols/eth/broadcast.go
Original file line number Diff line number Diff line change
@@ -80,7 +80,11 @@ func (p *Peer) broadcastTransactions() {
size common.StorageSize
)
for i := 0; i < len(queue) && size < maxTxPacketSize; i++ {
if tx := p.txpool.Get(queue[i]); tx != nil {
tx := p.txpool.Get(queue[i])

// BOR specific - DO NOT REMOVE
// Skip PIP-15 bundled transactions
if tx != nil && tx.GetOptions() == nil {
txs = append(txs, tx)
size += common.StorageSize(tx.Size())
}
@@ -151,7 +155,8 @@ func (p *Peer) announceTransactions() {
)
for count = 0; count < len(queue) && size < maxTxPacketSize; count++ {
tx := p.txpool.Get(queue[count])
// Skip EIP-4337 bundled transactions
// BOR specific - DO NOT REMOVE
// Skip PIP-15 bundled transactions
if tx != nil && tx.GetOptions() == nil {
pending = append(pending, queue[count])
pendingTypes = append(pendingTypes, tx.Type())
6 changes: 3 additions & 3 deletions internal/ethapi/bor_api.go
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ func NewBorAPI(b Backend) *BorAPI {

// SendRawTransactionConditional will add the signed transaction to the transaction pool.
// The sender/bundler is responsible for signing the transaction
func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexutil.Bytes, options types.OptionsAA4337) (common.Hash, error) {
func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexutil.Bytes, options types.OptionsPIP15) (common.Hash, error) {
tx := new(types.Transaction)
if err := tx.UnmarshalBinary(input); err != nil {
return common.Hash{}, err
@@ -81,12 +81,12 @@ func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexu
}

// check block number range
if err := currentHeader.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil {
if err := currentHeader.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
return common.Hash{}, &rpc.OptionsValidateError{Message: "out of block range. err: " + err.Error()}
}

// check timestamp range
if err := currentHeader.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil {
if err := currentHeader.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
return common.Hash{}, &rpc.OptionsValidateError{Message: "out of time range. err: " + err.Error()}
}

4 changes: 2 additions & 2 deletions miner/test_backend.go
Original file line number Diff line number Diff line change
@@ -601,14 +601,14 @@ mainloop:
// not prioritising conditional transaction, yet.
//nolint:nestif
if options := tx.GetOptions(); options != nil {
if err := env.header.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil {
if err := env.header.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop()

continue
}

if err := env.header.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil {
if err := env.header.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop()

4 changes: 2 additions & 2 deletions miner/worker.go
Original file line number Diff line number Diff line change
@@ -1023,14 +1023,14 @@ mainloop:
// not prioritising conditional transaction, yet.
//nolint:nestif
if options := tx.GetOptions(); options != nil {
if err := env.header.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil {
if err := env.header.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop()

continue
}

if err := env.header.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil {
if err := env.header.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop()

2 changes: 2 additions & 0 deletions p2p/discover/table.go
Original file line number Diff line number Diff line change
@@ -458,7 +458,9 @@ func (tab *Table) loadSeedNodes() {
addr, _ := seed.UDPEndpoint()
tab.log.Trace("Found seed node in database", "id", seed.ID(), "addr", addr, "age", age)
}
tab.mutex.Lock()
tab.handleAddNode(addNodeOp{node: seed, isInbound: false})
tab.mutex.Unlock()
}
}

5 changes: 5 additions & 0 deletions p2p/discover/v4_udp.go
Original file line number Diff line number Diff line change
@@ -600,6 +600,11 @@ func (t *UDPv4) readLoop(unhandled chan<- ReadPacket) {
}

func (t *UDPv4) handlePacket(from netip.AddrPort, buf []byte) error {
// Unwrap IPv4-in-6 source address.
if from.Addr().Is4In6() {
from = netip.AddrPortFrom(netip.AddrFrom4(from.Addr().As4()), from.Port())
}

rawpacket, fromKey, hash, err := v4wire.Decode(buf)
if err != nil {
t.log.Debug("Bad discv4 packet", "addr", from, "err", err)
4 changes: 4 additions & 0 deletions p2p/discover/v5_udp.go
Original file line number Diff line number Diff line change
@@ -725,6 +725,10 @@ func (t *UDPv5) readLoop() {

// dispatchReadPacket sends a packet into the dispatch loop.
func (t *UDPv5) dispatchReadPacket(from netip.AddrPort, content []byte) bool {
// Unwrap IPv4-in-6 source address.
if from.Addr().Is4In6() {
from = netip.AddrPortFrom(netip.AddrFrom4(from.Addr().As4()), from.Port())
}
select {
case t.packetInCh <- ReadPacket{content, from}:
return true
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.amd64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.validator
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: bor-profile
Version: 1.3.6
Version: 1.3.7
Section: develop
Priority: standard
Maintainer: Polygon <[email protected]>
2 changes: 1 addition & 1 deletion params/version.go
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@ import (
const (
VersionMajor = 1 // Major version component of the current release
VersionMinor = 3 // Minor version component of the current release
VersionPatch = 6 // Patch version component of the current release
VersionPatch = 7 // Patch version component of the current release
VersionMeta = "" // Version metadata to append to the version string
)