Skip to content

Commit

Permalink
Support holesky
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdee committed Sep 28, 2023
1 parent abf1f86 commit 28d50d8
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 81 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Alternatively you can use a private key directly with the `--privatekey` option,

Ethereal supports all main Ethereum networks It auto-detects the network by querying the connected node for the network ID. The connection should be geth-compatible, so either geth itself or parity with the `--geth` flag to enable geth compatibility mode. The connection could be a local node or a network service such as Infura.

Ethereal contains default connections via Infura to most major networks that can be defined by the `--network` argument. Supported neworks are mainnet, goerli, and sepolia. Alternatively a connection to a custom node can be created using the `--connection` argument. For example a local IPC node might use `--connection=/home/ethereum/.ethereum/geth.ipc` or `--connection=http://localhost:8545/`
Ethereal contains default connections via Infura to most major networks that can be defined by the `--network` argument. Supported neworks are mainnet, goerli, sepolia and holesky. Alternatively a connection to a custom node can be created using the `--connection` argument. For example a local IPC node might use `--connection=/home/ethereum/.ethereum/geth.ipc` or `--connection=http://localhost:8545/`

**The Infura key for Ethereal is shared among all users. If you are going to carry out a lot of queries of chain data please either use a local node or your own Infura account.**

Expand Down
6 changes: 5 additions & 1 deletion cli/wallet.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 Weald Technology Trading Limited
// Copyright 2017 - 2023 Weald Technology Trading Limited
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -91,6 +91,8 @@ func obtainGethWallet(chainID *big.Int, address common.Address) (accounts.Wallet
keydir = filepath.Join(keydir, "goerli")
case chainID.Cmp(params.SepoliaChainConfig.ChainID) == 0:
keydir = filepath.Join(keydir, "sepolia")
case chainID.Cmp(params.HoleskyChainConfig.ChainID) == 0:
keydir = filepath.Join(keydir, "holesky")
}
keydir = filepath.Join(keydir, "keystore")
backends := []accounts.Backend{keystore.NewKeyStore(keydir, keystore.StandardScryptN, keystore.StandardScryptP)}
Expand All @@ -110,6 +112,8 @@ func obtainGethWallets(chainID *big.Int, debug bool) ([]accounts.Wallet, error)
keydir = filepath.Join(keydir, "goerli")
case chainID.Cmp(params.SepoliaChainConfig.ChainID) == 0:
keydir = filepath.Join(keydir, "sepolia")
case chainID.Cmp(params.HoleskyChainConfig.ChainID) == 0:
keydir = filepath.Join(keydir, "holesky")
}
keydir = filepath.Join(keydir, "keystore")
if debug {
Expand Down
26 changes: 10 additions & 16 deletions cmd/beacondeposit.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
var depositABI = `[{"inputs":[{"internalType":"bytes","name":"pubkey","type":"bytes"},{"internalType":"bytes","name":"withdrawal_credentials","type":"bytes"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bytes32","name":"deposit_data_root","type":"bytes32"}],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"}]`

var (
beaconDepositDebug bool
beaconDepositData string
beaconDepositFrom string
beaconDepositAllowOldData bool
Expand Down Expand Up @@ -78,14 +79,6 @@ var beaconDepositKnownContracts = []*beaconDepositContract{
maxVersion: 4,
subgraph: "attestantio/eth2deposits",
},
{
network: "Ropsten",
chainID: big.NewInt(3),
address: util.MustDecodeHexString("0x6f22fFbC56eFF051aECF839396DD1eD9aD6BBA9D"),
forkVersion: []byte{0x80, 0x00, 0x00, 0x69},
minVersion: 3,
maxVersion: 4,
},
{
network: "Prater",
chainID: big.NewInt(5),
Expand All @@ -95,14 +88,6 @@ var beaconDepositKnownContracts = []*beaconDepositContract{
maxVersion: 4,
subgraph: "attestantio/eth2deposits-prater",
},
{
network: "Kiln",
chainID: big.NewInt(1337802),
address: util.MustDecodeHexString("0x4242424242424242424242424242424242424242"),
forkVersion: []byte{0x70, 0x00, 0x00, 0x69},
minVersion: 3,
maxVersion: 4,
},
{
network: "Sepolia",
chainID: big.NewInt(11155111),
Expand All @@ -111,6 +96,14 @@ var beaconDepositKnownContracts = []*beaconDepositContract{
minVersion: 3,
maxVersion: 4,
},
{
network: "Holesky",
chainID: big.NewInt(17000),
address: util.MustDecodeHexString("0x4242424242424242424242424242424242424242"),
forkVersion: []byte{0x01, 0x01, 0x70, 0x00},
minVersion: 3,
maxVersion: 4,
},
}

// beaconDepositCmd represents the beacon deposit command.
Expand Down Expand Up @@ -459,6 +452,7 @@ If you are sure you want to send to this address you can add --allow-unknown-con
func init() {
beaconCmd.AddCommand(beaconDepositCmd)
beaconFlags(beaconDepositCmd)
beaconDepositCmd.Flags().BoolVar(&beaconDepositDebug, "debug", false, "Debug output")
beaconDepositCmd.Flags().StringVar(&beaconDepositData, "data", "", "The data for the deposit, provided by ethdo or a similar command")
beaconDepositCmd.Flags().StringVar(&beaconDepositFrom, "from", "", "The account from which to send the deposit")
beaconDepositCmd.Flags().BoolVar(&beaconDepositAllowUnknownContract, "allow-unknown-contract", false, "Allow sending to a contract address that is unknown by Ethereal (WARNING: only if you know what you are doing)")
Expand Down
8 changes: 4 additions & 4 deletions cmd/root.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2017-2022 Weald Technology Trading
// Copyright © 2017-2023 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -196,12 +196,12 @@ func connectionAddress(_ context.Context) (string, error) {
switch strings.ToLower(viper.GetString("network")) {
case "mainnet":
return "https://mainnet.infura.io/v3/831a5442dc2e4536a9f8dee4ea1707a6", nil
case "ropsten":
return "https://ropsten.infura.io/v3/831a5442dc2e4536a9f8dee4ea1707a6", nil
case "goerli", "gorli", "görli":
return "https://goerli.infura.io/v3/831a5442dc2e4536a9f8dee4ea1707a6", nil
case "sepolia":
return "https://sepolia.infura.io/v3/831a5442dc2e4536a9f8dee4ea1707a6", nil
case "holesky":
return "https://holesky.infura.io/v3/831a5442dc2e4536a9f8dee4ea1707a6", nil
default:
return "", fmt.Errorf("unknown network %s", viper.GetString("network"))
}
Expand Down Expand Up @@ -322,7 +322,7 @@ func init() {
if err := viper.BindPFlag("connection", RootCmd.PersistentFlags().Lookup("connection")); err != nil {
panic(err)
}
RootCmd.PersistentFlags().String("network", "mainnet", "network to access (mainnet/ropsten/kovan/goerli/sepolia) (overridden by connection option)")
RootCmd.PersistentFlags().String("network", "mainnet", "network to access (mainnet/goerli/sepolia/holesky) (overridden by connection option)")
if err := viper.BindPFlag("network", RootCmd.PersistentFlags().Lookup("network")); err != nil {
panic(err)
}
Expand Down
22 changes: 5 additions & 17 deletions conn/conn.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2022 Weald Technology Trading
// Copyright © 2022, 2023 Weald Technology Trading
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
Expand Down Expand Up @@ -71,19 +71,6 @@ func New(ctx context.Context, url string) (*Conn, error) {
return nil, errors.New("unable to contact client")
}

// var config *params.ChainConfig
// switch {
// case chainID.Cmp(params.MainnetChainConfig.ChainID) == 0:
// config = params.MainnetChainConfig
// case chainID.Cmp(params.RopstenChainConfig.ChainID) == 0:
// config = params.RopstenChainConfig
// case chainID.Cmp(params.SepoliaChainConfig.ChainID) == 0:
// config = params.SepoliaChainConfig
// case chainID.Cmp(params.GoerliChainConfig.ChainID) == 0:
// config = params.GoerliChainConfig
// default:
// }

timeout := viper.GetDuration("timeout")
if timeout == 0 {
return nil, errors.New("timeout not specified")
Expand All @@ -93,9 +80,8 @@ func New(ctx context.Context, url string) (*Conn, error) {
timeout: timeout,
rpcClient: rpcClient,
client: client,
// config: config,
chainID: chainID,
nonces: make(map[common.Address]uint64),
chainID: chainID,
nonces: make(map[common.Address]uint64),
}

return conn, nil
Expand All @@ -113,6 +99,8 @@ func newOffline(_ context.Context) (*Conn, error) {
chainID = params.GoerliChainConfig.ChainID
case "sepolia":
chainID = params.SepoliaChainConfig.ChainID
case "holesky":
chainID = params.HoleskyChainConfig.ChainID
default:
switch {
case strings.HasPrefix(viper.GetString("chainid"), "0x"):
Expand Down
25 changes: 13 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ go 1.20
require (
github.com/antlr4-go/antlr/v4 v4.13.0
github.com/attestantio/go-execution-client v0.8.6
github.com/ethereum/go-ethereum v1.13.0
github.com/ethereum/go-ethereum v1.13.2
github.com/miekg/dns v1.1.56
github.com/mitchellh/go-homedir v1.1.0
github.com/pborman/uuid v1.2.1
github.com/pkg/errors v0.9.1
github.com/rs/zerolog v1.30.0
github.com/rs/zerolog v1.31.0
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
Expand All @@ -31,22 +31,23 @@ require (
github.com/Microsoft/go-winio v0.6.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.1 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/bits-and-blooms/bitset v1.9.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cockroachdb/errors v1.11.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230906160148-46873a6a7a06 // indirect
github.com/cockroachdb/pebble v0.0.0-20230928194634-aa077af62593 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.11.2 // indirect
github.com/crate-crypto/go-kzg-4844 v0.3.0 // indirect
github.com/consensys/gnark-crypto v0.12.0 // indirect
github.com/crate-crypto/go-kzg-4844 v0.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set/v2 v2.3.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/ethereum/c-kzg-4844 v0.3.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.24.0 // indirect
github.com/getsentry/sentry-go v0.24.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/gofrs/flock v0.8.1 // indirect
Expand All @@ -61,7 +62,7 @@ require (
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/ipfs/go-cid v0.4.1 // indirect
github.com/karalabe/usb v0.0.3-0.20230711191512-61db3e06439c // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
Expand All @@ -82,15 +83,15 @@ require (
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/client_golang v1.17.0 // indirect
github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect
github.com/prometheus/common v0.44.0 // indirect
github.com/prometheus/procfs v0.11.1 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/shirou/gopsutil v3.21.11+incompatible // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/afero v1.10.0 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
Expand Down
Loading

0 comments on commit 28d50d8

Please sign in to comment.