Skip to content

Commit 37cbbe1

Browse files
committed
go.mod: upgrade dependencies
go-ethereum v1.13 no longer provides ethash mining, so this feature had to be removed from hivechain.
1 parent 2d06e4a commit 37cbbe1

File tree

4 files changed

+98
-875
lines changed

4 files changed

+98
-875
lines changed

cmd/hivechain/generate.go

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"github.com/ethereum/go-ethereum/core/vm"
2424
"github.com/ethereum/go-ethereum/crypto"
2525
"github.com/ethereum/go-ethereum/params"
26+
"github.com/ethereum/go-ethereum/trie"
2627
)
2728

2829
func init() {
@@ -51,7 +52,6 @@ type generatorConfig struct {
5152
blockCount int // number of generated pow blocks
5253
posBlockCount int // number of generated pos blocks
5354
blockTimeSec int // block time in seconds, influences difficulty
54-
powMode ethash.Mode
5555
genesis core.Genesis
5656
isPoS bool // true if the generator should create post pos blocks
5757
modifyBlock func(*types.Block) *types.Block // modify the block during exporting
@@ -165,7 +165,7 @@ func generateTx(txType int, key *ecdsa.PrivateKey, genesis *core.Genesis, gen *c
165165
tx = types.NewContractCreation(gen.TxNonce(src), new(big.Int), gas, gasprice, input)
166166
}
167167
// Sign the transaction.
168-
signer := types.MakeSigner(genesis.Config, gen.Number())
168+
signer := types.MakeSigner(genesis.Config, gen.Number(), gen.Timestamp())
169169
signedTx, err := types.SignTx(tx, signer, key)
170170
if err != nil {
171171
panic(err)
@@ -176,7 +176,7 @@ func generateTx(txType int, key *ecdsa.PrivateKey, genesis *core.Genesis, gen *c
176176
func createTxGasLimit(gen *core.BlockGen, genesis *core.Genesis, data []byte) uint64 {
177177
isHomestead := genesis.Config.IsHomestead(gen.Number())
178178
isEIP2028 := genesis.Config.IsIstanbul(gen.Number())
179-
isEIP3860 := genesis.Config.IsShanghai(gen.Timestamp())
179+
isEIP3860 := genesis.Config.IsShanghai(gen.Number(), gen.Timestamp())
180180
igas, err := core.IntrinsicGas(data, nil, true, isHomestead, isEIP2028, isEIP3860)
181181
if err != nil {
182182
panic(err)
@@ -187,16 +187,10 @@ func createTxGasLimit(gen *core.BlockGen, genesis *core.Genesis, data []byte) ui
187187
// generateAndSave produces a chain based on the config.
188188
func (cfg generatorConfig) generateAndSave(path string, blockModifier func(i int, gen *core.BlockGen)) error {
189189
db := rawdb.NewMemoryDatabase()
190-
genesis := cfg.genesis.MustCommit(db)
190+
triedb := trie.NewDatabase(db, trie.HashDefaults)
191+
genesis := cfg.genesis.MustCommit(db, triedb)
191192
config := cfg.genesis.Config
192-
ethashConf := ethash.Config{
193-
PowMode: cfg.powMode,
194-
CachesInMem: 2,
195-
DatasetsOnDisk: 2,
196-
DatasetDir: ethashDir(),
197-
}
198-
199-
powEngine := ethash.New(ethashConf, nil, false)
193+
powEngine := ethash.NewFaker()
200194
posEngine := beacon.New(powEngine)
201195
engine := instaSeal{posEngine}
202196

cmd/hivechain/main.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import (
2525
"io"
2626
"os"
2727

28-
"github.com/ethereum/go-ethereum/consensus/ethash"
2928
"github.com/ethereum/go-ethereum/core/types"
3029
ethlog "github.com/ethereum/go-ethereum/log"
3130
"github.com/ethereum/go-ethereum/rlp"
@@ -158,7 +157,6 @@ func generateCommand(args []string) {
158157
cfg generatorConfig
159158
genesis = flag.String("genesis", "", "The path and filename to the source genesis.json")
160159
outdir = flag.String("output", ".", "Chain destination folder")
161-
mine = flag.Bool("mine", false, "Enables ethash mining")
162160
pos = flag.Bool("pos", false, "Enables PoS chain")
163161
)
164162
flag.IntVar(&cfg.blockCount, "length", 2, "The length of the pow chain to generate")
@@ -171,12 +169,6 @@ func generateCommand(args []string) {
171169
if *genesis == "" {
172170
fatalf("Missing -genesis option, please supply a genesis.json file.")
173171
}
174-
if *mine {
175-
cfg.powMode = ethash.ModeNormal
176-
} else {
177-
cfg.powMode = ethash.ModeFullFake
178-
}
179-
180172
cfg.isPoS = *pos
181173

182174
gspec, err := loadGenesis(*genesis)

go.mod

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,62 @@ go 1.20
44

55
require (
66
github.com/davecgh/go-spew v1.1.1
7-
github.com/ethereum/go-ethereum v1.11.4
7+
github.com/ethereum/go-ethereum v1.13.1
88
github.com/ethereum/hive/hiveproxy v0.0.0-20230313101845-c7dfe88c8138
99
github.com/evanw/esbuild v0.18.11
10-
github.com/fsouza/go-dockerclient v1.8.1
10+
github.com/fsouza/go-dockerclient v1.9.8
1111
github.com/gorilla/mux v1.8.0
12-
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
13-
golang.org/x/net v0.7.0
12+
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad
13+
golang.org/x/net v0.10.0
1414
gopkg.in/inconshreveable/log15.v2 v2.0.0-20200109203555-b30bc20e4fd1
1515
gopkg.in/yaml.v3 v3.0.1
1616
)
1717

1818
require (
1919
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
2020
github.com/DataDog/zstd v1.5.2 // indirect
21-
github.com/Microsoft/go-winio v0.5.2 // indirect
22-
github.com/Microsoft/hcsshim v0.9.6 // indirect
21+
github.com/Microsoft/go-winio v0.6.1 // indirect
2322
github.com/VictoriaMetrics/fastcache v1.12.0 // indirect
2423
github.com/allegro/bigcache v1.2.1 // indirect
2524
github.com/beorn7/perks v1.0.1 // indirect
25+
github.com/bits-and-blooms/bitset v1.5.0 // indirect
2626
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
2727
github.com/cespare/xxhash/v2 v2.2.0 // indirect
2828
github.com/cockroachdb/errors v1.9.1 // indirect
2929
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
30-
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
30+
github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect
3131
github.com/cockroachdb/redact v1.1.3 // indirect
32-
github.com/containerd/cgroups v1.0.4 // indirect
32+
github.com/consensys/bavard v0.1.13 // indirect
33+
github.com/consensys/gnark-crypto v0.10.0 // indirect
3334
github.com/containerd/containerd v1.6.18 // indirect
35+
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
3436
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
3537
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
36-
github.com/docker/docker v20.10.17+incompatible // indirect
38+
github.com/docker/docker v24.0.5+incompatible // indirect
3739
github.com/docker/go-connections v0.4.0 // indirect
38-
github.com/docker/go-units v0.4.0 // indirect
39-
github.com/edsrzf/mmap-go v1.1.0 // indirect
40+
github.com/docker/go-units v0.5.0 // indirect
41+
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
4042
github.com/getsentry/sentry-go v0.18.0 // indirect
4143
github.com/go-ole/go-ole v1.2.6 // indirect
4244
github.com/go-stack/stack v1.8.1 // indirect
4345
github.com/gofrs/flock v0.8.1 // indirect
4446
github.com/gogo/protobuf v1.3.2 // indirect
45-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
4647
github.com/golang/protobuf v1.5.2 // indirect
47-
github.com/golang/snappy v0.0.4 // indirect
48+
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
4849
github.com/gorilla/websocket v1.5.0 // indirect
4950
github.com/hashicorp/yamux v0.1.1 // indirect
5051
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
51-
github.com/holiman/uint256 v1.2.1 // indirect
52+
github.com/holiman/uint256 v1.2.3 // indirect
5253
github.com/klauspost/compress v1.15.15 // indirect
5354
github.com/kr/pretty v0.3.1 // indirect
5455
github.com/kr/text v0.2.0 // indirect
5556
github.com/mattn/go-colorable v0.1.13 // indirect
5657
github.com/mattn/go-isatty v0.0.16 // indirect
5758
github.com/mattn/go-runewidth v0.0.14 // indirect
5859
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
59-
github.com/moby/sys/mount v0.3.3 // indirect
60-
github.com/moby/sys/mountinfo v0.6.2 // indirect
60+
github.com/mmcloughlin/addchain v0.4.0 // indirect
61+
github.com/moby/patternmatcher v0.6.0 // indirect
62+
github.com/moby/sys/sequential v0.5.0 // indirect
6163
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
6264
github.com/morikuni/aec v1.0.0 // indirect
6365
github.com/olekukonko/tablewriter v0.0.5 // indirect
@@ -73,16 +75,19 @@ require (
7375
github.com/rogpeppe/go-internal v1.9.0 // indirect
7476
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
7577
github.com/sirupsen/logrus v1.9.0 // indirect
78+
github.com/supranational/blst v0.3.11 // indirect
7679
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
77-
github.com/tklauser/go-sysconf v0.3.11 // indirect
78-
github.com/tklauser/numcpus v0.6.0 // indirect
80+
github.com/tklauser/go-sysconf v0.3.12 // indirect
81+
github.com/tklauser/numcpus v0.6.1 // indirect
7982
github.com/yusufpapurcu/wmi v1.2.2 // indirect
80-
go.opencensus.io v0.23.0 // indirect
81-
golang.org/x/crypto v0.4.0 // indirect
82-
golang.org/x/sys v0.5.0 // indirect
83-
golang.org/x/text v0.7.0 // indirect
83+
golang.org/x/crypto v0.12.0 // indirect
84+
golang.org/x/mod v0.11.0 // indirect
85+
golang.org/x/sync v0.3.0 // indirect
86+
golang.org/x/sys v0.11.0 // indirect
87+
golang.org/x/text v0.12.0 // indirect
88+
golang.org/x/tools v0.9.1 // indirect
8489
google.golang.org/protobuf v1.28.1 // indirect
85-
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
90+
rsc.io/tmplfunc v0.0.3 // indirect
8691
)
8792

8893
replace github.com/ethereum/hive/hiveproxy => ./hiveproxy

0 commit comments

Comments
 (0)