Skip to content
Open
Show file tree
Hide file tree
Changes from all 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 cmd/es-node/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ func getDifficulty(ctx context.Context, client *ethclient.Client, contract commo
return res[1].(*big.Int), nil
}

func getMiningInfo(ctx context.Context, client *ethclient.Client, contract common.Address, shardIdx uint64) ([]interface{}, error) {
func getMiningInfo(ctx context.Context, client *ethclient.Client, contract common.Address, shardIdx uint64) ([]any, error) {
uint256Type, _ := abi.NewType("uint256", "", nil)
dataField, _ := abi.Arguments{{Type: uint256Type}}.Pack(new(big.Int).SetUint64(shardIdx))
h := crypto.Keccak256Hash([]byte(`infos(uint256)`))
Expand Down
3 changes: 1 addition & 2 deletions ethstorage/p2p/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ var DefaultBootnodes = []*enode.Node{
enode.MustParse("enr:-J24QKTMozsV7vECSF7pqLAefTlVuMzWemnxIcdvsyIpfxWdFJxQs2Z7GnflniDpjeM_xjUpPO7gmsx6hOOIhHvnqimGAYfi6xtbimV0aHN0b3JhZ2XAgmlkgnY0gmlwhMCoAQKJc2VjcDI1NmsxoQN-8fpPc95ilMsRoMs1cRCi-s8kQrsT_cciktg_cUsuNYN0Y3CCJAaDdWRwgnZh"),
}

type P2pSetupConfig interface {
}
type P2pSetupConfig any

type GossipSetupConfigurables interface {
PeerScoringParams() *pubsub.PeerScoreParams
Expand Down
4 changes: 1 addition & 3 deletions ethstorage/p2p/gossip.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ const (
var MessageDomainInvalidSnappy = [4]byte{0, 0, 0, 0}
var MessageDomainValidSnappy = [4]byte{1, 0, 0, 0}

type GossipIn interface {
// OnUnsafeL2Payload(ctx context.Context, from peer.ID, msg *eth.ExecutionPayload) error
}
type GossipIn any

// TODO:
func blocksTopicV1(chainID *big.Int) string {
Expand Down
4 changes: 2 additions & 2 deletions ethstorage/p2p/protocol/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func ReadMsg(stream network.Stream) ([]byte, byte, error) {
return payload, code, err
}

func Send(stream network.Stream, req interface{}) (network.Stream, error) {
func Send(stream network.Stream, req any) (network.Stream, error) {
data, err := rlp.EncodeToBytes(req)
if err != nil {
return nil, err
Expand All @@ -105,7 +105,7 @@ func Send(stream network.Stream, req interface{}) (network.Stream, error) {
return stream, err
}

func SendRPC(stream network.Stream, req interface{}, resp interface{}) (byte, error) {
func SendRPC(stream network.Stream, req any, resp any) (byte, error) {
s, err := Send(stream, req)
if err != nil {
return clientError, err
Expand Down
14 changes: 7 additions & 7 deletions ethstorage/pora/ethash/ethash.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,24 @@ func memoryMapAndGenerate(path string, size uint64, lock bool, generator func(bu
// LRU tracks caches or datasets by their last use time, keeping at most N of them.
type LRU struct {
what string
new func(epoch uint64) interface{}
new func(epoch uint64) any
mu sync.Mutex
// Items are kept in a LRU cache, but there is a special case:
// We always keep an item for (highest seen epoch) + 1 as the 'future item'.
cache *simplelru.LRU
future uint64
futureItem interface{}
futureItem any
lg log.Logger
}

// NewLRU create a new least-recently-used cache for either the verification caches
// or the mining datasets.
func NewLRU(what string, maxItems int, new func(epoch uint64) interface{}) *LRU {
func NewLRU(what string, maxItems int, new func(epoch uint64) any) *LRU {
if maxItems <= 0 {
maxItems = 1
}
lg := log.New("LRU")
cache, _ := simplelru.NewLRU(maxItems, func(key, value interface{}) {
cache, _ := simplelru.NewLRU(maxItems, func(key, value any) {
lg.Trace("Evicted ethash "+what, "epoch", key)
})
return &LRU{what: what, new: new, cache: cache, lg: lg}
Expand All @@ -175,7 +175,7 @@ func NewLRU(what string, maxItems int, new func(epoch uint64) interface{}) *LRU
// Get retrieves or creates an item for the given epoch. The first return value is always
// non-nil. The second return value is non-nil if lru thinks that an item will be useful in
// the near future.
func (lru *LRU) Get(epoch uint64) (item, future interface{}) {
func (lru *LRU) Get(epoch uint64) (item, future any) {
lru.mu.Lock()
defer lru.mu.Unlock()

Expand Down Expand Up @@ -211,7 +211,7 @@ type Cache struct {

// NewCache creates a new ethash verification cache and returns it as a plain Go
// interface to be usable in an LRU cache.
func NewCache(epoch uint64) interface{} {
func NewCache(epoch uint64) any {
return &Cache{epoch: epoch}
}

Expand Down Expand Up @@ -288,7 +288,7 @@ type dataset struct {

// newDataset creates a new ethash mining dataset and returns it as a plain Go
// interface to be usable in an LRU cache.
func newDataset(epoch uint64) interface{} {
func newDataset(epoch uint64) any {
return &dataset{epoch: epoch}
}

Expand Down
2 changes: 1 addition & 1 deletion ethstorage/prover/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func readProof(proofRaw []byte) ([]byte, error) {
if err != nil {
return nil, err
}
values := []interface{}{[]*big.Int{a.X, a.Y}, [][]*big.Int{b.X[:], b.Y[:]}, []*big.Int{c.X, c.Y}}
values := []any{[]*big.Int{a.X, a.Y}, [][]*big.Int{b.X[:], b.Y[:]}, []*big.Int{c.X, c.Y}}
packed, err := args.Pack(values...)
if err != nil {
return nil, fmt.Errorf("%v, values: %v", err, values)
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/kzg_prover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func uploadBlob(t *testing.T, data []byte) common.Hash {
{Type: uint256Type},
{Type: uint256Type},
}
values := []interface{}{blbKey, blbIdx, length}
values := []any{blbKey, blbIdx, length}
dataField, err := args.Pack(values...)
if err != nil {
t.Fatalf("Error getting calldata: %v", err)
Expand Down Expand Up @@ -175,7 +175,7 @@ func verifyInclusive(sampleIdx uint64, peInput []byte) error {
{Type: uint256Type},
{Type: bytesType},
}
values := []interface{}{dataHash, index, decodedData, peInput}
values := []any{dataHash, index, decodedData, peInput}
dataField, err := args.Pack(values...)
if err != nil {
return err
Expand Down
4 changes: 2 additions & 2 deletions integration_tests/zk_prover2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func TestZKProver_GenerateZKProof(t *testing.T) {
t.Errorf("ZKProver.GenerateInputs() error = %v", err)
return
}
var inputs map[string]interface{}
var inputs map[string]any
err = json.Unmarshal(inputsBytes, &inputs)
if err != nil {
t.Errorf("ZKProver.GenerateInputs() error = %v", err)
return
}
vxIn, ok := inputs["xIn"].([]interface{})
vxIn, ok := inputs["xIn"].([]any)
if !ok {
t.Errorf("ZKProver.GenerateInputs() type: %v, want []interface{}", reflect.TypeOf(inputs["xIn"]))
return
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/zk_prover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestZKProver_GenerateZKProofPerSample(t *testing.T) {
t.Errorf("ZKProver.GenerateInput() error = %v", err)
return
}
var inputs map[string]interface{}
var inputs map[string]any
err = json.Unmarshal(inputBytes, &inputs)
if err != nil {
t.Errorf("ZKProver.GenerateInput() error = %v", err)
Expand Down