diff --git a/client/asset/eth/chaincfg.go b/client/asset/eth/chaincfg.go index 4edf35d0d7..d4b1f0d576 100644 --- a/client/asset/eth/chaincfg.go +++ b/client/asset/eth/chaincfg.go @@ -13,7 +13,6 @@ import ( "decred.org/dcrdex/dex" dexeth "decred.org/dcrdex/dex/networks/eth" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core" ethcore "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/params" @@ -100,9 +99,9 @@ func ETHConfig(net dex.Network) (c ethconfig.Config, err error) { switch net { // Ethereum case dex.Mainnet: - c.Genesis = core.DefaultGenesisBlock() + c.Genesis = ethcore.DefaultGenesisBlock() case dex.Testnet: - c.Genesis = core.DefaultSepoliaGenesisBlock() + c.Genesis = ethcore.DefaultSepoliaGenesisBlock() case dex.Simnet: c.Genesis, err = readSimnetGenesisFile() if err != nil { diff --git a/client/asset/eth/eth.go b/client/asset/eth/eth.go index 1829198af3..07579b3b21 100644 --- a/client/asset/eth/eth.go +++ b/client/asset/eth/eth.go @@ -118,8 +118,9 @@ const ( stateUpdateTick = time.Second * 5 // maxUnindexedTxs is the number of pending txs we will allow to be // unverified on-chain before we halt broadcasting of new txs. - maxUnindexedTxs = 10 - peerCountTicker = 5 * time.Second // no rpc calls here + maxUnindexedTxs = 10 + peerCountTicker = 5 * time.Second // no rpc calls here + contractVersionNewest = ^uint32(0) ) var ( @@ -6091,3 +6092,41 @@ func getGasEstimates(ctx context.Context, cl, acl ethFetcher, c contractor, ac t return nil } + +// newTxOpts is a constructor for a TransactOpts. +func newTxOpts(ctx context.Context, from common.Address, val, maxGas uint64, maxFeeRate, gasTipCap *big.Int) *bind.TransactOpts { + // We'll enforce dexeth.MinGasTipCap since the server does, but this isn't + // necessarily a constant for all networks or under all conditions. + minGasWei := dexeth.GweiToWei(dexeth.MinGasTipCap) + if gasTipCap.Cmp(minGasWei) < 0 { + gasTipCap.Set(minGasWei) + } + // This is enforced by concensus. We shouldn't be able to get here with a + // swap tx. + if gasTipCap.Cmp(maxFeeRate) > 0 { + gasTipCap.Set(maxFeeRate) + } + return &bind.TransactOpts{ + Context: ctx, + From: from, + Value: dexeth.GweiToWei(val), + GasFeeCap: maxFeeRate, + GasTipCap: gasTipCap, + GasLimit: maxGas, + } +} + +func gases(contractVer uint32, versionedGases map[uint32]*dexeth.Gases) *dexeth.Gases { + if contractVer != contractVersionNewest { + return versionedGases[contractVer] + } + var bestVer uint32 + var bestGases *dexeth.Gases + for ver, gases := range versionedGases { + if ver >= bestVer { + bestGases = gases + bestVer = ver + } + } + return bestGases +} diff --git a/client/asset/eth/multirpc.go b/client/asset/eth/multirpc.go index 9965ebfa67..d040533835 100644 --- a/client/asset/eth/multirpc.go +++ b/client/asset/eth/multirpc.go @@ -33,6 +33,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/misc" "github.com/ethereum/go-ethereum/core/txpool" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" @@ -72,6 +73,10 @@ var ( // when given an HTTP(S) provider URL. Can be disabled for testing // ((*MRPCTest).TestRPC). forceTryWS = true + // https://github.com/ethereum/go-ethereum/blob/16341e05636fd088aa04a27fca6dc5cda5dbab8f/eth/backend.go#L110-L113 + // ultimately results in a minimum fee rate by the filter applied at + // https://github.com/ethereum/go-ethereum/blob/4ebeca19d739a243dc0549bcaf014946cde95c4f/core/tx_pool.go#L626 + minGasPrice = ethconfig.Defaults.Miner.GasPrice ) // TODO: Handle rate limiting? From the docs: diff --git a/client/asset/eth/node.go b/client/asset/eth/node.go index 01ea30da6d..082880612e 100644 --- a/client/asset/eth/node.go +++ b/client/asset/eth/node.go @@ -7,7 +7,6 @@ import ( "bytes" "crypto/ecdsa" "fmt" - "path/filepath" "decred.org/dcrdex/dex" @@ -15,23 +14,9 @@ import ( "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/ethereum/go-ethereum/eth/downloader" - "github.com/ethereum/go-ethereum/les" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/p2p/nat" - "github.com/ethereum/go-ethereum/params" ) -const maxPeers = 10 - -type nodeConfig struct { - net dex.Network - listenAddr, appDir string - logger dex.Logger -} - // ethLogger satisfies geth's logger interface. type ethLogger struct { dl dex.Logger @@ -121,115 +106,6 @@ func (el *ethLogger) Crit(msg string, ctx ...any) { // Check that *ethLogger satisfies the log.Logger interface. var _ log.Logger = (*ethLogger)(nil) -// prepareNode sets up a geth node, but does not start it. -func prepareNode(cfg *nodeConfig) (*node.Node, error) { - stackConf := &node.Config{ - DataDir: cfg.appDir, - // KeyStoreDir is set the same as the geth default, but we rely on this - // location for Exists, so protect against future geth changes. - KeyStoreDir: filepath.Join(cfg.appDir, "keystore"), - } - - stackConf.Logger = ðLogger{dl: cfg.logger} - - stackConf.P2P.MaxPeers = maxPeers - var key *ecdsa.PrivateKey - var err error - if key, err = crypto.GenerateKey(); err != nil { - return nil, err - } - stackConf.P2P.PrivateKey = key - stackConf.P2P.ListenAddr = cfg.listenAddr - stackConf.P2P.NAT = nat.Any() - - var urls []string - switch cfg.net { - case dex.Simnet: - urls = []string{ - "enode://897c84f6e4f18195413c1d02927e6a4093f5e7574b52bdec6f20844c4f1f6dd3f16036a9e600bd8681ab50fd8dd144df4a6ba9dd8722bb578a86aaa8222c964f@127.0.0.1:30304", // alpha - "enode://b1d3e358ee5c9b268e911f2cab47bc12d0e65c80a6d2b453fece34facc9ac3caed14aa3bc7578166bb08c5bc9719e5a2267ae14e0b42da393f4d86f6d5829061@127.0.0.1:30305", // beta - "enode://b1c14deee09b9d5549c90b7b30a35c812a56bf6afea5873b05d7a1bcd79c7b0848bcfa982faf80cc9e758a3a0d9b470f0a002840d365050fd5bf45052a6ec313@127.0.0.1:30306", // gamma - "enode://ca414c361d1a38716170923e4900d9dc9203dbaf8fdcaee73e1f861df9fdf20a1453b76fd218c18bc6f3c7e13cbca0b3416af02a53b8e31188faa45aab398d1c@127.0.0.1:30307", // delta - } - case dex.Testnet: - urls = params.SepoliaBootnodes - case dex.Mainnet: - urls = params.MainnetBootnodes - default: - return nil, fmt.Errorf("unknown network ID: %d", uint8(cfg.net)) - } - - for _, url := range urls { - node, err := enode.Parse(enode.ValidSchemes, url) - if err != nil { - return nil, fmt.Errorf("Bootstrap URL %q invalid: %v", url, err) - } - stackConf.P2P.BootstrapNodes = append(stackConf.P2P.BootstrapNodes, node) - } - - if cfg.net != dex.Simnet { - for _, url := range params.V5Bootnodes { - node, err := enode.Parse(enode.ValidSchemes, url) - if err != nil { - return nil, fmt.Errorf("Bootstrap v5 URL %q invalid: %v", url, err) - } - stackConf.P2P.BootstrapNodesV5 = append(stackConf.P2P.BootstrapNodesV5, node) - } - } - - node, err := node.New(stackConf) - if err != nil { - return nil, err - } - - ks := keystore.NewKeyStore(node.KeyStoreDir(), keystore.LightScryptN, keystore.LightScryptP) - node.AccountManager().AddBackend(ks) - - return node, nil -} - -// startNode starts a geth node. -func startNode(_ /* chainID */ int64, node *node.Node, network dex.Network) (*les.LightEthereum, error) { - ethCfg, err := ETHConfig(network) - if err != nil { - return nil, err - } - - ethCfg.SyncMode = downloader.LightSync - - // Eth has a default RPCTxFeeCap of one eth. This prevents txn with a - // total gas fee higher than than one eth to fail when sending. Setting - // the value to zero removes the limit completely. - ethCfg.RPCTxFeeCap = 0 - - leth, err := les.New(node, ðCfg) - if err != nil { - return nil, err - } - - if err := node.Start(); err != nil { - return nil, err - } - - return leth, nil -} - -// importKeyToNode imports an private key into an ethereum node that can be -// unlocked with password. -func importKeyToNode(node *node.Node, privateKey, password []byte) error { - priv, err := crypto.ToECDSA(privateKey) - if err != nil { - return err - } - backends := node.AccountManager().Backends(keystore.KeyStoreType) - if len(backends) == 0 { - return fmt.Errorf("importKeyToNode: expected at least 1 keystore backend") - } - ks := backends[0].(*keystore.KeyStore) - - return importKeyToKeyStore(ks, priv, password) -} - func importKeyToKeyStore(ks *keystore.KeyStore, priv *ecdsa.PrivateKey, pw []byte) error { accounts := ks.Accounts() if len(accounts) == 0 { @@ -248,14 +124,6 @@ func importKeyToKeyStore(ks *keystore.KeyStore, priv *ecdsa.PrivateKey, pw []byt return nil } -func exportKeyStoreFromNode(node *node.Node) (*keystore.KeyStore, error) { - backends := node.AccountManager().Backends(keystore.KeyStoreType) - if len(backends) == 0 { - return nil, fmt.Errorf("exportKeyStoreFromNode: expected at least 1 keystore backend") - } - return backends[0].(*keystore.KeyStore), nil -} - // accountCredentials captures the account-specific geth interfaces. type accountCredentials struct { ks *keystore.KeyStore @@ -264,15 +132,6 @@ type accountCredentials struct { wallet accounts.Wallet } -// nodeCredentials parses the accountCredentials from the node. -func nodeCredentials(node *node.Node) (*accountCredentials, error) { - ks, err := exportKeyStoreFromNode(node) - if err != nil { - return nil, fmt.Errorf("exportKeyStoreFromNode error: %v", err) - } - return credentialsFromKeyStore(ks) -} - func pathCredentials(dir string) (*accountCredentials, error) { // TODO: Use StandardScryptN and StandardScryptP? return credentialsFromKeyStore(keystore.NewKeyStore(dir, keystore.LightScryptN, keystore.LightScryptP)) diff --git a/client/asset/eth/nodeclient.go b/client/asset/eth/nodeclient.go deleted file mode 100644 index 1331debdbd..0000000000 --- a/client/asset/eth/nodeclient.go +++ /dev/null @@ -1,438 +0,0 @@ -// This code is available on the terms of the project LICENSE.md file, -// also available online at https://blueoakcouncil.org/license/1.0.0. - -package eth - -import ( - "context" - "errors" - "fmt" - "math/big" - - "decred.org/dcrdex/client/asset" - "decred.org/dcrdex/dex" - dexeth "decred.org/dcrdex/dex/networks/eth" - "github.com/ethereum/go-ethereum" - "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/state" - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/eth/ethconfig" - "github.com/ethereum/go-ethereum/ethclient" - "github.com/ethereum/go-ethereum/les" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/p2p" - "github.com/ethereum/go-ethereum/p2p/enode" - "github.com/ethereum/go-ethereum/params" - "github.com/ethereum/go-ethereum/rpc" - - "github.com/ethereum/go-ethereum/consensus/misc" -) - -const contractVersionNewest = ^uint32(0) - -var ( - // https://github.com/ethereum/go-ethereum/blob/16341e05636fd088aa04a27fca6dc5cda5dbab8f/eth/backend.go#L110-L113 - // ultimately results in a minimum fee rate by the filter applied at - // https://github.com/ethereum/go-ethereum/blob/4ebeca19d739a243dc0549bcaf014946cde95c4f/core/tx_pool.go#L626 - minGasPrice = ethconfig.Defaults.Miner.GasPrice - - // Check that nodeClient satisfies the ethFetcher interface. - _ ethFetcher = (*nodeClient)(nil) -) - -// nodeClient satisfies the ethFetcher interface. Do not use until Connect is -// called. -type nodeClient struct { - net dex.Network - log dex.Logger - creds *accountCredentials - p2pSrv *p2p.Server - ec *ethclient.Client - node *node.Node - leth *les.LightEthereum - chainID *big.Int -} - -func newNodeClient(dir string, chainID int64, net dex.Network, log dex.Logger) (*nodeClient, error) { - node, err := prepareNode(&nodeConfig{ - net: net, - appDir: dir, - logger: log.SubLogger(asset.InternalNodeLoggerName), - }) - if err != nil { - return nil, err - } - - creds, err := nodeCredentials(node) - if err != nil { - return nil, err - } - - return &nodeClient{ - chainID: big.NewInt(chainID), - node: node, - creds: creds, - net: net, - log: log, - }, nil -} - -func (n *nodeClient) address() common.Address { - return n.creds.addr -} - -func (n *nodeClient) chainConfig() *params.ChainConfig { - return n.leth.ApiBackend.ChainConfig() -} - -// connect connects to a node. It then wraps ethclient's client and -// bundles commands in a form we can easily use. -func (n *nodeClient) connect(ctx context.Context) (err error) { - n.leth, err = startNode(n.chainID.Int64(), n.node, n.net) - if err != nil { - return err - } - - client, err := n.node.Attach() - if err != nil { - return fmt.Errorf("unable to dial rpc: %v", err) - } - n.ec = ethclient.NewClient(client) - n.p2pSrv = n.node.Server() - if n.p2pSrv == nil { - return fmt.Errorf("no *p2p.Server") - } - - return nil -} - -// shutdown shuts down the client. -func (n *nodeClient) shutdown() { - if n.ec != nil { - // this will also close the underlying rpc.Client. - n.ec.Close() - } - if n.node != nil { - n.node.Close() - n.node.Wait() - } -} - -func (n *nodeClient) peerCount() uint32 { - return uint32(n.p2pSrv.PeerCount()) -} - -// bestHeader gets the best header at the time of calling. -func (n *nodeClient) bestHeader(ctx context.Context) (*types.Header, error) { - return n.leth.ApiBackend.HeaderByNumber(ctx, rpc.LatestBlockNumber) -} - -func (n *nodeClient) headerByHash(ctx context.Context, txHash common.Hash) (*types.Header, error) { - return n.leth.BlockChain().GetHeaderByHash(txHash), nil -} - -func (n *nodeClient) stateAt(ctx context.Context, bn rpc.BlockNumber) (*state.StateDB, error) { - state, _, err := n.leth.ApiBackend.StateAndHeaderByNumberOrHash(ctx, rpc.BlockNumberOrHashWithNumber(bn)) - if err != nil { - return nil, err - } - if state == nil { - return nil, errors.New("no state") - } - return state, nil -} - -func (n *nodeClient) balanceAt(ctx context.Context, addr common.Address, bn rpc.BlockNumber) (*big.Int, error) { - state, err := n.stateAt(ctx, bn) - if err != nil { - return nil, err - } - return state.GetBalance(addr), nil -} - -func (n *nodeClient) addressBalance(ctx context.Context, addr common.Address) (*big.Int, error) { - return n.balanceAt(ctx, addr, rpc.LatestBlockNumber) -} - -// unlock the account indefinitely. -func (n *nodeClient) unlock(pw string) error { - return n.creds.ks.TimedUnlock(*n.creds.acct, pw, 0) -} - -// lock the account indefinitely. -func (n *nodeClient) lock() error { - return n.creds.ks.Lock(n.creds.addr) -} - -// locked returns true if the wallet is currently locked. -func (n *nodeClient) locked() bool { - status, _ := n.creds.wallet.Status() - return status != "Unlocked" -} - -func (n *nodeClient) transactionReceipt(ctx context.Context, txHash common.Hash) (r *types.Receipt, err error) { - return nil, fmt.Errorf("unimplemented") -} - -// transactionReceipt retrieves the transaction's receipt. -func (n *nodeClient) transactionAndReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, *types.Transaction, error) { - tx, blockHash, _, index, err := n.leth.ApiBackend.GetTransaction(ctx, txHash) - if err != nil { - if errors.Is(err, ethereum.NotFound) { - return nil, nil, asset.CoinNotFoundError - } - return nil, nil, err - } - if tx == nil { - return nil, nil, fmt.Errorf("%w: transaction %v not found", asset.CoinNotFoundError, txHash) - } - receipts, err := n.leth.ApiBackend.GetReceipts(ctx, blockHash) - if err != nil { - return nil, nil, err - } - if len(receipts) <= int(index) { - return nil, nil, fmt.Errorf("no receipt at index %d in block %s for tx %s", index, blockHash, txHash) - } - receipt := receipts[index] - if receipt == nil { - return nil, nil, fmt.Errorf("nil receipt at index %d in block %s for tx %s", index, blockHash, txHash) - } - return receipt, tx, nil -} - -func (n *nodeClient) nonce(ctx context.Context) (*big.Int, *big.Int, error) { - return nil, nil, errors.New("unimplemented") -} - -// pendingTransactions returns pending transactions. -func (n *nodeClient) pendingTransactions() ([]*types.Transaction, error) { - return n.leth.ApiBackend.GetPoolTransactions() -} - -// addPeer adds a peer. -func (n *nodeClient) addPeer(peerURL string) error { - peer, err := enode.Parse(enode.ValidSchemes, peerURL) - if err != nil { - return err - } - n.p2pSrv.AddPeer(peer) - return nil -} - -// getConfirmedNonce returns the nonce of the account in the state of a -// certain block. -func (n *nodeClient) getConfirmedNonce(ctx context.Context) (uint64, error) { - state, _, err := n.leth.ApiBackend.StateAndHeaderByNumber(ctx, rpc.PendingBlockNumber) - if err != nil { - return 0, err - } - return state.GetNonce(n.address()), nil -} - -// sendTransaction sends a tx. The nonce should be set in txOpts. -func (n *nodeClient) sendTransaction(ctx context.Context, txOpts *bind.TransactOpts, - to common.Address, data []byte, filts ...acceptabilityFilter) (*types.Transaction, error) { - - tx, err := n.creds.ks.SignTx(*n.creds.acct, types.NewTx(&types.DynamicFeeTx{ - To: &to, - ChainID: n.chainID, - Nonce: txOpts.Nonce.Uint64(), - Gas: txOpts.GasLimit, - GasFeeCap: txOpts.GasFeeCap, - GasTipCap: txOpts.GasTipCap, - Value: txOpts.Value, - Data: data, - }), n.chainID) - if err != nil { - return nil, fmt.Errorf("signing error: %v", err) - } - - return tx, n.leth.ApiBackend.SendTx(ctx, tx) -} - -// syncProgress return the current sync progress and the best block's header -// time in seconds. Returns no error and nil when not syncing. -func (n *nodeClient) syncProgress(ctx context.Context) (*ethereum.SyncProgress, uint64, error) { - hdr, err := n.bestHeader(ctx) - if err != nil { - return nil, 0, err - } - p := n.leth.ApiBackend.SyncProgress() - return &p, hdr.Time, nil -} - -// signData uses the private key of the address to sign a piece of data. -// The wallet must be unlocked to use this function. -func (n *nodeClient) signData(data []byte) (sig, pubKey []byte, err error) { - return signData(n.creds, data) -} - -func (n *nodeClient) addSignerToOpts(txOpts *bind.TransactOpts) { - txOpts.Signer = func(addr common.Address, tx *types.Transaction) (*types.Transaction, error) { - return n.creds.wallet.SignTx(*n.creds.acct, tx, n.chainID) - } -} - -// currentFees gets the baseFee and tipCap for the next block. -func (n *nodeClient) currentFees(ctx context.Context) (baseFees, tipCap *big.Int, err error) { - hdr, err := n.bestHeader(ctx) - if err != nil { - return nil, nil, err - } - - base := misc.CalcBaseFee(n.leth.ApiBackend.ChainConfig(), hdr) - - if base.Cmp(minGasPrice) < 0 { - base.Set(minGasPrice) - } - - tip, err := n.leth.ApiBackend.SuggestGasTipCap(ctx) - if err != nil { - return nil, nil, err - } - - minGasTipCapWei := dexeth.GweiToWei(dexeth.MinGasTipCap) - if tip.Cmp(minGasTipCapWei) < 0 { - tip = new(big.Int).Set(minGasTipCapWei) - } - - return base, tip, nil -} - -// getCodeAt retrieves the runtime bytecode at a certain address. -func (n *nodeClient) getCodeAt(ctx context.Context, contractAddr common.Address) ([]byte, error) { - state, err := n.stateAt(ctx, rpc.PendingBlockNumber) - if err != nil { - return nil, err - } - code := state.GetCode(contractAddr) - return code, state.Error() -} - -// txOpts generates a set of TransactOpts for the account. If maxFeeRate is -// zero, it will be calculated as double the current baseFee. The tip will be -// added automatically. Sets the passed nonce if supplied. If nonce is nil the -// next nonce will be fetched and the passed argument altered. -// -// NOTE: The nonce included in the txOpts must be sent before txOpts is used -// again. The caller should ensure that txOpts -> send sequence is synchronized. -func (n *nodeClient) txOpts(ctx context.Context, val, maxGas uint64, maxFeeRate, tipRate, nonce *big.Int) (*bind.TransactOpts, error) { - baseFee, gasTipCap, err := n.currentFees(ctx) - if err != nil { - return nil, err - } - - if maxFeeRate == nil { - maxFeeRate = new(big.Int).Mul(baseFee, big.NewInt(2)) - } - - // If nonce is not nil, this indicates that we are trying to re-send an - // old transaction with higher fee in order to ensure it is mined. - if nonce == nil { - n, err := n.leth.ApiBackend.GetPoolNonce(ctx, n.creds.addr) - if err != nil { - return nil, fmt.Errorf("error getting nonce: %v", err) - } - nonce = new(big.Int).SetUint64(n) - } - txOpts := newTxOpts(ctx, n.creds.addr, val, maxGas, maxFeeRate, gasTipCap) - txOpts.Nonce = nonce - n.addSignerToOpts(txOpts) - - return txOpts, nil -} - -func (n *nodeClient) contractBackend() bind.ContractBackend { - return n.ec -} - -// getTransaction looks up a transaction and returns the transaction and the -// height of the block it was included in. -1 is returned for the height of -// unmined transactions. -func (n *nodeClient) getTransaction(ctx context.Context, txHash common.Hash) (*types.Transaction, int64, error) { - // We'll check the local tx pool first, since from what I can tell, a light - // client always requests tx data from the network for anything else. - if tx := n.leth.ApiBackend.GetPoolTransaction(txHash); tx != nil { - return tx, -1, nil - } - tx, _, blockHeight, _, err := n.leth.ApiBackend.GetTransaction(ctx, txHash) - if err != nil { - if errors.Is(err, ethereum.NotFound) { - return nil, 0, asset.CoinNotFoundError - } - return nil, 0, err - } - if tx != nil { - return tx, int64(blockHeight), nil - } - // TODO: There may be a race between when the tx is removed from our local - // tx pool, and when our peers are ready to supply the info. I saw a - // CoinNotFoundError in TestAccount/testSendTransaction, but haven't - // reproduced. - n.log.Warnf("getTransaction: cannot find %v", txHash) - return nil, 0, asset.CoinNotFoundError -} - -// transactionConfirmations gets the number of confirmations for the specified -// transaction. -func (n *nodeClient) transactionConfirmations(ctx context.Context, txHash common.Hash) (uint32, error) { - _, blockHeight, err := n.getTransaction(ctx, txHash) - if err != nil || blockHeight < 0 { - return 0, err - } - - hdr, err := n.bestHeader(ctx) - if err != nil { - return 0, err - } - - if hdr.Number.Int64() < blockHeight { // avoid potential overflow - return 0, nil - } - - return uint32(hdr.Number.Int64() - blockHeight + 1), nil -} - -// sendSignedTransaction injects a signed transaction into the pending pool for execution. -func (n *nodeClient) sendSignedTransaction(ctx context.Context, tx *types.Transaction, filts ...acceptabilityFilter) error { - return n.leth.ApiBackend.SendTx(ctx, tx) -} - -// newTxOpts is a constructor for a TransactOpts. -func newTxOpts(ctx context.Context, from common.Address, val, maxGas uint64, maxFeeRate, gasTipCap *big.Int) *bind.TransactOpts { - // We'll enforce dexeth.MinGasTipCap since the server does, but this isn't - // necessarily a constant for all networks or under all conditions. - minGasWei := dexeth.GweiToWei(dexeth.MinGasTipCap) - if gasTipCap.Cmp(minGasWei) < 0 { - gasTipCap.Set(minGasWei) - } - // This is enforced by concensus. We shouldn't be able to get here with a - // swap tx. - if gasTipCap.Cmp(maxFeeRate) > 0 { - gasTipCap.Set(maxFeeRate) - } - return &bind.TransactOpts{ - Context: ctx, - From: from, - Value: dexeth.GweiToWei(val), - GasFeeCap: maxFeeRate, - GasTipCap: gasTipCap, - GasLimit: maxGas, - } -} - -func gases(contractVer uint32, versionedGases map[uint32]*dexeth.Gases) *dexeth.Gases { - if contractVer != contractVersionNewest { - return versionedGases[contractVer] - } - var bestVer uint32 - var bestGases *dexeth.Gases - for ver, gases := range versionedGases { - if ver >= bestVer { - bestGases = gases - bestVer = ver - } - } - return bestGases -} diff --git a/client/asset/eth/nodeclient_harness_test.go b/client/asset/eth/nodeclient_harness_test.go index 2c25d0b0fa..de0a19721f 100644 --- a/client/asset/eth/nodeclient_harness_test.go +++ b/client/asset/eth/nodeclient_harness_test.go @@ -50,11 +50,6 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/crypto/secp256k1" - "github.com/ethereum/go-ethereum/node" - "github.com/ethereum/go-ethereum/rpc" - // "encoding/binary" - // "github.com/decred/dcrd/dcrutil/v4" - // "github.com/decred/dcrd/crypto/blake256" ) const ( @@ -101,8 +96,6 @@ var ( // If you are testing on testnet, you must specify the rpcNode. You can also // specify it in the testnet-credentials.json file. rpcProviders []string - // useRPC can be set to true to test the RPC clients. - useRPC bool // isTestnet can be set to true to perform tests on the sepolia testnet. // May need some setup including sending testnet coins to the addresses @@ -170,7 +163,7 @@ func waitForReceipt(nc ethFetcher, tx *types.Transaction) (*types.Receipt, error } } -func waitForMinedRPC() error { +func waitForMined() error { hdr, err := ethClient.bestHeader(ctx) if err != nil { return err @@ -199,56 +192,6 @@ func waitForMinedRPC() error { } } -// waitForMined will multiply the time limit by secPerBlock for -// testnet and mine blocks when on simnet. -func waitForMined(nBlock int, waitTimeLimit bool) error { - timesUp := time.After(time.Duration(nBlock) * secPerBlock) - if useRPC { - return waitForMinedRPC() - } - if !isTestnet { - err := exec.Command("geth", "--datadir="+alphaNodeDir, "attach", "--exec", "miner.start()").Run() - if err != nil { - return err - } - defer func() { - _ = exec.Command("geth", "--datadir="+alphaNodeDir, "attach", "--exec", "miner.stop()").Run() - }() - } -out: - for { - select { - case <-ctx.Done(): - return ctx.Err() - case <-timesUp: - return errors.New("timed out") - case <-time.After(time.Second): - // NOTE: Not effectual for providers. waitForMinedRPC - // above handles waiting for mined blocks that we assume - // have our transactions. - txsa, err := ethClient.(txPoolFetcher).pendingTransactions() - if err != nil { - return fmt.Errorf("initiator pendingTransactions error: %v", err) - } - txsb, err := participantEthClient.(txPoolFetcher).pendingTransactions() - if err != nil { - return fmt.Errorf("participant pendingTransactions error: %v", err) - } - if len(txsa)+len(txsb) == 0 { - break out - } - } - } - if waitTimeLimit { - select { - case <-ctx.Done(): - return ctx.Err() - case <-timesUp: - } - } - return nil -} - func prepareRPCClient(name, dataDir string, providers []string, net dex.Network) (*multiRPCClient, *accounts.Account, error) { cfg, err := ChainConfig(net) if err != nil { @@ -257,7 +200,7 @@ func prepareRPCClient(name, dataDir string, providers []string, net dex.Network) c, err := newMultiRPCClient(dataDir, providers, tLogger.SubLogger(name), cfg, 3, net) if err != nil { - return nil, nil, fmt.Errorf("(%s) newNodeClient error: %v", name, err) + return nil, nil, fmt.Errorf("(%s) prepareRPCClient error: %v", name, err) } if err := c.connect(ctx); err != nil { return nil, nil, fmt.Errorf("(%s) connect error: %v", name, err) @@ -290,53 +233,6 @@ func prepareTestRPCClients(initiatorDir, participantDir string, net dex.Network) return nil } -func prepareNodeClient(name, dataDir string, net dex.Network) (*nodeClient, *accounts.Account, error) { - c, err := newNodeClient(getWalletDir(dataDir, net), dexeth.ChainIDs[net], net, tLogger.SubLogger(name)) - if err != nil { - return nil, nil, fmt.Errorf("(%s) newNodeClient error: %v", name, err) - } - - if err := c.connect(ctx); err != nil { - return nil, nil, fmt.Errorf("(%s) connect error: %v", name, err) - } - - accts, err := exportAccountsFromNode(c.node) - if err != nil { - c.shutdown() - return nil, nil, fmt.Errorf("(%s) account export error: %v", name, err) - } - if len(accts) != 1 { - c.shutdown() - return nil, nil, fmt.Errorf("(%s) expected 1 account to be exported but got %v", name, len(accts)) - } - - if addPeer != "" { - if err = c.addPeer(addPeer); err != nil { - c.shutdown() - return nil, nil, fmt.Errorf("initiator unable to add peer: %w", err) - } - } - - return c, &accts[0], nil -} - -func prepareTestNodeClients(initiatorDir, participantDir string, net dex.Network) (err error) { - ethClient, simnetAcct, err = prepareNodeClient("initiator", initiatorDir, net) - if err != nil { - return err - } - - participantEthClient, participantAcct, err = prepareNodeClient("participant", participantDir, net) - if err != nil { - ethClient.shutdown() - return err - } - - fmt.Println("initiator address is", ethClient.address()) - fmt.Println("participant address is", participantEthClient.address()) - return -} - func runSimnet(m *testing.M) (int, error) { // Create dir if none yet exists. This persists for the life of the // testing harness. @@ -374,12 +270,7 @@ func runSimnet(m *testing.M) (int, error) { return 1, err } - if useRPC { - err = prepareTestRPCClients(simnetWalletDir, participantWalletDir, dex.Simnet) - } else { - err = prepareTestNodeClients(simnetWalletDir, participantWalletDir, dex.Simnet) - } - if err != nil { + if err = prepareTestRPCClients(simnetWalletDir, participantWalletDir, dex.Simnet); err != nil { return 1, err } defer ethClient.shutdown() @@ -509,12 +400,7 @@ func runTestnet(m *testing.M) (int, error) { if err != nil { return 1, err } - if useRPC { - err = prepareTestRPCClients(testnetWalletDir, testnetParticipantWalletDir, dex.Testnet) - } else { - err = prepareTestNodeClients(testnetWalletDir, testnetParticipantWalletDir, dex.Testnet) - } - if err != nil { + if err = prepareTestRPCClients(testnetWalletDir, testnetParticipantWalletDir, dex.Testnet); err != nil { return 1, err } defer ethClient.shutdown() @@ -618,7 +504,6 @@ func TestMain(m *testing.M) { dexeth.MaybeReadSimnetAddrs() flag.BoolVar(&isTestnet, "testnet", false, "use testnet") - flag.BoolVar(&useRPC, "rpc", true, "use RPC") flag.Parse() if isTestnet { @@ -663,15 +548,9 @@ func TestMain(m *testing.M) { } func setupWallet(walletDir, seed, listenAddress string, providers []string, net dex.Network) error { - walletType := walletTypeGeth + walletType := walletTypeRPC settings := map[string]string{ - "nodelistenaddr": listenAddress, - } - if useRPC { - walletType = walletTypeRPC - settings = map[string]string{ - providersKey: strings.Join(providers, " "), - } + providersKey: strings.Join(providers, " "), } seedB, _ := hex.DecodeString(seed) createWalletParams := asset.CreateWalletParams{ @@ -716,7 +595,7 @@ func prepareTokenClients(t *testing.T) { t.Fatalf("participant approveToken error: %v", err) } - if err := waitForMined(8, true); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("unexpected error while waiting to mine approval block: %v", err) } @@ -777,9 +656,7 @@ func TestBasicRetrieval(t *testing.T) { } func TestPeering(t *testing.T) { - t.Run("testAddPeer", testAddPeer) t.Run("testSyncProgress", testSyncProgress) - t.Run("testGetCodeAt", testGetCodeAt) } func TestAccount(t *testing.T) { @@ -829,16 +706,6 @@ func TestTokenAccess(t *testing.T) { t.Run("testApproveAllowance", testApproveAllowance) } -func testAddPeer(t *testing.T) { - c, is := ethClient.(*nodeClient) - if !is { - t.Skip("add peer not supported for RPC clients") - } - if err := c.addPeer(alphaNode); err != nil { - t.Fatal(err) - } -} - func testBestHeader(t *testing.T) { bh, err := ethClient.bestHeader(ctx) if err != nil { @@ -946,7 +813,7 @@ func testSendTransaction(t *testing.T) { confs, err := ethClient.transactionConfirmations(ctx, txHash) // CoinNotFoundError OK for RPC wallet until mined. - if err != nil && !(useRPC && errors.Is(err, asset.CoinNotFoundError)) { + if err != nil && !errors.Is(err, asset.CoinNotFoundError) { t.Fatalf("transactionConfirmations error: %v", err) } if confs != 0 { @@ -954,7 +821,7 @@ func testSendTransaction(t *testing.T) { } spew.Dump(tx) - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatal(err) } @@ -1001,27 +868,17 @@ func testSendSignedTransaction(t *testing.T) { if !errors.Is(err, asset.CoinNotFoundError) { t.Fatalf("no CoinNotFoundError") } - + c := ethClient.(*multiRPCClient) var nonce uint64 var chainID *big.Int var ks *keystore.KeyStore - switch c := ethClient.(type) { - case *nodeClient: - nonce, err = c.leth.ApiBackend.GetPoolNonce(ctx, c.creds.addr) - if err != nil { - t.Fatalf("error getting nonce: %v", err) - } - ks = c.creds.ks - chainID = c.chainID - case *multiRPCClient: - n, _, err := c.nonce(ctx) - if err != nil { - t.Fatalf("error getting nonce: %v", err) - } - nonce = n.Uint64() - ks = c.creds.ks - chainID = c.chainID + n, _, err := ethClient.nonce(ctx) + if err != nil { + t.Fatalf("error getting nonce: %v", err) } + nonce = n.Uint64() + ks = c.creds.ks + chainID = c.chainID tx := types.NewTx(&types.DynamicFeeTx{ To: &simnetAddr, @@ -1047,7 +904,7 @@ func testSendSignedTransaction(t *testing.T) { confs, err := ethClient.transactionConfirmations(ctx, txHash) // CoinNotFoundError OK for RPC wallet until mined. - if err != nil && !(useRPC && errors.Is(err, asset.CoinNotFoundError)) { + if err != nil && !errors.Is(err, asset.CoinNotFoundError) { t.Fatalf("transactionConfirmations error: %v", err) } if confs != 0 { @@ -1055,7 +912,7 @@ func testSendSignedTransaction(t *testing.T) { } spew.Dump(tx) - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatal(err) } @@ -1077,7 +934,7 @@ func testTransactionReceipt(t *testing.T) { if err != nil { t.Fatal(err) } - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatal(err) } receipt, err := waitForReceipt(ethClient, tx) @@ -1170,13 +1027,7 @@ func testInitiateGas(t *testing.T, assetID uint32) { // feesAtBlk calculates the gas fee at blkNum. This adds the base fee at blkNum // to a minimum gas tip cap. func feesAtBlk(ctx context.Context, n ethFetcher, blkNum int64) (fees *big.Int, err error) { - var hdr *types.Header - switch c := n.(type) { - case *nodeClient: - hdr, err = c.leth.ApiBackend.HeaderByNumber(ctx, rpc.BlockNumber(blkNum)) - case *multiRPCClient: - hdr, err = c.HeaderByNumber(ctx, big.NewInt(blkNum)) - } + hdr, err := n.(*multiRPCClient).HeaderByNumber(ctx, big.NewInt(blkNum)) if err != nil { return nil, err } @@ -1388,7 +1239,7 @@ func testInitiate(t *testing.T, assetID uint32) { t.Fatalf("%s: initiate error: %v", test.name, err) } - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("%s: post-initiate mining error: %v", test.name, err) } @@ -1506,7 +1357,7 @@ func testRedeemGas(t *testing.T, assetID uint32) { if err != nil { t.Fatalf("Unable to initiate swap: %v ", err) } - if err := waitForMined(8, true); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("unexpected error while waiting to mine: %v", err) } receipt, err := waitForReceipt(ethClient, tx) @@ -1718,7 +1569,7 @@ func testRedeem(t *testing.T, assetID uint32) { } // This waitForMined will always take test.sleepNBlocks to complete. - if err := waitForMined(test.sleepNBlocks, true); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("%s: post-init mining error: %v", test.name, err) } @@ -1774,7 +1625,7 @@ func testRedeem(t *testing.T, assetID uint32) { } spew.Dump(tx) - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("%s: post-redeem mining error: %v", test.name, err) } @@ -1884,7 +1735,7 @@ func testRefundGas(t *testing.T, assetID uint32) { if err != nil { t.Fatalf("Unable to initiate swap: %v ", err) } - if err := waitForMined(8, true); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("unexpected error while waiting to mine: %v", err) } @@ -1929,7 +1780,6 @@ func testRefund(t *testing.T, assetID uint32) { tc := c.(*tokenContractorV0) evmify = tc.evmify } - sleepForNBlocks := 8 tests := []struct { name string refunder *accounts.Account @@ -2015,7 +1865,7 @@ func testRefund(t *testing.T, assetID uint32) { } if test.redeem { - if err := waitForMined(sleepForNBlocks, false); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("%s: pre-redeem mining error: %v", test.name, err) } @@ -2030,7 +1880,7 @@ func testRefund(t *testing.T, assetID uint32) { } // This waitForMined will always take test.sleep to complete. - if err := waitForMined(sleepForNBlocks, true); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("unexpected post-init mining error for test %v: %v", test.name, err) } @@ -2075,7 +1925,7 @@ func testRefund(t *testing.T, assetID uint32) { t.Fatalf("%s: unexpected pending in balance %d", test.name, in) } - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("%s: post-refund mining error: %v", test.name, err) } @@ -2160,7 +2010,7 @@ func testApproveAllowance(t *testing.T) { t.Fatalf("initiator approveToken error: %v", err) } - if err := waitForMined(10, false); err != nil { + if err := waitForMined(); err != nil { t.Fatalf("post approve mining error: %v", err) } @@ -2265,24 +2115,6 @@ func testApproveGas(t *testing.T) { fmt.Printf("replacement tx hash: %s\n", tx.Hash()) }*/ -func testGetCodeAt(t *testing.T) { - cl, is := ethClient.(*nodeClient) - if !is { - t.Skip("getCode tests only run for nodeClient") - } - byteCode, err := cl.getCodeAt(ctx, ethSwapContractAddr) - if err != nil { - t.Fatalf("Failed to get bytecode: %v", err) - } - c, err := hex.DecodeString(swapv0.ETHSwapRuntimeBin) - if err != nil { - t.Fatalf("Error decoding") - } - if !bytes.Equal(byteCode, c) { - t.Fatal("Contract on chain does not match one in code") - } -} - func testSignMessage(t *testing.T) { msg := []byte("test message") sig, pubKey, err := ethClient.signData(msg) @@ -2329,13 +2161,3 @@ func bytesToArray(b []byte) (a [32]byte) { func bigUint(v uint64) *big.Int { return new(big.Int).SetUint64(v) } - -// exportAccountsFromNode returns all the accounts for which a the ethereum wallet -// has stored a private key. -func exportAccountsFromNode(node *node.Node) ([]accounts.Account, error) { - ks, err := exportKeyStoreFromNode(node) - if err != nil { - return nil, err - } - return ks.Accounts(), nil -} diff --git a/client/cmd/bisonw-desktop/go.mod b/client/cmd/bisonw-desktop/go.mod index 5fcfe4feaa..6570b7ded3 100644 --- a/client/cmd/bisonw-desktop/go.mod +++ b/client/cmd/bisonw-desktop/go.mod @@ -99,7 +99,6 @@ require ( github.com/ethereum/go-ethereum v1.11.5 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // 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 @@ -164,7 +163,6 @@ require ( github.com/russross/blackfriday/v2 v2.1.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/status-im/keycard-go v0.2.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect github.com/tevino/abool v1.2.0 // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect diff --git a/client/cmd/bisonw-desktop/go.sum b/client/cmd/bisonw-desktop/go.sum index 636c33d941..67ac27d604 100644 --- a/client/cmd/bisonw-desktop/go.sum +++ b/client/cmd/bisonw-desktop/go.sum @@ -323,7 +323,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/docker/docker v1.6.2 h1:HlFGsy+9/xrgMmhmN+NGhCc5SHGJ7I+kHosRR1xc/aI= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -368,7 +367,6 @@ github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3n github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gcash/bchd v0.14.7/go.mod h1:Gk/O1ktRVW5Kao0RsnVXp3bWxeYQadqawZ1Im9HE78M= github.com/gcash/bchd v0.15.2/go.mod h1:k9wIjgwnhbrAw+ruIPZ2tHZMzfFNdyUnORZZX7lqXGY= github.com/gcash/bchd v0.17.1/go.mod h1:qwEZ/wr6LyUo5IBgAPcAbYHzXrjnr5gc4tj03n1TwKc= @@ -693,7 +691,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= @@ -1087,7 +1084,6 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= diff --git a/dex/testing/loadbot/go.mod b/dex/testing/loadbot/go.mod index a5cf05b169..4c946c7a07 100644 --- a/dex/testing/loadbot/go.mod +++ b/dex/testing/loadbot/go.mod @@ -89,7 +89,6 @@ require ( github.com/ethereum/go-ethereum v1.11.5 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // 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 @@ -150,7 +149,6 @@ require ( github.com/rs/cors v1.8.2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/status-im/keycard-go v0.2.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect diff --git a/dex/testing/loadbot/go.sum b/dex/testing/loadbot/go.sum index 6aa7abe9aa..3f4dfbc99f 100644 --- a/dex/testing/loadbot/go.sum +++ b/dex/testing/loadbot/go.sum @@ -319,7 +319,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/docker/docker v1.6.2 h1:HlFGsy+9/xrgMmhmN+NGhCc5SHGJ7I+kHosRR1xc/aI= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -364,7 +363,6 @@ github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3n github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gcash/bchd v0.14.7/go.mod h1:Gk/O1ktRVW5Kao0RsnVXp3bWxeYQadqawZ1Im9HE78M= github.com/gcash/bchd v0.15.2/go.mod h1:k9wIjgwnhbrAw+ruIPZ2tHZMzfFNdyUnORZZX7lqXGY= github.com/gcash/bchd v0.17.1/go.mod h1:qwEZ/wr6LyUo5IBgAPcAbYHzXrjnr5gc4tj03n1TwKc= @@ -671,7 +669,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= @@ -1053,7 +1050,6 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= diff --git a/go.mod b/go.mod index 6aeefb98d6..4012073bef 100644 --- a/go.mod +++ b/go.mod @@ -107,7 +107,6 @@ require ( github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-ole/go-ole v1.2.6 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -160,7 +159,6 @@ require ( github.com/rs/cors v1.8.2 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect - github.com/status-im/keycard-go v0.2.0 // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/stretchr/testify v1.9.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect diff --git a/go.sum b/go.sum index fe8c48d81f..894349e16d 100644 --- a/go.sum +++ b/go.sum @@ -319,7 +319,6 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2 h1:tdlZCpZ/P9DhczCTSixgIKmwPv6+wP5DGjqLYw5SUiA= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/docker/docker v1.6.2 h1:HlFGsy+9/xrgMmhmN+NGhCc5SHGJ7I+kHosRR1xc/aI= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -365,7 +364,6 @@ github.com/fullstorydev/grpcurl v1.6.0/go.mod h1:ZQ+ayqbKMJNhzLmbpCiurTVlaK2M/3n github.com/fzipp/gocyclo v0.3.1/go.mod h1:DJHO6AUmbdqj2ET4Z9iArSuwWgYDRryYt2wASxc7x3E= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= github.com/gcash/bchd v0.14.7/go.mod h1:Gk/O1ktRVW5Kao0RsnVXp3bWxeYQadqawZ1Im9HE78M= github.com/gcash/bchd v0.15.2/go.mod h1:k9wIjgwnhbrAw+ruIPZ2tHZMzfFNdyUnORZZX7lqXGY= github.com/gcash/bchd v0.17.1/go.mod h1:qwEZ/wr6LyUo5IBgAPcAbYHzXrjnr5gc4tj03n1TwKc= @@ -679,7 +677,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= @@ -1065,7 +1062,6 @@ github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5q github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/ssgreg/nlreturn/v2 v2.1.0/go.mod h1:E/iiPB78hV7Szg2YfRgyIrk1AD6JVMTRkkxBiELzh2I= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= -github.com/status-im/keycard-go v0.2.0/go.mod h1:wlp8ZLbsmrF6g6WjugPAx+IzoLrkdf9+mHxBEeo3Hbg= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI=