merge master branch and fix conflict

This commit is contained in:
maskpp 2024-09-15 06:28:05 +08:00
commit d77bc61c41
5 changed files with 98 additions and 11 deletions

View file

@ -300,14 +300,14 @@ const (
GasChangeCallStorageColdAccess GasChangeReason = 13 GasChangeCallStorageColdAccess GasChangeReason = 13
// GasChangeCallFailedExecution is the burning of the remaining gas when the execution failed without a revert. // GasChangeCallFailedExecution is the burning of the remaining gas when the execution failed without a revert.
GasChangeCallFailedExecution GasChangeReason = 14 GasChangeCallFailedExecution GasChangeReason = 14
// GasChangeWitnessContractInit is the amount charged for adding to the witness during the contract creation initialization step // GasChangeWitnessContractInit flags the event of of adding to the witness during the contract creation initialization step
GasChangeWitnessContractInit GasChangeReason = 15 GasChangeWitnessContractInit GasChangeReason = 15
// GasChangeWitnessContractCreation is the amount charged for adding to the witness during the contract creation finalization step // GasChangeWitnessContractCreation flags the event of adding to the witness during the contract creation finalization step
GasChangeWitnessContractCreation GasChangeReason = 16 GasChangeWitnessContractCreation GasChangeReason = 16
// GasChangeWitnessCodeChunk is the amount charged for touching one or more contract code chunks // GasChangeWitnessCodeChunk flags the event of adding one or more contract code chunks to the witness
GasChangeWitnessCodeChunk GasChangeReason = 17 GasChangeWitnessCodeChunk GasChangeReason = 17
// GasChangeWitnessContractCollisionCheck the amount charged for checking a contract collision // GasChangeWitnessContractCollisionCheck flags the event of adding to the witness when checking for contract address collision
GasChangeWitnessContractCollisionCheck GasChangeReason = 17 GasChangeWitnessContractCollisionCheck GasChangeReason = 18
// GasChangeIgnored is a special value that can be used to indicate that the gas change should be ignored as // GasChangeIgnored is a special value that can be used to indicate that the gas change should be ignored as
// it will be "manually" tracked by a direct emit of the gas change event. // it will be "manually" tracked by a direct emit of the gas change event.

View file

@ -566,7 +566,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6
ids []uint64 ids []uint64
nonces []uint64 nonces []uint64
) )
for ; len(txs) > 0 && txs[0].nonce < next; txs = txs[1:] { for len(txs) > 0 && txs[0].nonce < next {
ids = append(ids, txs[0].id) ids = append(ids, txs[0].id)
nonces = append(nonces, txs[0].nonce) nonces = append(nonces, txs[0].nonce)
@ -578,6 +578,7 @@ func (p *BlobPool) recheck(addr common.Address, inclusions map[common.Hash]uint6
if inclusions != nil { if inclusions != nil {
p.offload(addr, txs[0].nonce, txs[0].id, inclusions) p.offload(addr, txs[0].nonce, txs[0].id, inclusions)
} }
txs = txs[1:]
} }
log.Trace("Dropping overlapped blob transactions", "from", addr, "overlapped", nonces, "ids", ids, "left", len(txs)) log.Trace("Dropping overlapped blob transactions", "from", addr, "overlapped", nonces, "ids", ids, "left", len(txs))
dropOverlappedMeter.Mark(int64(len(ids))) dropOverlappedMeter.Mark(int64(len(ids)))

View file

@ -200,6 +200,20 @@ func (n *Node) TCPEndpoint() (netip.AddrPort, bool) {
return netip.AddrPortFrom(n.ip, n.tcp), true return netip.AddrPortFrom(n.ip, n.tcp), true
} }
// QUICEndpoint returns the announced QUIC endpoint.
func (n *Node) QUICEndpoint() (netip.AddrPort, bool) {
var quic uint16
if n.ip.Is4() || n.ip.Is4In6() {
n.Load((*enr.QUIC)(&quic))
} else if n.ip.Is6() {
n.Load((*enr.QUIC6)(&quic))
}
if !n.ip.IsValid() || n.ip.IsUnspecified() || quic == 0 {
return netip.AddrPort{}, false
}
return netip.AddrPortFrom(n.ip, quic), true
}
// Pubkey returns the secp256k1 public key of the node, if present. // Pubkey returns the secp256k1 public key of the node, if present.
func (n *Node) Pubkey() *ecdsa.PublicKey { func (n *Node) Pubkey() *ecdsa.PublicKey {
var key ecdsa.PublicKey var key ecdsa.PublicKey

View file

@ -68,11 +68,12 @@ func TestPythonInterop(t *testing.T) {
func TestNodeEndpoints(t *testing.T) { func TestNodeEndpoints(t *testing.T) {
id := HexID("00000000000000806ad9b61fa5ae014307ebdc964253adcd9f2c0a392aa11abc") id := HexID("00000000000000806ad9b61fa5ae014307ebdc964253adcd9f2c0a392aa11abc")
type endpointTest struct { type endpointTest struct {
name string name string
node *Node node *Node
wantIP netip.Addr wantIP netip.Addr
wantUDP int wantUDP int
wantTCP int wantTCP int
wantQUIC int
} }
tests := []endpointTest{ tests := []endpointTest{
{ {
@ -98,6 +99,22 @@ func TestNodeEndpoints(t *testing.T) {
return SignNull(&r, id) return SignNull(&r, id)
}(), }(),
}, },
{
name: "quic-only",
node: func() *Node {
var r enr.Record
r.Set(enr.QUIC(9000))
return SignNull(&r, id)
}(),
},
{
name: "quic6-only",
node: func() *Node {
var r enr.Record
r.Set(enr.QUIC6(9000))
return SignNull(&r, id)
}(),
},
{ {
name: "ipv4-only-loopback", name: "ipv4-only-loopback",
node: func() *Node { node: func() *Node {
@ -209,6 +226,48 @@ func TestNodeEndpoints(t *testing.T) {
wantIP: netip.MustParseAddr("192.168.2.2"), wantIP: netip.MustParseAddr("192.168.2.2"),
wantUDP: 30304, wantUDP: 30304,
}, },
{
name: "ipv4-quic",
node: func() *Node {
var r enr.Record
r.Set(enr.IPv4Addr(netip.MustParseAddr("99.22.33.1")))
r.Set(enr.QUIC(9001))
return SignNull(&r, id)
}(),
wantIP: netip.MustParseAddr("99.22.33.1"),
wantQUIC: 9001,
},
{ // Because the node is IPv4, the quic6 entry won't be loaded.
name: "ipv4-quic6",
node: func() *Node {
var r enr.Record
r.Set(enr.IPv4Addr(netip.MustParseAddr("99.22.33.1")))
r.Set(enr.QUIC6(9001))
return SignNull(&r, id)
}(),
wantIP: netip.MustParseAddr("99.22.33.1"),
},
{
name: "ipv6-quic",
node: func() *Node {
var r enr.Record
r.Set(enr.IPv6Addr(netip.MustParseAddr("2001::ff00:0042:8329")))
r.Set(enr.QUIC(9001))
return SignNull(&r, id)
}(),
wantIP: netip.MustParseAddr("2001::ff00:0042:8329"),
},
{
name: "ipv6-quic6",
node: func() *Node {
var r enr.Record
r.Set(enr.IPv6Addr(netip.MustParseAddr("2001::ff00:0042:8329")))
r.Set(enr.QUIC6(9001))
return SignNull(&r, id)
}(),
wantIP: netip.MustParseAddr("2001::ff00:0042:8329"),
wantQUIC: 9001,
},
} }
for _, test := range tests { for _, test := range tests {
@ -222,6 +281,9 @@ func TestNodeEndpoints(t *testing.T) {
if test.wantTCP != test.node.TCP() { if test.wantTCP != test.node.TCP() {
t.Errorf("node has wrong TCP port %d, want %d", test.node.TCP(), test.wantTCP) t.Errorf("node has wrong TCP port %d, want %d", test.node.TCP(), test.wantTCP)
} }
if quic, _ := test.node.QUICEndpoint(); test.wantQUIC != int(quic.Port()) {
t.Errorf("node has wrong QUIC port %d, want %d", quic.Port(), test.wantQUIC)
}
}) })
} }
} }

View file

@ -77,6 +77,16 @@ type UDP6 uint16
func (v UDP6) ENRKey() string { return "udp6" } func (v UDP6) ENRKey() string { return "udp6" }
// QUIC is the "quic" key, which holds the QUIC port of the node.
type QUIC uint16
func (v QUIC) ENRKey() string { return "quic" }
// QUIC6 is the "quic6" key, which holds the IPv6-specific quic6 port of the node.
type QUIC6 uint16
func (v QUIC6) ENRKey() string { return "quic6" }
// ID is the "id" key, which holds the name of the identity scheme. // ID is the "id" key, which holds the name of the identity scheme.
type ID string type ID string