Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
51803557ef | ||
|
|
53b6694af0 |
@@ -112,12 +112,7 @@ require (
|
||||
rsc.io/tmplfunc v0.0.3 // indirect
|
||||
)
|
||||
|
||||
// replace github.com/cerc-io/plugeth-statediff => git.vdb.to/cerc-io/plugeth-statedff v0.1.5-0.20240403064423-ea73b611d9fd
|
||||
|
||||
// dev
|
||||
// replace github.com/cerc-io/ipfs-ethdb/v5 => git.vdb.to/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20240403094152-a95b1aea6c5c
|
||||
replace github.com/cerc-io/ipfs-ethdb/v5 => ../ipfs-ethdb
|
||||
|
||||
replace github.com/ethereum/go-ethereum => ../go-ethereum
|
||||
|
||||
replace github.com/cerc-io/plugeth-statediff => ../plugeth-statediff
|
||||
replace (
|
||||
github.com/cerc-io/ipfs-ethdb/v5 => github.com/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20240415102855-6df10f4dff16
|
||||
github.com/cerc-io/plugeth-statediff => github.com/cerc-io/plugeth-statediff v0.2.1-0.20240415132102-d94b880cb785
|
||||
)
|
||||
|
||||
@@ -20,6 +20,10 @@ github.com/cerc-io/eth-iterator-utils v0.2.0 h1:wikAfWZ0fAqLqUy/Ud/a1n9p/arVeKG8
|
||||
github.com/cerc-io/eth-iterator-utils v0.2.0/go.mod h1:wDUJvwKDSOdqTIyeG+yXJ2ckzc9f2Fem614fV61DBcg=
|
||||
github.com/cerc-io/eth-testing v0.4.0 h1:ivGbXnEqlXMt/3m3jbsPJaVT7ZDTenFQWCryt1Rd/Jk=
|
||||
github.com/cerc-io/eth-testing v0.4.0/go.mod h1:CVsmHjFldX9gwaQSQwGmKbmh0g6Dq+bsqB2CxBf9zbk=
|
||||
github.com/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20240415102855-6df10f4dff16 h1:o/JuiXZx93vrloupJ2U+sDofIA9CblFzUg6Jm1B3cdY=
|
||||
github.com/cerc-io/ipfs-ethdb/v5 v5.0.1-alpha.0.20240415102855-6df10f4dff16/go.mod h1:w5g07b6Uz+c6r/ySml58TEOJdUYAibYYF05H5ULVv2I=
|
||||
github.com/cerc-io/plugeth-statediff v0.2.1-0.20240415132102-d94b880cb785 h1:Mmaqrd+xhuo4/dSfHpJvK0YfIRgv+xYJPJqqonuoZlQ=
|
||||
github.com/cerc-io/plugeth-statediff v0.2.1-0.20240415132102-d94b880cb785/go.mod h1:Jle0lQ64GBMvoCPLLWvr0IOL3TUCS45yXZTuZ4tfSFU=
|
||||
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I=
|
||||
@@ -63,6 +67,8 @@ github.com/denisenkom/go-mssqldb v0.0.0-20191124224453-732737034ffd/go.mod h1:xb
|
||||
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a2zkGnVExMxdzMo3M0Hi/3sEU+cWnZpSni0O6/Yb/P0=
|
||||
github.com/ethereum/c-kzg-4844 v0.4.0 h1:3MS1s4JtA868KpJxroZoepdV0ZKBp3u/O5HcZ7R3nlY=
|
||||
github.com/ethereum/c-kzg-4844 v0.4.0/go.mod h1:VewdlzQmpT5QSrVhbBuGoCdFJkpaJlO1aQputP83wc0=
|
||||
github.com/ethereum/go-ethereum v1.13.14 h1:EwiY3FZP94derMCIam1iW4HFVrSgIcpsu0HwTQtm6CQ=
|
||||
github.com/ethereum/go-ethereum v1.13.14/go.mod h1:TN8ZiHrdJwSe8Cb6x+p0hs5CxhJZPbqB7hHkaUXcmIU=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
// Copyright 2023 The go-ethereum Authors
|
||||
// This file is part of the go-ethereum library.
|
||||
//
|
||||
// The go-ethereum library is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Lesser General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// The go-ethereum library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public License
|
||||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
package testutil
|
||||
|
||||
import (
|
||||
crand "crypto/rand"
|
||||
"encoding/binary"
|
||||
mrand "math/rand"
|
||||
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
|
||||
"github.com/cerc-io/ipld-eth-statedb/trie_by_cid/trie/trienode"
|
||||
)
|
||||
|
||||
// Prng is a pseudo random number generator seeded by strong randomness.
|
||||
// The randomness is printed on startup in order to make failures reproducible.
|
||||
var prng = initRand()
|
||||
|
||||
func initRand() *mrand.Rand {
|
||||
var seed [8]byte
|
||||
crand.Read(seed[:])
|
||||
rnd := mrand.New(mrand.NewSource(int64(binary.LittleEndian.Uint64(seed[:]))))
|
||||
return rnd
|
||||
}
|
||||
|
||||
// RandBytes generates a random byte slice with specified length.
|
||||
func RandBytes(n int) []byte {
|
||||
r := make([]byte, n)
|
||||
prng.Read(r)
|
||||
return r
|
||||
}
|
||||
|
||||
// RandomHash generates a random blob of data and returns it as a hash.
|
||||
func RandomHash() common.Hash {
|
||||
return common.BytesToHash(RandBytes(common.HashLength))
|
||||
}
|
||||
|
||||
// RandomAddress generates a random blob of data and returns it as an address.
|
||||
func RandomAddress() common.Address {
|
||||
return common.BytesToAddress(RandBytes(common.AddressLength))
|
||||
}
|
||||
|
||||
// RandomNode generates a random node.
|
||||
func RandomNode() *trienode.Node {
|
||||
val := RandBytes(100)
|
||||
return trienode.New(crypto.Keccak256Hash(val), val)
|
||||
}
|
||||
Reference in New Issue
Block a user