Skip to content

Commit

Permalink
Merge branch 'ethereum:master' into portal
Browse files Browse the repository at this point in the history
  • Loading branch information
GrapeBaBa authored Apr 2, 2024
2 parents fae68d0 + 0bd03db commit a66e1aa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions eth/filters/filter_system.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func NewFilterSystem(backend Backend, config Config) *FilterSystem {

type logCacheElem struct {
logs []*types.Log
body atomic.Value
body atomic.Pointer[types.Body]
}

// cachedLogElem loads block logs from the backend and caches the result.
Expand Down Expand Up @@ -133,7 +133,7 @@ func (sys *FilterSystem) cachedLogElem(ctx context.Context, blockHash common.Has

func (sys *FilterSystem) cachedGetBody(ctx context.Context, elem *logCacheElem, hash common.Hash, number uint64) (*types.Body, error) {
if body := elem.body.Load(); body != nil {
return body.(*types.Body), nil
return body, nil
}
body, err := sys.backend.GetBody(ctx, hash, rpc.BlockNumber(number))
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion log/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ func writeTimeTermFormat(buf *bytes.Buffer, t time.Time) {

// writePosIntWidth writes non-negative integer i to the buffer, padded on the left
// by zeroes to the given width. Use a width of 0 to omit padding.
// Adapted from golang.org/x/exp/slog/internal/buffer/buffer.go
// Adapted from pkg.go.dev/log/slog/internal/buffer
func writePosIntWidth(b *bytes.Buffer, i, width int) {
// Cheap integer to fixed-width decimal ASCII.
// Copied from log/log.go.
Expand Down
6 changes: 2 additions & 4 deletions rlp/typecache.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package rlp

import (
"fmt"
"maps"
"reflect"
"sync"
"sync/atomic"
Expand Down Expand Up @@ -90,10 +91,7 @@ func (c *typeCache) generate(typ reflect.Type, tags rlpstruct.Tags) *typeinfo {
}

// Copy cur to next.
c.next = make(map[typekey]*typeinfo, len(cur)+1)
for k, v := range cur {
c.next[k] = v
}
c.next = maps.Clone(cur)

// Generate.
info := c.infoWhileGenerating(typ, tags)
Expand Down
8 changes: 5 additions & 3 deletions rpc/ipc_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ import (
"net"
"os"
"path/filepath"
"syscall"

"github.com/ethereum/go-ethereum/log"
)

const (
// On Linux, sun_path is 108 bytes in size
// see http://man7.org/linux/man-pages/man7/unix.7.html
maxPathSize = int(108)
// The limit of unix domain socket path diverse between OS, on Darwin it's 104 bytes
// but on Linux it's 108 byte, so we should depend on syscall.RawSockaddrUnix's
// definition dynamically
maxPathSize = len(syscall.RawSockaddrUnix{}.Path)
)

// ipcListen will create a Unix socket on the given endpoint.
Expand Down

0 comments on commit a66e1aa

Please sign in to comment.