Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

harness: Update eth to work with geth 1.14 and up. #3123

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
4 changes: 2 additions & 2 deletions client/asset/btc/btc.go
Original file line number Diff line number Diff line change
Expand Up @@ -4281,10 +4281,10 @@ func (btc *baseWallet) Refund(coinID, contract dex.Bytes, feeRate uint64) (dex.B
}
btc.addTxToHistory(&asset.WalletTransaction{
Type: asset.Refund,
ID: txHash.String(),
ID: refundHash.String(),
Amount: uint64(utxo.Value),
Fees: fee,
}, txHash, true)
}, refundHash, true)

return ToCoinID(refundHash, 0), nil
}
Expand Down
23 changes: 2 additions & 21 deletions client/asset/eth/chaincfg.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"strings"

"decred.org/dcrdex/dex"
dexeth "decred.org/dcrdex/dex/networks/eth"
"github.com/ethereum/go-ethereum/common"
ethcore "github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/eth/ethconfig"
Expand Down Expand Up @@ -103,10 +102,8 @@ func ETHConfig(net dex.Network) (c ethconfig.Config, err error) {
case dex.Testnet:
c.Genesis = ethcore.DefaultSepoliaGenesisBlock()
case dex.Simnet:
c.Genesis, err = readSimnetGenesisFile()
if err != nil {
return c, fmt.Errorf("readSimnetGenesisFile error: %w", err)
}
// Args are gasLimit, faucet address.
c.Genesis = ethcore.DeveloperGenesisBlock(30000000, nil)
default:
return c, fmt.Errorf("unknown network %d", net)

Expand All @@ -123,19 +120,3 @@ func ChainConfig(net dex.Network) (c *params.ChainConfig, err error) {
}
return cfg.Genesis.Config, nil
}

// readSimnetGenesisFile reads the simnet genesis file.
func readSimnetGenesisFile() (*ethcore.Genesis, error) {
dataDir, err := simnetDataDir()
if err != nil {
return nil, err
}

genesisFile := filepath.Join(dataDir, "genesis.json")
genesisCfg, err := dexeth.LoadGenesisFile(genesisFile)
if err != nil {
return nil, fmt.Errorf("error reading genesis file: %v", err)
}

return genesisCfg, nil
}
8 changes: 4 additions & 4 deletions client/asset/eth/eth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4927,11 +4927,11 @@ func testMaxSwapRedeemLots(t *testing.T, assetID uint32) {
t.Fatalf("expected 63 for max redemptions but got %d", info.MaxRedeemsInTx)
}
} else {
if info.MaxSwapsInTx != 20 {
t.Fatalf("expected 20 for max swaps but got %d", info.MaxSwapsInTx)
if info.MaxSwapsInTx != 24 {
t.Fatalf("expected 24 for max swaps but got %d", info.MaxSwapsInTx)
}
if info.MaxRedeemsInTx != 45 {
t.Fatalf("expected 45 for max redemptions but got %d", info.MaxRedeemsInTx)
if info.MaxRedeemsInTx != 55 {
t.Fatalf("expected 55 for max redemptions but got %d", info.MaxRedeemsInTx)
}
}
}
Expand Down
28 changes: 13 additions & 15 deletions client/asset/eth/nodeclient_harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ var (
testnetParticipantWalletDir string

alphaNodeDir = filepath.Join(homeDir, "dextest", "eth", "alpha", "node")
alphaIPCFile = filepath.Join(alphaNodeDir, "geth.ipc")
betaNodeDir = filepath.Join(homeDir, "dextest", "eth", "beta", "node")
betaIPCFile = filepath.Join(betaNodeDir, "geth.ipc")
alphaWSEndpoint = "ws://127.0.0.1:38557"
ctx context.Context
tLogger = dex.StdOutLogger("ETHTEST", dex.LevelWarn)
simnetWalletSeed = "0812f5244004217452059e2fd11603a511b5d0870ead753df76c966ce3c71531"
Expand Down Expand Up @@ -208,23 +206,23 @@ func prepareRPCClient(name, dataDir string, providers []string, net dex.Network)
return c, c.creds.acct, nil
}

func rpcEndpoints(net dex.Network) ([]string, []string) {
func rpcEndpoints(net dex.Network) []string {
if net == dex.Testnet {
return rpcProviders, rpcProviders
return rpcProviders
}
return []string{alphaIPCFile}, []string{betaIPCFile}
return []string{alphaWSEndpoint}
}

func prepareTestRPCClients(initiatorDir, participantDir string, net dex.Network) (err error) {
initiatorEndpoints, participantEndpoints := rpcEndpoints(net)
endpoints := rpcEndpoints(net)

ethClient, simnetAcct, err = prepareRPCClient("initiator", initiatorDir, initiatorEndpoints, net)
ethClient, simnetAcct, err = prepareRPCClient("initiator", initiatorDir, endpoints, net)
if err != nil {
return err
}
fmt.Println("initiator address is", ethClient.address())

participantEthClient, participantAcct, err = prepareRPCClient("participant", participantDir, participantEndpoints, net)
participantEthClient, participantAcct, err = prepareRPCClient("participant", participantDir, endpoints, net)
if err != nil {
ethClient.shutdown()
return err
Expand Down Expand Up @@ -258,14 +256,14 @@ func runSimnet(m *testing.M) (int, error) {

ethSwapContractAddr = dexeth.ContractAddresses[contractVer][dex.Simnet]

initiatorProviders, participantProviders := rpcEndpoints(dex.Simnet)
providers := rpcEndpoints(dex.Simnet)

err = setupWallet(simnetWalletDir, simnetWalletSeed, "localhost:30355", initiatorProviders, dex.Simnet)
err = setupWallet(simnetWalletDir, simnetWalletSeed, "localhost:30355", providers, dex.Simnet)
if err != nil {
return 1, err
}

err = setupWallet(participantWalletDir, participantWalletSeed, "localhost:30356", participantProviders, dex.Simnet)
err = setupWallet(participantWalletDir, participantWalletSeed, "localhost:30356", providers, dex.Simnet)
if err != nil {
return 1, err
}
Expand Down Expand Up @@ -390,13 +388,13 @@ func runTestnet(m *testing.M) (int, error) {
ethSwapContractAddr = dexeth.ContractAddresses[contractVer][dex.Testnet]
fmt.Printf("ETH swap contract address is %v\n", ethSwapContractAddr)

initiatorRPC, participantRPC := rpcEndpoints(dex.Testnet)
rpc := rpcEndpoints(dex.Testnet)

err = setupWallet(testnetWalletDir, testnetWalletSeed, "localhost:30355", initiatorRPC, dex.Testnet)
err = setupWallet(testnetWalletDir, testnetWalletSeed, "localhost:30355", rpc, dex.Testnet)
if err != nil {
return 1, err
}
err = setupWallet(testnetParticipantWalletDir, testnetParticipantWalletSeed, "localhost:30356", participantRPC, dex.Testnet)
err = setupWallet(testnetParticipantWalletDir, testnetParticipantWalletSeed, "localhost:30356", rpc, dex.Testnet)
if err != nil {
return 1, err
}
Expand Down
29 changes: 7 additions & 22 deletions client/cmd/bisonw-desktop/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module decred.org/dcrdex/client/cmd/bisonw-desktop

go 1.21
go 1.22

toolchain go1.23.4

replace decred.org/dcrdex => ../../..

Expand All @@ -14,9 +16,7 @@ require (

require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
github.com/bits-and-blooms/bitset v1.13.0 // indirect
github.com/consensys/bavard v0.1.13 // indirect
github.com/consensys/gnark-crypto v0.12.1 // indirect
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c // indirect
Expand All @@ -28,7 +28,7 @@ require (
github.com/decred/vspd/client/v4 v4.0.0 // indirect
github.com/decred/vspd/types/v3 v3.0.0 // indirect
github.com/ethereum/c-kzg-4844 v1.0.0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 // indirect
github.com/ethereum/go-verkle v0.1.1-0.20240829091221-dffa7562dbe9 // indirect
github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 // indirect
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect
github.com/ltcsuite/lnd/tlv v0.0.0-20240222214433-454d35886119 // indirect
Expand All @@ -38,7 +38,7 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/supranational/blst v0.3.13 // indirect
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
Expand All @@ -48,12 +48,10 @@ require (
decred.org/cspp/v2 v2.3.0 // indirect
decred.org/dcrwallet/v4 v4.2.0 // indirect
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/DataDog/zstd v1.5.2 // indirect
github.com/StackExchange/wmi v1.2.1 // indirect
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/aead/siphash v1.0.1 // indirect
github.com/agl/ed25519 v0.0.0-20170116200512-5312a6153412 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/btcsuite/btcd v0.24.2-beta.rc1.0.20240625142744-cc26860b4026 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
Expand All @@ -71,10 +69,6 @@ require (
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/cockroachdb/errors v1.11.3 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v1.1.1 // indirect
github.com/cockroachdb/redact v1.1.5 // indirect
github.com/companyzero/sntrup4591761 v0.0.0-20220309191932-9e0f3af2f07a // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dchest/blake2b v1.0.0 // indirect
Expand Down Expand Up @@ -111,18 +105,16 @@ require (
github.com/dgraph-io/badger v1.6.2 // indirect
github.com/dgraph-io/ristretto v0.0.2 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/ethereum/go-ethereum v1.14.8 // indirect
github.com/ethereum/go-ethereum v1.14.12 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gcash/bchd v0.19.0 // indirect
github.com/gcash/bchlog v0.0.0-20180913005452-b4f036f92fa6 // indirect
github.com/gcash/bchutil v0.0.0-20210113190856-6ea28dff4000 // indirect
github.com/gen2brain/beeep v0.0.0-20240112042604-c7bb2cd88fea
github.com/getsentry/sentry-go v0.27.0 // indirect
github.com/go-chi/chi/v5 v5.0.1 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gofrs/flock v0.8.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/uuid v1.3.0 // indirect
Expand All @@ -137,10 +129,7 @@ require (
github.com/jrick/logrotate v1.0.0 // indirect
github.com/jrick/wsrpc/v2 v2.3.5 // indirect
github.com/kkdai/bstream v1.0.0 // indirect
github.com/klauspost/compress v1.16.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.8 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.4 // indirect
github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf // indirect
github.com/lightninglabs/neutrino v0.16.1-0.20240814152458-81d6cd2d2da5 // indirect
Expand All @@ -160,12 +149,8 @@ require (
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
Expand Down
Loading
Loading