diff --git a/.golangci.yml b/.golangci.yml
index 3af777b0bf..78fd47ac3d 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -65,5 +65,6 @@ issues:
exclude:
- 'SA1019: event.TypeMux is deprecated: use Feed'
- 'SA1019: strings.Title is deprecated'
+ - 'SA1019: strings.Title has been deprecated since Go 1.18 and an alternative has been available since Go 1.0: The rule Title uses for word boundaries does not handle Unicode punctuation properly. Use golang.org/x/text/cases instead.'
- 'SA1029: should not use built-in type string as key for value'
- 'G306: Expect WriteFile permissions to be 0600 or less'
\ No newline at end of file
diff --git a/accounts/accounts.go b/accounts/accounts.go
index 014f772dea..0cddc9f659 100644
--- a/accounts/accounts.go
+++ b/accounts/accounts.go
@@ -47,7 +47,7 @@ const (
// accounts (derived from the same seed).
type Wallet interface {
// URL retrieves the canonical path under which this wallet is reachable. It is
- // user by upper layers to define a sorting order over all wallets from multiple
+ // used by upper layers to define a sorting order over all wallets from multiple
// backends.
URL() URL
@@ -89,8 +89,8 @@ type Wallet interface {
// to discover non zero accounts and automatically add them to list of tracked
// accounts.
//
- // Note, self derivaton will increment the last component of the specified path
- // opposed to decending into a child path to allow discovering accounts starting
+ // Note, self derivation will increment the last component of the specified path
+ // opposed to descending into a child path to allow discovering accounts starting
// from non zero components.
//
// Some hardware wallets switched derivation paths through their evolution, so
@@ -101,27 +101,26 @@ type Wallet interface {
// chain state reader.
SelfDerive(bases []DerivationPath, chain ethereum.ChainStateReader)
- // SignHash requests the wallet to sign the given hash.
- //
+ // SignData requests the wallet to sign the hash of the given data
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
//
// If the wallet requires additional authentication to sign the request (e.g.
- // a password to decrypt the account, or a PIN code o verify the transaction),
+ // a password to decrypt the account, or a PIN code to verify the transaction),
// an AuthNeededError instance will be returned, containing infos for the user
// about which fields or actions are needed. The user may retry by providing
- // the needed details via SignHashWithPassphrase, or by other means (e.g. unlock
+ // the needed details via SignDataWithPassphrase, or by other means (e.g. unlock
// the account in a keystore).
- SignHash(account Account, hash []byte) ([]byte, error)
+ SignData(account Account, mimeType string, data []byte) ([]byte, error)
// SignDataWithPassphrase is identical to SignData, but also takes a password
- // NOTE: there's an chance that an erroneous call might mistake the two strings, and
+ // NOTE: there's a chance that an erroneous call might mistake the two strings, and
// supply password in the mimetype field, or vice versa. Thus, an implementation
// should never echo the mimetype or return the mimetype in the error-response
SignDataWithPassphrase(account Account, passphrase, mimeType string, data []byte) ([]byte, error)
- // SignTx requests the wallet to sign the given transaction.
- //
+ // SignText requests the wallet to sign the hash of a given piece of data, prefixed
+ // by the Ethereum prefix scheme
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
//
@@ -129,22 +128,29 @@ type Wallet interface {
// a password to decrypt the account, or a PIN code to verify the transaction),
// an AuthNeededError instance will be returned, containing infos for the user
// about which fields or actions are needed. The user may retry by providing
- // the needed details via SignTxWithPassphrase, or by other means (e.g. unlock
+ // the needed details via SignTextWithPassphrase, or by other means (e.g. unlock
// the account in a keystore).
- SignTx(account Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
-
- // SignHashWithPassphrase requests the wallet to sign the given hash with the
- // given passphrase as extra authentication information.
//
- // It looks up the account specified either solely via its address contained within,
- // or optionally with the aid of any location metadata from the embedded URL field.
- SignHashWithPassphrase(account Account, passphrase string, hash []byte) ([]byte, error)
+ // This method should return the signature in 'canonical' format, with v 0 or 1.
+ SignText(account Account, text []byte) ([]byte, error)
- // SignTxWithPassphrase requests the wallet to sign the given transaction, with the
- // given passphrase as extra authentication information.
+ // SignTextWithPassphrase is identical to Signtext, but also takes a password
+ SignTextWithPassphrase(account Account, passphrase string, hash []byte) ([]byte, error)
+
+ // SignTx requests the wallet to sign the given transaction.
//
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
+ //
+ // If the wallet requires additional authentication to sign the request (e.g.
+ // a password to decrypt the account, or a PIN code to verify the transaction),
+ // an AuthNeededError instance will be returned, containing infos for the user
+ // about which fields or actions are needed. The user may retry by providing
+ // the needed details via SignTxWithPassphrase, or by other means (e.g. unlock
+ // the account in a keystore).
+ SignTx(account Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
+
+ // SignTxWithPassphrase is identical to SignTx, but also takes a password
SignTxWithPassphrase(account Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error)
}
@@ -172,8 +178,7 @@ type Backend interface {
// safely used to calculate a signature from.
//
// The hash is calculated as
-//
-// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
+// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// This gives context to the signed message and prevents signing of transactions.
func TextHash(data []byte) []byte {
@@ -185,8 +190,7 @@ func TextHash(data []byte) []byte {
// safely used to calculate a signature from.
//
// The hash is calculated as
-//
-// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
+// keccak256("\x19Ethereum Signed Message:\n"${message length}${message}).
//
// This gives context to the signed message and prevents signing of transactions.
func TextAndHash(data []byte) ([]byte, string) {
diff --git a/accounts/accounts_test.go b/accounts/accounts_test.go
new file mode 100644
index 0000000000..9f91aa2872
--- /dev/null
+++ b/accounts/accounts_test.go
@@ -0,0 +1,32 @@
+// Copyright 2015 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 .
+
+package accounts
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/PlatONnetwork/PlatON-Go/common/hexutil"
+)
+
+func TestTextHash(t *testing.T) {
+ hash := TextHash([]byte("Hello Joe"))
+ want := hexutil.MustDecode("0xa080337ae51c4e064c189e113edd0ba391df9206e2f49db658bb32cf2911730b")
+ if !bytes.Equal(hash, want) {
+ t.Fatalf("wrong hash: %x", hash)
+ }
+}
diff --git a/accounts/external/backend.go b/accounts/external/backend.go
new file mode 100644
index 0000000000..26e87e761d
--- /dev/null
+++ b/accounts/external/backend.go
@@ -0,0 +1,269 @@
+// Copyright 2019 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 .
+
+package external
+
+import (
+ "fmt"
+ ethereum "github.com/PlatONnetwork/PlatON-Go"
+ "math/big"
+ "sync"
+
+ "github.com/PlatONnetwork/PlatON-Go/accounts"
+ "github.com/PlatONnetwork/PlatON-Go/common"
+ "github.com/PlatONnetwork/PlatON-Go/common/hexutil"
+ "github.com/PlatONnetwork/PlatON-Go/core/types"
+ "github.com/PlatONnetwork/PlatON-Go/event"
+ "github.com/PlatONnetwork/PlatON-Go/log"
+ "github.com/PlatONnetwork/PlatON-Go/rpc"
+ "github.com/PlatONnetwork/PlatON-Go/signer/core/apitypes"
+)
+
+type ExternalBackend struct {
+ signers []accounts.Wallet
+}
+
+func (eb *ExternalBackend) Wallets() []accounts.Wallet {
+ return eb.signers
+}
+
+func NewExternalBackend(endpoint string) (*ExternalBackend, error) {
+ signer, err := NewExternalSigner(endpoint)
+ if err != nil {
+ return nil, err
+ }
+ return &ExternalBackend{
+ signers: []accounts.Wallet{signer},
+ }, nil
+}
+
+func (eb *ExternalBackend) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription {
+ return event.NewSubscription(func(quit <-chan struct{}) error {
+ <-quit
+ return nil
+ })
+}
+
+// ExternalSigner provides an API to interact with an external signer (clef)
+// It proxies request to the external signer while forwarding relevant
+// request headers
+type ExternalSigner struct {
+ client *rpc.Client
+ endpoint string
+ status string
+ cacheMu sync.RWMutex
+ cache []accounts.Account
+}
+
+func NewExternalSigner(endpoint string) (*ExternalSigner, error) {
+ client, err := rpc.Dial(endpoint)
+ if err != nil {
+ return nil, err
+ }
+ extsigner := &ExternalSigner{
+ client: client,
+ endpoint: endpoint,
+ }
+ // Check if reachable
+ version, err := extsigner.pingVersion()
+ if err != nil {
+ return nil, err
+ }
+ extsigner.status = fmt.Sprintf("ok [version=%v]", version)
+ return extsigner, nil
+}
+
+func (api *ExternalSigner) URL() accounts.URL {
+ return accounts.URL{
+ Scheme: "extapi",
+ Path: api.endpoint,
+ }
+}
+
+func (api *ExternalSigner) Status() (string, error) {
+ return api.status, nil
+}
+
+func (api *ExternalSigner) Open(passphrase string) error {
+ return fmt.Errorf("operation not supported on external signers")
+}
+
+func (api *ExternalSigner) Close() error {
+ return fmt.Errorf("operation not supported on external signers")
+}
+
+func (api *ExternalSigner) Accounts() []accounts.Account {
+ var accnts []accounts.Account
+ res, err := api.listAccounts()
+ if err != nil {
+ log.Error("account listing failed", "error", err)
+ return accnts
+ }
+ for _, addr := range res {
+ accnts = append(accnts, accounts.Account{
+ URL: accounts.URL{
+ Scheme: "extapi",
+ Path: api.endpoint,
+ },
+ Address: addr,
+ })
+ }
+ api.cacheMu.Lock()
+ api.cache = accnts
+ api.cacheMu.Unlock()
+ return accnts
+}
+
+func (api *ExternalSigner) Contains(account accounts.Account) bool {
+ api.cacheMu.RLock()
+ defer api.cacheMu.RUnlock()
+ if api.cache == nil {
+ // If we haven't already fetched the accounts, it's time to do so now
+ api.cacheMu.RUnlock()
+ api.Accounts()
+ api.cacheMu.RLock()
+ }
+ for _, a := range api.cache {
+ if a.Address == account.Address && (account.URL == (accounts.URL{}) || account.URL == api.URL()) {
+ return true
+ }
+ }
+ return false
+}
+
+func (api *ExternalSigner) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error) {
+ return accounts.Account{}, fmt.Errorf("operation not supported on external signers")
+}
+
+func (api *ExternalSigner) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader) {
+ log.Error("operation SelfDerive not supported on external signers")
+}
+
+// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed
+func (api *ExternalSigner) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
+ var res hexutil.Bytes
+ var signAddress = common.NewMixedcaseAddress(account.Address)
+ if err := api.client.Call(&res, "account_signData",
+ mimeType,
+ &signAddress, // Need to use the pointer here, because of how MarshalJSON is defined
+ hexutil.Encode(data)); err != nil {
+ return nil, err
+ }
+ // If V is on 27/28-form, convert to 0/1 for Clique
+ if mimeType == accounts.MimetypeClique && (res[64] == 27 || res[64] == 28) {
+ res[64] -= 27 // Transform V from 27/28 to 0/1 for Clique use
+ }
+ return res, nil
+}
+
+func (api *ExternalSigner) SignText(account accounts.Account, text []byte) ([]byte, error) {
+ var signature hexutil.Bytes
+ var signAddress = common.NewMixedcaseAddress(account.Address)
+ if err := api.client.Call(&signature, "account_signData",
+ accounts.MimetypeTextPlain,
+ &signAddress, // Need to use the pointer here, because of how MarshalJSON is defined
+ hexutil.Encode(text)); err != nil {
+ return nil, err
+ }
+ if signature[64] == 27 || signature[64] == 28 {
+ // If clef is used as a backend, it may already have transformed
+ // the signature to ethereum-type signature.
+ signature[64] -= 27 // Transform V from Ethereum-legacy to 0/1
+ }
+ return signature, nil
+}
+
+// signTransactionResult represents the signinig result returned by clef.
+type signTransactionResult struct {
+ Raw hexutil.Bytes `json:"raw"`
+ Tx *types.Transaction `json:"tx"`
+}
+
+// SignTx sends the transaction to the external signer.
+// If chainID is nil, or tx.ChainID is zero, the chain ID will be assigned
+// by the external signer. For non-legacy transactions, the chain ID of the
+// transaction overrides the chainID parameter.
+func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
+ data := hexutil.Bytes(tx.Data())
+ var to *common.MixedcaseAddress
+ if tx.To() != nil {
+ t := common.NewMixedcaseAddress(*tx.To())
+ to = &t
+ }
+ args := &apitypes.SendTxArgs{
+ Data: &data,
+ Nonce: hexutil.Uint64(tx.Nonce()),
+ Value: hexutil.Big(*tx.Value()),
+ Gas: hexutil.Uint64(tx.Gas()),
+ To: to,
+ From: common.NewMixedcaseAddress(account.Address),
+ }
+ switch tx.Type() {
+ case types.LegacyTxType, types.AccessListTxType:
+ args.GasPrice = (*hexutil.Big)(tx.GasPrice())
+ case types.DynamicFeeTxType:
+ args.MaxFeePerGas = (*hexutil.Big)(tx.GasFeeCap())
+ args.MaxPriorityFeePerGas = (*hexutil.Big)(tx.GasTipCap())
+ default:
+ return nil, fmt.Errorf("unsupported tx type %d", tx.Type())
+ }
+ // We should request the default chain id that we're operating with
+ // (the chain we're executing on)
+ if chainID != nil && chainID.Sign() != 0 {
+ args.ChainID = (*hexutil.Big)(chainID)
+ }
+ if tx.Type() != types.LegacyTxType {
+ // However, if the user asked for a particular chain id, then we should
+ // use that instead.
+ if tx.ChainId().Sign() != 0 {
+ args.ChainID = (*hexutil.Big)(tx.ChainId())
+ }
+ accessList := tx.AccessList()
+ args.AccessList = &accessList
+ }
+ var res signTransactionResult
+ if err := api.client.Call(&res, "account_signTransaction", args); err != nil {
+ return nil, err
+ }
+ return res.Tx, nil
+}
+
+func (api *ExternalSigner) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
+ return []byte{}, fmt.Errorf("password-operations not supported on external signers")
+}
+
+func (api *ExternalSigner) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
+ return nil, fmt.Errorf("password-operations not supported on external signers")
+}
+func (api *ExternalSigner) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
+ return nil, fmt.Errorf("password-operations not supported on external signers")
+}
+
+func (api *ExternalSigner) listAccounts() ([]common.Address, error) {
+ var res []common.Address
+ if err := api.client.Call(&res, "account_list"); err != nil {
+ return nil, err
+ }
+ return res, nil
+}
+
+func (api *ExternalSigner) pingVersion() (string, error) {
+ var v string
+ if err := api.client.Call(&v, "account_version"); err != nil {
+ return "", err
+ }
+ return v, nil
+}
diff --git a/accounts/keystore/wallet.go b/accounts/keystore/wallet.go
index 79b945e573..8803beb458 100644
--- a/accounts/keystore/wallet.go
+++ b/accounts/keystore/wallet.go
@@ -53,8 +53,8 @@ func (w *keystoreWallet) Status() (string, error) {
// is no connection or decryption step necessary to access the list of accounts.
func (w *keystoreWallet) Open(passphrase string) error { return nil }
-// Close implements accounts.Wallet, but is a noop for plain wallets since is no
-// meaningful open operation.
+// Close implements accounts.Wallet, but is a noop for plain wallets since there
+// is no meaningful open operation.
func (w *keystoreWallet) Close() error { return nil }
// Accounts implements accounts.Wallet, returning an account list consisting of
@@ -80,11 +80,11 @@ func (w *keystoreWallet) Derive(path accounts.DerivationPath, pin bool) (account
func (w *keystoreWallet) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader) {
}
-// SignHash implements accounts.Wallet, attempting to sign the given hash with
+// signHash attempts to sign the given hash with
// the given account. If the wallet does not wrap this particular account, an
// error is returned to avoid account leakage (even though in theory we may be
// able to sign via our shared keystore backend).
-func (w *keystoreWallet) SignHash(account accounts.Account, hash []byte) ([]byte, error) {
+func (w *keystoreWallet) signHash(account accounts.Account, hash []byte) ([]byte, error) {
// Make sure the requested account is contained within
if !w.Contains(account) {
return nil, accounts.ErrUnknownAccount
@@ -93,38 +93,49 @@ func (w *keystoreWallet) SignHash(account accounts.Account, hash []byte) ([]byte
return w.keystore.SignHash(account, hash)
}
-// SignTx implements accounts.Wallet, attempting to sign the given transaction
-// with the given account. If the wallet does not wrap this particular account,
-// an error is returned to avoid account leakage (even though in theory we may
-// be able to sign via our shared keystore backend).
-func (w *keystoreWallet) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
+// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed.
+func (w *keystoreWallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
+ return w.signHash(account, crypto.Keccak256(data))
+}
+
+// SignDataWithPassphrase signs keccak256(data). The mimetype parameter describes the type of data being signed.
+func (w *keystoreWallet) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
// Make sure the requested account is contained within
if !w.Contains(account) {
return nil, accounts.ErrUnknownAccount
}
// Account seems valid, request the keystore to sign
- return w.keystore.SignTx(account, tx, chainID)
+ return w.keystore.SignHashWithPassphrase(account, passphrase, crypto.Keccak256(data))
}
-// SignDataWithPassphrase signs keccak256(data). The mimetype parameter describes the type of data being signed.
-func (w *keystoreWallet) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
+// SignText implements accounts.Wallet, attempting to sign the hash of
+// the given text with the given account.
+func (w *keystoreWallet) SignText(account accounts.Account, text []byte) ([]byte, error) {
+ return w.signHash(account, accounts.TextHash(text))
+}
+
+// SignTextWithPassphrase implements accounts.Wallet, attempting to sign the
+// hash of the given text with the given account using passphrase as extra authentication.
+func (w *keystoreWallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
// Make sure the requested account is contained within
if !w.Contains(account) {
return nil, accounts.ErrUnknownAccount
}
// Account seems valid, request the keystore to sign
- return w.keystore.SignHashWithPassphrase(account, passphrase, crypto.Keccak256(data))
+ return w.keystore.SignHashWithPassphrase(account, passphrase, accounts.TextHash(text))
}
-// SignHashWithPassphrase implements accounts.Wallet, attempting to sign the
-// given hash with the given account using passphrase as extra authentication.
-func (w *keystoreWallet) SignHashWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error) {
+// SignTx implements accounts.Wallet, attempting to sign the given transaction
+// with the given account. If the wallet does not wrap this particular account,
+// an error is returned to avoid account leakage (even though in theory we may
+// be able to sign via our shared keystore backend).
+func (w *keystoreWallet) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
// Make sure the requested account is contained within
if !w.Contains(account) {
return nil, accounts.ErrUnknownAccount
}
// Account seems valid, request the keystore to sign
- return w.keystore.SignHashWithPassphrase(account, passphrase, hash)
+ return w.keystore.SignTx(account, tx, chainID)
}
// SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given
diff --git a/accounts/scwallet/README.md b/accounts/scwallet/README.md
new file mode 100644
index 0000000000..4313d9c6b2
--- /dev/null
+++ b/accounts/scwallet/README.md
@@ -0,0 +1,106 @@
+# Using the smartcard wallet
+
+## Requirements
+
+ * A USB smartcard reader
+ * A keycard that supports the status app
+ * PCSCD version 4.3 running on your system **Only version 4.3 is currently supported**
+
+## Preparing the smartcard
+
+ **WARNING: FOILLOWING THESE INSTRUCTIONS WILL DESTROY THE MASTER KEY ON YOUR CARD. ONLY PROCEED IF NO FUNDS ARE ASSOCIATED WITH THESE ACCOUNTS**
+
+ You can use status' [keycard-cli](https://github.com/status-im/keycard-cli) and you should get _at least_ version 2.1.1 of their [smartcard application](https://github.com/status-im/status-keycard/releases/download/2.2.1/keycard_v2.2.1.cap)
+
+ You also need to make sure that the PCSC daemon is running on your system.
+
+ Then, you can install the application to the card by typing:
+
+ ```
+ keycard install -a keycard_v2.2.1.cap && keycard init
+ ```
+
+ At the end of this process, you will be provided with a PIN, a PUK and a pairing password. Write them down, you'll need them shortly.
+
+ Start `geth` with the `console` command. You will notice the following warning:
+
+ ```
+ WARN [04-09|16:58:38.898] Failed to open wallet url=keycard://044def09 err="smartcard: pairing password needed"
+ ```
+
+ Write down the URL (`keycard://044def09` in this example). Then ask `geth` to open the wallet:
+
+ ```
+ > personal.openWallet("keycard://044def09", "pairing password")
+ ```
+
+ The pairing password has been generated during the card initialization process.
+
+ The process needs to be repeated once more with the PIN:
+
+ ```
+ > personal.openWallet("keycard://044def09", "PIN number")
+ ```
+
+ If everything goes well, you should see your new account when typing `personal` on the console:
+
+ ```
+ > personal
+ WARN [04-09|17:02:07.330] Smartcard wallet account derivation failed url=keycard://044def09 err="Unexpected response status Cla=0x80, Ins=0xd1, Sw=0x6985"
+ {
+ listAccounts: [],
+ listWallets: [{
+ status: "Empty, waiting for initialization",
+ url: "keycard://044def09"
+ }],
+ ...
+ }
+ ```
+
+ So the communication with the card is working, but there is no key associated with this wallet. Let's create it:
+
+ ```
+ > personal.initializeWallet("keycard://044def09")
+ "tilt ... impact"
+ ```
+
+ You should get a list of words, this is your seed so write them down. Your wallet should now be initialized:
+
+ ```
+ > personal.listWallets
+ [{
+ accounts: [{
+ address: "0x678b7cd55c61917defb23546a41803c5bfefbc7a",
+ url: "keycard://044d/m/44'/60'/0'/0/0"
+ }],
+ status: "Online",
+ url: "keycard://044def09"
+ }]
+ ```
+
+ You're all set!
+
+## Usage
+
+ 1. Start `geth` with the `console` command
+ 2. Check the card's URL by checking `personal.listWallets`:
+
+```
+ listWallets: [{
+ status: "Online, can derive public keys",
+ url: "keycard://a4d73015"
+ }]
+```
+
+ 3. Open the wallet, you will be prompted for your pairing password, then PIN:
+
+```
+personal.openWallet("keycard://a4d73015")
+```
+
+ 4. Check that creation was successful by typing e.g. `personal`. Then use it like a regular wallet.
+
+## Known issues
+
+ * Starting geth with a valid card seems to make firefox crash.
+ * PCSC version 4.4 should work, but is currently untested
diff --git a/accounts/scwallet/hud.go b/accounts/scwallet/hub.go
similarity index 99%
rename from accounts/scwallet/hud.go
rename to accounts/scwallet/hub.go
index 53c7211a81..d8ce34259a 100644
--- a/accounts/scwallet/hud.go
+++ b/accounts/scwallet/hub.go
@@ -41,12 +41,11 @@ import (
"sync"
"time"
- pcsc "github.com/gballet/go-libpcsclite"
-
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/event"
"github.com/PlatONnetwork/PlatON-Go/log"
+ pcsc "github.com/gballet/go-libpcsclite"
)
// Scheme is the URI prefix for smartcard wallets.
@@ -221,7 +220,7 @@ func (hub *Hub) refreshWallets() {
// Mark the reader as present
seen[reader] = struct{}{}
- // If we alreay know about this card, skip to the next reader, otherwise clean up
+ // If we already know about this card, skip to the next reader, otherwise clean up
if wallet, ok := hub.wallets[reader]; ok {
if err := wallet.ping(); err == nil {
continue
diff --git a/accounts/scwallet/wallet.go b/accounts/scwallet/wallet.go
index ca42d664e6..c8e7533850 100644
--- a/accounts/scwallet/wallet.go
+++ b/accounts/scwallet/wallet.go
@@ -364,7 +364,7 @@ func (w *Wallet) Open(passphrase string) error {
return err
}
// Pairing succeeded, fall through to PIN checks. This will of course fail,
- // but we can't return ErrPINNeeded directly here becase we don't know whether
+ // but we can't return ErrPINNeeded directly here because we don't know whether
// a PIN check or a PIN reset is needed.
passphrase = ""
}
@@ -639,8 +639,8 @@ func (w *Wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
// to discover non zero accounts and automatically add them to list of tracked
// accounts.
//
-// Note, self derivaton will increment the last component of the specified path
-// opposed to decending into a child path to allow discovering accounts starting
+// Note, self derivation will increment the last component of the specified path
+// opposed to descending into a child path to allow discovering accounts starting
// from non zero components.
//
// Some hardware wallets switched derivation paths through their evolution, so
@@ -729,7 +729,7 @@ func (w *Wallet) signHashWithPassphrase(account accounts.Account, passphrase str
return w.signHash(account, hash)
}
-// SignHash requests the wallet to sign the hash of a given piece of data, prefixed
+// SignText requests the wallet to sign the hash of a given piece of data, prefixed
// by the Ethereum prefix scheme
// It looks up the account specified either solely via its address contained within,
// or optionally with the aid of any location metadata from the embedded URL field.
@@ -740,13 +740,13 @@ func (w *Wallet) signHashWithPassphrase(account accounts.Account, passphrase str
// about which fields or actions are needed. The user may retry by providing
// the needed details via SignHashWithPassphrase, or by other means (e.g. unlock
// the account in a keystore).
-func (w *Wallet) SignHash(account accounts.Account, text []byte) ([]byte, error) {
+func (w *Wallet) SignText(account accounts.Account, text []byte) ([]byte, error) {
return w.signHash(account, accounts.TextHash(text))
}
// SignTextWithPassphrase implements accounts.Wallet, attempting to sign the
// given hash with the given account using passphrase as extra authentication
-func (w *Wallet) SignHashWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
+func (w *Wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return w.signHashWithPassphrase(account, passphrase, crypto.Keccak256(accounts.TextHash(text)))
}
@@ -881,7 +881,6 @@ func (s *Session) walletStatus() (*walletStatus, error) {
}
// derivationPath fetches the wallet's current derivation path from the card.
-//
//lint:ignore U1000 needs to be added to the console interface
func (s *Session) derivationPath() (accounts.DerivationPath, error) {
response, err := s.Channel.transmitEncrypted(claSCWallet, insStatus, statusP1Path, 0, nil)
@@ -997,7 +996,6 @@ func (s *Session) derive(path accounts.DerivationPath) (accounts.Account, error)
}
// keyExport contains information on an exported keypair.
-//
//lint:ignore U1000 needs to be added to the console interface
type keyExport struct {
PublicKey []byte `asn1:"tag:0"`
@@ -1005,7 +1003,6 @@ type keyExport struct {
}
// publicKey returns the public key for the current derivation path.
-//
//lint:ignore U1000 needs to be added to the console interface
func (s *Session) publicKey() ([]byte, error) {
response, err := s.Channel.transmitEncrypted(claSCWallet, insExportKey, exportP1Any, exportP2Pubkey, nil)
diff --git a/accounts/usbwallet/hub.go b/accounts/usbwallet/hub.go
index e34f4df432..01f7d71bc1 100644
--- a/accounts/usbwallet/hub.go
+++ b/accounts/usbwallet/hub.go
@@ -18,14 +18,15 @@ package usbwallet
import (
"errors"
+ "github.com/karalabe/usb"
"runtime"
"sync"
+ "sync/atomic"
"time"
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/event"
"github.com/PlatONnetwork/PlatON-Go/log"
- "github.com/karalabe/hid"
)
// LedgerScheme is the protocol scheme prefixing account and wallet URLs.
@@ -64,21 +65,41 @@ type Hub struct {
// TODO(karalabe): remove if hotplug lands on Windows
commsPend int // Number of operations blocking enumeration
commsLock sync.Mutex // Lock protecting the pending counter and enumeration
+ enumFails uint32 // Number of times enumeration has failed
}
// NewLedgerHub creates a new hardware wallet manager for Ledger devices.
func NewLedgerHub() (*Hub, error) {
- return newHub(LedgerScheme, 0x2c97, []uint16{0x0000 /* Ledger Blue */, 0x0001 /* Ledger Nano S */}, 0xffa0, 0, newLedgerDriver)
+ return newHub(LedgerScheme, 0x2c97, []uint16{
+ // Original product IDs
+ 0x0000, /* Ledger Blue */
+ 0x0001, /* Ledger Nano S */
+ 0x0004, /* Ledger Nano X */
+
+ // Upcoming product IDs: https://www.ledger.com/2019/05/17/windows-10-update-sunsetting-u2f-tunnel-transport-for-ledger-devices/
+ 0x0015, /* HID + U2F + WebUSB Ledger Blue */
+ 0x1015, /* HID + U2F + WebUSB Ledger Nano S */
+ 0x4015, /* HID + U2F + WebUSB Ledger Nano X */
+ 0x0011, /* HID + WebUSB Ledger Blue */
+ 0x1011, /* HID + WebUSB Ledger Nano S */
+ 0x4011, /* HID + WebUSB Ledger Nano X */
+ }, 0xffa0, 0, newLedgerDriver)
}
-// NewTrezorHub creates a new hardware wallet manager for Trezor devices.
-func NewTrezorHub() (*Hub, error) {
- return newHub(TrezorScheme, 0x534c, []uint16{0x0001 /* Trezor 1 */}, 0xff00, 0, newTrezorDriver)
+// NewTrezorHubWithHID creates a new hardware wallet manager for Trezor devices.
+func NewTrezorHubWithHID() (*Hub, error) {
+ return newHub(TrezorScheme, 0x534c, []uint16{0x0001 /* Trezor HID */}, 0xff00, 0, newTrezorDriver)
+}
+
+// NewTrezorHubWithWebUSB creates a new hardware wallet manager for Trezor devices with
+// firmware version > 1.8.0
+func NewTrezorHubWithWebUSB() (*Hub, error) {
+ return newHub(TrezorScheme, 0x1209, []uint16{0x53c1 /* Trezor WebUSB */}, 0xffff /* No usage id on webusb, don't match unset (0) */, 0, newTrezorDriver)
}
// newHub creates a new hardware wallet manager for generic USB devices.
func newHub(scheme string, vendorID uint16, productIDs []uint16, usageID uint16, endpointID int, makeDriver func(log.Logger) driver) (*Hub, error) {
- if !hid.Supported() {
+ if !usb.Supported() {
return nil, errors.New("unsupported platform")
}
hub := &Hub{
@@ -119,8 +140,12 @@ func (hub *Hub) refreshWallets() {
if elapsed < refreshThrottling {
return
}
+ // If USB enumeration is continually failing, don't keep trying indefinitely
+ if atomic.LoadUint32(&hub.enumFails) > 2 {
+ return
+ }
// Retrieve the current list of USB wallet devices
- var devices []hid.DeviceInfo
+ var devices []usb.DeviceInfo
if runtime.GOOS == "linux" {
// hidapi on Linux opens the device during enumeration to retrieve some infos,
@@ -135,8 +160,22 @@ func (hub *Hub) refreshWallets() {
return
}
}
- for _, info := range hid.Enumerate(hub.vendorID, 0) {
+ infos, err := usb.Enumerate(hub.vendorID, 0)
+ if err != nil {
+ failcount := atomic.AddUint32(&hub.enumFails, 1)
+ if runtime.GOOS == "linux" {
+ // See rationale before the enumeration why this is needed and only on Linux.
+ hub.commsLock.Unlock()
+ }
+ log.Error("Failed to enumerate USB devices", "hub", hub.scheme,
+ "vendor", hub.vendorID, "failcount", failcount, "err", err)
+ return
+ }
+ atomic.StoreUint32(&hub.enumFails, 0)
+
+ for _, info := range infos {
for _, id := range hub.productIDs {
+ // Windows and Macos use UsageID matching, Linux uses Interface matching
if info.ProductID == id && (info.UsagePage == hub.usageID || info.Interface == hub.endpointID) {
devices = append(devices, info)
break
diff --git a/accounts/usbwallet/internal/trezor/messages.pb.go b/accounts/usbwallet/internal/trezor/messages.pb.go
deleted file mode 100644
index 15bb6fb73b..0000000000
--- a/accounts/usbwallet/internal/trezor/messages.pb.go
+++ /dev/null
@@ -1,3081 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: messages.proto
-
-package trezor
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// *
-// Mapping between Trezor wire identifier (uint) and a protobuf message
-type MessageType int32
-
-const (
- MessageType_MessageType_Initialize MessageType = 0
- MessageType_MessageType_Ping MessageType = 1
- MessageType_MessageType_Success MessageType = 2
- MessageType_MessageType_Failure MessageType = 3
- MessageType_MessageType_ChangePin MessageType = 4
- MessageType_MessageType_WipeDevice MessageType = 5
- MessageType_MessageType_FirmwareErase MessageType = 6
- MessageType_MessageType_FirmwareUpload MessageType = 7
- MessageType_MessageType_FirmwareRequest MessageType = 8
- MessageType_MessageType_GetEntropy MessageType = 9
- MessageType_MessageType_Entropy MessageType = 10
- MessageType_MessageType_GetPublicKey MessageType = 11
- MessageType_MessageType_PublicKey MessageType = 12
- MessageType_MessageType_LoadDevice MessageType = 13
- MessageType_MessageType_ResetDevice MessageType = 14
- MessageType_MessageType_SignTx MessageType = 15
- MessageType_MessageType_SimpleSignTx MessageType = 16
- MessageType_MessageType_Features MessageType = 17
- MessageType_MessageType_PinMatrixRequest MessageType = 18
- MessageType_MessageType_PinMatrixAck MessageType = 19
- MessageType_MessageType_Cancel MessageType = 20
- MessageType_MessageType_TxRequest MessageType = 21
- MessageType_MessageType_TxAck MessageType = 22
- MessageType_MessageType_CipherKeyValue MessageType = 23
- MessageType_MessageType_ClearSession MessageType = 24
- MessageType_MessageType_ApplySettings MessageType = 25
- MessageType_MessageType_ButtonRequest MessageType = 26
- MessageType_MessageType_ButtonAck MessageType = 27
- MessageType_MessageType_ApplyFlags MessageType = 28
- MessageType_MessageType_GetAddress MessageType = 29
- MessageType_MessageType_Address MessageType = 30
- MessageType_MessageType_SelfTest MessageType = 32
- MessageType_MessageType_BackupDevice MessageType = 34
- MessageType_MessageType_EntropyRequest MessageType = 35
- MessageType_MessageType_EntropyAck MessageType = 36
- MessageType_MessageType_SignMessage MessageType = 38
- MessageType_MessageType_VerifyMessage MessageType = 39
- MessageType_MessageType_MessageSignature MessageType = 40
- MessageType_MessageType_PassphraseRequest MessageType = 41
- MessageType_MessageType_PassphraseAck MessageType = 42
- MessageType_MessageType_EstimateTxSize MessageType = 43
- MessageType_MessageType_TxSize MessageType = 44
- MessageType_MessageType_RecoveryDevice MessageType = 45
- MessageType_MessageType_WordRequest MessageType = 46
- MessageType_MessageType_WordAck MessageType = 47
- MessageType_MessageType_CipheredKeyValue MessageType = 48
- MessageType_MessageType_EncryptMessage MessageType = 49
- MessageType_MessageType_EncryptedMessage MessageType = 50
- MessageType_MessageType_DecryptMessage MessageType = 51
- MessageType_MessageType_DecryptedMessage MessageType = 52
- MessageType_MessageType_SignIdentity MessageType = 53
- MessageType_MessageType_SignedIdentity MessageType = 54
- MessageType_MessageType_GetFeatures MessageType = 55
- MessageType_MessageType_EthereumGetAddress MessageType = 56
- MessageType_MessageType_EthereumAddress MessageType = 57
- MessageType_MessageType_EthereumSignTx MessageType = 58
- MessageType_MessageType_EthereumTxRequest MessageType = 59
- MessageType_MessageType_EthereumTxAck MessageType = 60
- MessageType_MessageType_GetECDHSessionKey MessageType = 61
- MessageType_MessageType_ECDHSessionKey MessageType = 62
- MessageType_MessageType_SetU2FCounter MessageType = 63
- MessageType_MessageType_EthereumSignMessage MessageType = 64
- MessageType_MessageType_EthereumVerifyMessage MessageType = 65
- MessageType_MessageType_EthereumMessageSignature MessageType = 66
- MessageType_MessageType_DebugLinkDecision MessageType = 100
- MessageType_MessageType_DebugLinkGetState MessageType = 101
- MessageType_MessageType_DebugLinkState MessageType = 102
- MessageType_MessageType_DebugLinkStop MessageType = 103
- MessageType_MessageType_DebugLinkLog MessageType = 104
- MessageType_MessageType_DebugLinkMemoryRead MessageType = 110
- MessageType_MessageType_DebugLinkMemory MessageType = 111
- MessageType_MessageType_DebugLinkMemoryWrite MessageType = 112
- MessageType_MessageType_DebugLinkFlashErase MessageType = 113
-)
-
-var MessageType_name = map[int32]string{
- 0: "MessageType_Initialize",
- 1: "MessageType_Ping",
- 2: "MessageType_Success",
- 3: "MessageType_Failure",
- 4: "MessageType_ChangePin",
- 5: "MessageType_WipeDevice",
- 6: "MessageType_FirmwareErase",
- 7: "MessageType_FirmwareUpload",
- 8: "MessageType_FirmwareRequest",
- 9: "MessageType_GetEntropy",
- 10: "MessageType_Entropy",
- 11: "MessageType_GetPublicKey",
- 12: "MessageType_PublicKey",
- 13: "MessageType_LoadDevice",
- 14: "MessageType_ResetDevice",
- 15: "MessageType_SignTx",
- 16: "MessageType_SimpleSignTx",
- 17: "MessageType_Features",
- 18: "MessageType_PinMatrixRequest",
- 19: "MessageType_PinMatrixAck",
- 20: "MessageType_Cancel",
- 21: "MessageType_TxRequest",
- 22: "MessageType_TxAck",
- 23: "MessageType_CipherKeyValue",
- 24: "MessageType_ClearSession",
- 25: "MessageType_ApplySettings",
- 26: "MessageType_ButtonRequest",
- 27: "MessageType_ButtonAck",
- 28: "MessageType_ApplyFlags",
- 29: "MessageType_GetAddress",
- 30: "MessageType_Address",
- 32: "MessageType_SelfTest",
- 34: "MessageType_BackupDevice",
- 35: "MessageType_EntropyRequest",
- 36: "MessageType_EntropyAck",
- 38: "MessageType_SignMessage",
- 39: "MessageType_VerifyMessage",
- 40: "MessageType_MessageSignature",
- 41: "MessageType_PassphraseRequest",
- 42: "MessageType_PassphraseAck",
- 43: "MessageType_EstimateTxSize",
- 44: "MessageType_TxSize",
- 45: "MessageType_RecoveryDevice",
- 46: "MessageType_WordRequest",
- 47: "MessageType_WordAck",
- 48: "MessageType_CipheredKeyValue",
- 49: "MessageType_EncryptMessage",
- 50: "MessageType_EncryptedMessage",
- 51: "MessageType_DecryptMessage",
- 52: "MessageType_DecryptedMessage",
- 53: "MessageType_SignIdentity",
- 54: "MessageType_SignedIdentity",
- 55: "MessageType_GetFeatures",
- 56: "MessageType_EthereumGetAddress",
- 57: "MessageType_EthereumAddress",
- 58: "MessageType_EthereumSignTx",
- 59: "MessageType_EthereumTxRequest",
- 60: "MessageType_EthereumTxAck",
- 61: "MessageType_GetECDHSessionKey",
- 62: "MessageType_ECDHSessionKey",
- 63: "MessageType_SetU2FCounter",
- 64: "MessageType_EthereumSignMessage",
- 65: "MessageType_EthereumVerifyMessage",
- 66: "MessageType_EthereumMessageSignature",
- 100: "MessageType_DebugLinkDecision",
- 101: "MessageType_DebugLinkGetState",
- 102: "MessageType_DebugLinkState",
- 103: "MessageType_DebugLinkStop",
- 104: "MessageType_DebugLinkLog",
- 110: "MessageType_DebugLinkMemoryRead",
- 111: "MessageType_DebugLinkMemory",
- 112: "MessageType_DebugLinkMemoryWrite",
- 113: "MessageType_DebugLinkFlashErase",
-}
-var MessageType_value = map[string]int32{
- "MessageType_Initialize": 0,
- "MessageType_Ping": 1,
- "MessageType_Success": 2,
- "MessageType_Failure": 3,
- "MessageType_ChangePin": 4,
- "MessageType_WipeDevice": 5,
- "MessageType_FirmwareErase": 6,
- "MessageType_FirmwareUpload": 7,
- "MessageType_FirmwareRequest": 8,
- "MessageType_GetEntropy": 9,
- "MessageType_Entropy": 10,
- "MessageType_GetPublicKey": 11,
- "MessageType_PublicKey": 12,
- "MessageType_LoadDevice": 13,
- "MessageType_ResetDevice": 14,
- "MessageType_SignTx": 15,
- "MessageType_SimpleSignTx": 16,
- "MessageType_Features": 17,
- "MessageType_PinMatrixRequest": 18,
- "MessageType_PinMatrixAck": 19,
- "MessageType_Cancel": 20,
- "MessageType_TxRequest": 21,
- "MessageType_TxAck": 22,
- "MessageType_CipherKeyValue": 23,
- "MessageType_ClearSession": 24,
- "MessageType_ApplySettings": 25,
- "MessageType_ButtonRequest": 26,
- "MessageType_ButtonAck": 27,
- "MessageType_ApplyFlags": 28,
- "MessageType_GetAddress": 29,
- "MessageType_Address": 30,
- "MessageType_SelfTest": 32,
- "MessageType_BackupDevice": 34,
- "MessageType_EntropyRequest": 35,
- "MessageType_EntropyAck": 36,
- "MessageType_SignMessage": 38,
- "MessageType_VerifyMessage": 39,
- "MessageType_MessageSignature": 40,
- "MessageType_PassphraseRequest": 41,
- "MessageType_PassphraseAck": 42,
- "MessageType_EstimateTxSize": 43,
- "MessageType_TxSize": 44,
- "MessageType_RecoveryDevice": 45,
- "MessageType_WordRequest": 46,
- "MessageType_WordAck": 47,
- "MessageType_CipheredKeyValue": 48,
- "MessageType_EncryptMessage": 49,
- "MessageType_EncryptedMessage": 50,
- "MessageType_DecryptMessage": 51,
- "MessageType_DecryptedMessage": 52,
- "MessageType_SignIdentity": 53,
- "MessageType_SignedIdentity": 54,
- "MessageType_GetFeatures": 55,
- "MessageType_EthereumGetAddress": 56,
- "MessageType_EthereumAddress": 57,
- "MessageType_EthereumSignTx": 58,
- "MessageType_EthereumTxRequest": 59,
- "MessageType_EthereumTxAck": 60,
- "MessageType_GetECDHSessionKey": 61,
- "MessageType_ECDHSessionKey": 62,
- "MessageType_SetU2FCounter": 63,
- "MessageType_EthereumSignMessage": 64,
- "MessageType_EthereumVerifyMessage": 65,
- "MessageType_EthereumMessageSignature": 66,
- "MessageType_DebugLinkDecision": 100,
- "MessageType_DebugLinkGetState": 101,
- "MessageType_DebugLinkState": 102,
- "MessageType_DebugLinkStop": 103,
- "MessageType_DebugLinkLog": 104,
- "MessageType_DebugLinkMemoryRead": 110,
- "MessageType_DebugLinkMemory": 111,
- "MessageType_DebugLinkMemoryWrite": 112,
- "MessageType_DebugLinkFlashErase": 113,
-}
-
-func (x MessageType) Enum() *MessageType {
- p := new(MessageType)
- *p = x
- return p
-}
-func (x MessageType) String() string {
- return proto.EnumName(MessageType_name, int32(x))
-}
-func (x *MessageType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType")
- if err != nil {
- return err
- }
- *x = MessageType(value)
- return nil
-}
-func (MessageType) EnumDescriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
-
-// *
-// Request: Reset device to default state and ask for device details
-// @next Features
-type Initialize struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Initialize) Reset() { *m = Initialize{} }
-func (m *Initialize) String() string { return proto.CompactTextString(m) }
-func (*Initialize) ProtoMessage() {}
-func (*Initialize) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{0} }
-
-// *
-// Request: Ask for device details (no device reset)
-// @next Features
-type GetFeatures struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *GetFeatures) Reset() { *m = GetFeatures{} }
-func (m *GetFeatures) String() string { return proto.CompactTextString(m) }
-func (*GetFeatures) ProtoMessage() {}
-func (*GetFeatures) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{1} }
-
-// *
-// Response: Reports various information about the device
-// @prev Initialize
-// @prev GetFeatures
-type Features struct {
- Vendor *string `protobuf:"bytes,1,opt,name=vendor" json:"vendor,omitempty"`
- MajorVersion *uint32 `protobuf:"varint,2,opt,name=major_version,json=majorVersion" json:"major_version,omitempty"`
- MinorVersion *uint32 `protobuf:"varint,3,opt,name=minor_version,json=minorVersion" json:"minor_version,omitempty"`
- PatchVersion *uint32 `protobuf:"varint,4,opt,name=patch_version,json=patchVersion" json:"patch_version,omitempty"`
- BootloaderMode *bool `protobuf:"varint,5,opt,name=bootloader_mode,json=bootloaderMode" json:"bootloader_mode,omitempty"`
- DeviceId *string `protobuf:"bytes,6,opt,name=device_id,json=deviceId" json:"device_id,omitempty"`
- PinProtection *bool `protobuf:"varint,7,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,8,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- Language *string `protobuf:"bytes,9,opt,name=language" json:"language,omitempty"`
- Label *string `protobuf:"bytes,10,opt,name=label" json:"label,omitempty"`
- Coins []*CoinType `protobuf:"bytes,11,rep,name=coins" json:"coins,omitempty"`
- Initialized *bool `protobuf:"varint,12,opt,name=initialized" json:"initialized,omitempty"`
- Revision []byte `protobuf:"bytes,13,opt,name=revision" json:"revision,omitempty"`
- BootloaderHash []byte `protobuf:"bytes,14,opt,name=bootloader_hash,json=bootloaderHash" json:"bootloader_hash,omitempty"`
- Imported *bool `protobuf:"varint,15,opt,name=imported" json:"imported,omitempty"`
- PinCached *bool `protobuf:"varint,16,opt,name=pin_cached,json=pinCached" json:"pin_cached,omitempty"`
- PassphraseCached *bool `protobuf:"varint,17,opt,name=passphrase_cached,json=passphraseCached" json:"passphrase_cached,omitempty"`
- FirmwarePresent *bool `protobuf:"varint,18,opt,name=firmware_present,json=firmwarePresent" json:"firmware_present,omitempty"`
- NeedsBackup *bool `protobuf:"varint,19,opt,name=needs_backup,json=needsBackup" json:"needs_backup,omitempty"`
- Flags *uint32 `protobuf:"varint,20,opt,name=flags" json:"flags,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Features) Reset() { *m = Features{} }
-func (m *Features) String() string { return proto.CompactTextString(m) }
-func (*Features) ProtoMessage() {}
-func (*Features) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{2} }
-
-func (m *Features) GetVendor() string {
- if m != nil && m.Vendor != nil {
- return *m.Vendor
- }
- return ""
-}
-
-func (m *Features) GetMajorVersion() uint32 {
- if m != nil && m.MajorVersion != nil {
- return *m.MajorVersion
- }
- return 0
-}
-
-func (m *Features) GetMinorVersion() uint32 {
- if m != nil && m.MinorVersion != nil {
- return *m.MinorVersion
- }
- return 0
-}
-
-func (m *Features) GetPatchVersion() uint32 {
- if m != nil && m.PatchVersion != nil {
- return *m.PatchVersion
- }
- return 0
-}
-
-func (m *Features) GetBootloaderMode() bool {
- if m != nil && m.BootloaderMode != nil {
- return *m.BootloaderMode
- }
- return false
-}
-
-func (m *Features) GetDeviceId() string {
- if m != nil && m.DeviceId != nil {
- return *m.DeviceId
- }
- return ""
-}
-
-func (m *Features) GetPinProtection() bool {
- if m != nil && m.PinProtection != nil {
- return *m.PinProtection
- }
- return false
-}
-
-func (m *Features) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-func (m *Features) GetLanguage() string {
- if m != nil && m.Language != nil {
- return *m.Language
- }
- return ""
-}
-
-func (m *Features) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
-}
-
-func (m *Features) GetCoins() []*CoinType {
- if m != nil {
- return m.Coins
- }
- return nil
-}
-
-func (m *Features) GetInitialized() bool {
- if m != nil && m.Initialized != nil {
- return *m.Initialized
- }
- return false
-}
-
-func (m *Features) GetRevision() []byte {
- if m != nil {
- return m.Revision
- }
- return nil
-}
-
-func (m *Features) GetBootloaderHash() []byte {
- if m != nil {
- return m.BootloaderHash
- }
- return nil
-}
-
-func (m *Features) GetImported() bool {
- if m != nil && m.Imported != nil {
- return *m.Imported
- }
- return false
-}
-
-func (m *Features) GetPinCached() bool {
- if m != nil && m.PinCached != nil {
- return *m.PinCached
- }
- return false
-}
-
-func (m *Features) GetPassphraseCached() bool {
- if m != nil && m.PassphraseCached != nil {
- return *m.PassphraseCached
- }
- return false
-}
-
-func (m *Features) GetFirmwarePresent() bool {
- if m != nil && m.FirmwarePresent != nil {
- return *m.FirmwarePresent
- }
- return false
-}
-
-func (m *Features) GetNeedsBackup() bool {
- if m != nil && m.NeedsBackup != nil {
- return *m.NeedsBackup
- }
- return false
-}
-
-func (m *Features) GetFlags() uint32 {
- if m != nil && m.Flags != nil {
- return *m.Flags
- }
- return 0
-}
-
-// *
-// Request: clear session (removes cached PIN, passphrase, etc).
-// @next Success
-type ClearSession struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ClearSession) Reset() { *m = ClearSession{} }
-func (m *ClearSession) String() string { return proto.CompactTextString(m) }
-func (*ClearSession) ProtoMessage() {}
-func (*ClearSession) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{3} }
-
-// *
-// Request: change language and/or label of the device
-// @next Success
-// @next Failure
-// @next ButtonRequest
-// @next PinMatrixRequest
-type ApplySettings struct {
- Language *string `protobuf:"bytes,1,opt,name=language" json:"language,omitempty"`
- Label *string `protobuf:"bytes,2,opt,name=label" json:"label,omitempty"`
- UsePassphrase *bool `protobuf:"varint,3,opt,name=use_passphrase,json=usePassphrase" json:"use_passphrase,omitempty"`
- Homescreen []byte `protobuf:"bytes,4,opt,name=homescreen" json:"homescreen,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ApplySettings) Reset() { *m = ApplySettings{} }
-func (m *ApplySettings) String() string { return proto.CompactTextString(m) }
-func (*ApplySettings) ProtoMessage() {}
-func (*ApplySettings) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{4} }
-
-func (m *ApplySettings) GetLanguage() string {
- if m != nil && m.Language != nil {
- return *m.Language
- }
- return ""
-}
-
-func (m *ApplySettings) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
-}
-
-func (m *ApplySettings) GetUsePassphrase() bool {
- if m != nil && m.UsePassphrase != nil {
- return *m.UsePassphrase
- }
- return false
-}
-
-func (m *ApplySettings) GetHomescreen() []byte {
- if m != nil {
- return m.Homescreen
- }
- return nil
-}
-
-// *
-// Request: set flags of the device
-// @next Success
-// @next Failure
-type ApplyFlags struct {
- Flags *uint32 `protobuf:"varint,1,opt,name=flags" json:"flags,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ApplyFlags) Reset() { *m = ApplyFlags{} }
-func (m *ApplyFlags) String() string { return proto.CompactTextString(m) }
-func (*ApplyFlags) ProtoMessage() {}
-func (*ApplyFlags) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{5} }
-
-func (m *ApplyFlags) GetFlags() uint32 {
- if m != nil && m.Flags != nil {
- return *m.Flags
- }
- return 0
-}
-
-// *
-// Request: Starts workflow for setting/changing/removing the PIN
-// @next ButtonRequest
-// @next PinMatrixRequest
-type ChangePin struct {
- Remove *bool `protobuf:"varint,1,opt,name=remove" json:"remove,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ChangePin) Reset() { *m = ChangePin{} }
-func (m *ChangePin) String() string { return proto.CompactTextString(m) }
-func (*ChangePin) ProtoMessage() {}
-func (*ChangePin) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{6} }
-
-func (m *ChangePin) GetRemove() bool {
- if m != nil && m.Remove != nil {
- return *m.Remove
- }
- return false
-}
-
-// *
-// Request: Test if the device is alive, device sends back the message in Success response
-// @next Success
-type Ping struct {
- Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
- ButtonProtection *bool `protobuf:"varint,2,opt,name=button_protection,json=buttonProtection" json:"button_protection,omitempty"`
- PinProtection *bool `protobuf:"varint,3,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,4,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Ping) Reset() { *m = Ping{} }
-func (m *Ping) String() string { return proto.CompactTextString(m) }
-func (*Ping) ProtoMessage() {}
-func (*Ping) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{7} }
-
-func (m *Ping) GetMessage() string {
- if m != nil && m.Message != nil {
- return *m.Message
- }
- return ""
-}
-
-func (m *Ping) GetButtonProtection() bool {
- if m != nil && m.ButtonProtection != nil {
- return *m.ButtonProtection
- }
- return false
-}
-
-func (m *Ping) GetPinProtection() bool {
- if m != nil && m.PinProtection != nil {
- return *m.PinProtection
- }
- return false
-}
-
-func (m *Ping) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-// *
-// Response: Success of the previous request
-type Success struct {
- Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Success) Reset() { *m = Success{} }
-func (m *Success) String() string { return proto.CompactTextString(m) }
-func (*Success) ProtoMessage() {}
-func (*Success) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{8} }
-
-func (m *Success) GetMessage() string {
- if m != nil && m.Message != nil {
- return *m.Message
- }
- return ""
-}
-
-// *
-// Response: Failure of the previous request
-type Failure struct {
- Code *FailureType `protobuf:"varint,1,opt,name=code,enum=FailureType" json:"code,omitempty"`
- Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Failure) Reset() { *m = Failure{} }
-func (m *Failure) String() string { return proto.CompactTextString(m) }
-func (*Failure) ProtoMessage() {}
-func (*Failure) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{9} }
-
-func (m *Failure) GetCode() FailureType {
- if m != nil && m.Code != nil {
- return *m.Code
- }
- return FailureType_Failure_UnexpectedMessage
-}
-
-func (m *Failure) GetMessage() string {
- if m != nil && m.Message != nil {
- return *m.Message
- }
- return ""
-}
-
-// *
-// Response: Device is waiting for HW button press.
-// @next ButtonAck
-// @next Cancel
-type ButtonRequest struct {
- Code *ButtonRequestType `protobuf:"varint,1,opt,name=code,enum=ButtonRequestType" json:"code,omitempty"`
- Data *string `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ButtonRequest) Reset() { *m = ButtonRequest{} }
-func (m *ButtonRequest) String() string { return proto.CompactTextString(m) }
-func (*ButtonRequest) ProtoMessage() {}
-func (*ButtonRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{10} }
-
-func (m *ButtonRequest) GetCode() ButtonRequestType {
- if m != nil && m.Code != nil {
- return *m.Code
- }
- return ButtonRequestType_ButtonRequest_Other
-}
-
-func (m *ButtonRequest) GetData() string {
- if m != nil && m.Data != nil {
- return *m.Data
- }
- return ""
-}
-
-// *
-// Request: Computer agrees to wait for HW button press
-// @prev ButtonRequest
-type ButtonAck struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ButtonAck) Reset() { *m = ButtonAck{} }
-func (m *ButtonAck) String() string { return proto.CompactTextString(m) }
-func (*ButtonAck) ProtoMessage() {}
-func (*ButtonAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{11} }
-
-// *
-// Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
-// @next PinMatrixAck
-// @next Cancel
-type PinMatrixRequest struct {
- Type *PinMatrixRequestType `protobuf:"varint,1,opt,name=type,enum=PinMatrixRequestType" json:"type,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *PinMatrixRequest) Reset() { *m = PinMatrixRequest{} }
-func (m *PinMatrixRequest) String() string { return proto.CompactTextString(m) }
-func (*PinMatrixRequest) ProtoMessage() {}
-func (*PinMatrixRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{12} }
-
-func (m *PinMatrixRequest) GetType() PinMatrixRequestType {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return PinMatrixRequestType_PinMatrixRequestType_Current
-}
-
-// *
-// Request: Computer responds with encoded PIN
-// @prev PinMatrixRequest
-type PinMatrixAck struct {
- Pin *string `protobuf:"bytes,1,req,name=pin" json:"pin,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *PinMatrixAck) Reset() { *m = PinMatrixAck{} }
-func (m *PinMatrixAck) String() string { return proto.CompactTextString(m) }
-func (*PinMatrixAck) ProtoMessage() {}
-func (*PinMatrixAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{13} }
-
-func (m *PinMatrixAck) GetPin() string {
- if m != nil && m.Pin != nil {
- return *m.Pin
- }
- return ""
-}
-
-// *
-// Request: Abort last operation that required user interaction
-// @prev ButtonRequest
-// @prev PinMatrixRequest
-// @prev PassphraseRequest
-type Cancel struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Cancel) Reset() { *m = Cancel{} }
-func (m *Cancel) String() string { return proto.CompactTextString(m) }
-func (*Cancel) ProtoMessage() {}
-func (*Cancel) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{14} }
-
-// *
-// Response: Device awaits encryption passphrase
-// @next PassphraseAck
-// @next Cancel
-type PassphraseRequest struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *PassphraseRequest) Reset() { *m = PassphraseRequest{} }
-func (m *PassphraseRequest) String() string { return proto.CompactTextString(m) }
-func (*PassphraseRequest) ProtoMessage() {}
-func (*PassphraseRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{15} }
-
-// *
-// Request: Send passphrase back
-// @prev PassphraseRequest
-type PassphraseAck struct {
- Passphrase *string `protobuf:"bytes,1,req,name=passphrase" json:"passphrase,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *PassphraseAck) Reset() { *m = PassphraseAck{} }
-func (m *PassphraseAck) String() string { return proto.CompactTextString(m) }
-func (*PassphraseAck) ProtoMessage() {}
-func (*PassphraseAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{16} }
-
-func (m *PassphraseAck) GetPassphrase() string {
- if m != nil && m.Passphrase != nil {
- return *m.Passphrase
- }
- return ""
-}
-
-// *
-// Request: Request a sample of random data generated by hardware RNG. May be used for testing.
-// @next ButtonRequest
-// @next Entropy
-// @next Failure
-type GetEntropy struct {
- Size *uint32 `protobuf:"varint,1,req,name=size" json:"size,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *GetEntropy) Reset() { *m = GetEntropy{} }
-func (m *GetEntropy) String() string { return proto.CompactTextString(m) }
-func (*GetEntropy) ProtoMessage() {}
-func (*GetEntropy) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{17} }
-
-func (m *GetEntropy) GetSize() uint32 {
- if m != nil && m.Size != nil {
- return *m.Size
- }
- return 0
-}
-
-// *
-// Response: Reply with random data generated by internal RNG
-// @prev GetEntropy
-type Entropy struct {
- Entropy []byte `protobuf:"bytes,1,req,name=entropy" json:"entropy,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Entropy) Reset() { *m = Entropy{} }
-func (m *Entropy) String() string { return proto.CompactTextString(m) }
-func (*Entropy) ProtoMessage() {}
-func (*Entropy) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{18} }
-
-func (m *Entropy) GetEntropy() []byte {
- if m != nil {
- return m.Entropy
- }
- return nil
-}
-
-// *
-// Request: Ask device for public key corresponding to address_n path
-// @next PassphraseRequest
-// @next PublicKey
-// @next Failure
-type GetPublicKey struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- EcdsaCurveName *string `protobuf:"bytes,2,opt,name=ecdsa_curve_name,json=ecdsaCurveName" json:"ecdsa_curve_name,omitempty"`
- ShowDisplay *bool `protobuf:"varint,3,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
- CoinName *string `protobuf:"bytes,4,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *GetPublicKey) Reset() { *m = GetPublicKey{} }
-func (m *GetPublicKey) String() string { return proto.CompactTextString(m) }
-func (*GetPublicKey) ProtoMessage() {}
-func (*GetPublicKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{19} }
-
-const Default_GetPublicKey_CoinName string = "Bitcoin"
-
-func (m *GetPublicKey) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *GetPublicKey) GetEcdsaCurveName() string {
- if m != nil && m.EcdsaCurveName != nil {
- return *m.EcdsaCurveName
- }
- return ""
-}
-
-func (m *GetPublicKey) GetShowDisplay() bool {
- if m != nil && m.ShowDisplay != nil {
- return *m.ShowDisplay
- }
- return false
-}
-
-func (m *GetPublicKey) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_GetPublicKey_CoinName
-}
-
-// *
-// Response: Contains public key derived from device private seed
-// @prev GetPublicKey
-type PublicKey struct {
- Node *HDNodeType `protobuf:"bytes,1,req,name=node" json:"node,omitempty"`
- Xpub *string `protobuf:"bytes,2,opt,name=xpub" json:"xpub,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *PublicKey) Reset() { *m = PublicKey{} }
-func (m *PublicKey) String() string { return proto.CompactTextString(m) }
-func (*PublicKey) ProtoMessage() {}
-func (*PublicKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{20} }
-
-func (m *PublicKey) GetNode() *HDNodeType {
- if m != nil {
- return m.Node
- }
- return nil
-}
-
-func (m *PublicKey) GetXpub() string {
- if m != nil && m.Xpub != nil {
- return *m.Xpub
- }
- return ""
-}
-
-// *
-// Request: Ask device for address corresponding to address_n path
-// @next PassphraseRequest
-// @next Address
-// @next Failure
-type GetAddress struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- CoinName *string `protobuf:"bytes,2,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- ShowDisplay *bool `protobuf:"varint,3,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
- Multisig *MultisigRedeemScriptType `protobuf:"bytes,4,opt,name=multisig" json:"multisig,omitempty"`
- ScriptType *InputScriptType `protobuf:"varint,5,opt,name=script_type,json=scriptType,enum=InputScriptType,def=0" json:"script_type,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *GetAddress) Reset() { *m = GetAddress{} }
-func (m *GetAddress) String() string { return proto.CompactTextString(m) }
-func (*GetAddress) ProtoMessage() {}
-func (*GetAddress) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{21} }
-
-const Default_GetAddress_CoinName string = "Bitcoin"
-const Default_GetAddress_ScriptType InputScriptType = InputScriptType_SPENDADDRESS
-
-func (m *GetAddress) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *GetAddress) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_GetAddress_CoinName
-}
-
-func (m *GetAddress) GetShowDisplay() bool {
- if m != nil && m.ShowDisplay != nil {
- return *m.ShowDisplay
- }
- return false
-}
-
-func (m *GetAddress) GetMultisig() *MultisigRedeemScriptType {
- if m != nil {
- return m.Multisig
- }
- return nil
-}
-
-func (m *GetAddress) GetScriptType() InputScriptType {
- if m != nil && m.ScriptType != nil {
- return *m.ScriptType
- }
- return Default_GetAddress_ScriptType
-}
-
-// *
-// Request: Ask device for Ethereum address corresponding to address_n path
-// @next PassphraseRequest
-// @next EthereumAddress
-// @next Failure
-type EthereumGetAddress struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumGetAddress) Reset() { *m = EthereumGetAddress{} }
-func (m *EthereumGetAddress) String() string { return proto.CompactTextString(m) }
-func (*EthereumGetAddress) ProtoMessage() {}
-func (*EthereumGetAddress) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{22} }
-
-func (m *EthereumGetAddress) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *EthereumGetAddress) GetShowDisplay() bool {
- if m != nil && m.ShowDisplay != nil {
- return *m.ShowDisplay
- }
- return false
-}
-
-// *
-// Response: Contains address derived from device private seed
-// @prev GetAddress
-type Address struct {
- Address *string `protobuf:"bytes,1,req,name=address" json:"address,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *Address) Reset() { *m = Address{} }
-func (m *Address) String() string { return proto.CompactTextString(m) }
-func (*Address) ProtoMessage() {}
-func (*Address) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{23} }
-
-func (m *Address) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-// *
-// Response: Contains an Ethereum address derived from device private seed
-// @prev EthereumGetAddress
-type EthereumAddress struct {
- Address []byte `protobuf:"bytes,1,req,name=address" json:"address,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumAddress) Reset() { *m = EthereumAddress{} }
-func (m *EthereumAddress) String() string { return proto.CompactTextString(m) }
-func (*EthereumAddress) ProtoMessage() {}
-func (*EthereumAddress) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{24} }
-
-func (m *EthereumAddress) GetAddress() []byte {
- if m != nil {
- return m.Address
- }
- return nil
-}
-
-// *
-// Request: Request device to wipe all sensitive data and settings
-// @next ButtonRequest
-type WipeDevice struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *WipeDevice) Reset() { *m = WipeDevice{} }
-func (m *WipeDevice) String() string { return proto.CompactTextString(m) }
-func (*WipeDevice) ProtoMessage() {}
-func (*WipeDevice) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{25} }
-
-// *
-// Request: Load seed and related internal settings from the computer
-// @next ButtonRequest
-// @next Success
-// @next Failure
-type LoadDevice struct {
- Mnemonic *string `protobuf:"bytes,1,opt,name=mnemonic" json:"mnemonic,omitempty"`
- Node *HDNodeType `protobuf:"bytes,2,opt,name=node" json:"node,omitempty"`
- Pin *string `protobuf:"bytes,3,opt,name=pin" json:"pin,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,4,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- Language *string `protobuf:"bytes,5,opt,name=language,def=english" json:"language,omitempty"`
- Label *string `protobuf:"bytes,6,opt,name=label" json:"label,omitempty"`
- SkipChecksum *bool `protobuf:"varint,7,opt,name=skip_checksum,json=skipChecksum" json:"skip_checksum,omitempty"`
- U2FCounter *uint32 `protobuf:"varint,8,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *LoadDevice) Reset() { *m = LoadDevice{} }
-func (m *LoadDevice) String() string { return proto.CompactTextString(m) }
-func (*LoadDevice) ProtoMessage() {}
-func (*LoadDevice) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{26} }
-
-const Default_LoadDevice_Language string = "english"
-
-func (m *LoadDevice) GetMnemonic() string {
- if m != nil && m.Mnemonic != nil {
- return *m.Mnemonic
- }
- return ""
-}
-
-func (m *LoadDevice) GetNode() *HDNodeType {
- if m != nil {
- return m.Node
- }
- return nil
-}
-
-func (m *LoadDevice) GetPin() string {
- if m != nil && m.Pin != nil {
- return *m.Pin
- }
- return ""
-}
-
-func (m *LoadDevice) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-func (m *LoadDevice) GetLanguage() string {
- if m != nil && m.Language != nil {
- return *m.Language
- }
- return Default_LoadDevice_Language
-}
-
-func (m *LoadDevice) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
-}
-
-func (m *LoadDevice) GetSkipChecksum() bool {
- if m != nil && m.SkipChecksum != nil {
- return *m.SkipChecksum
- }
- return false
-}
-
-func (m *LoadDevice) GetU2FCounter() uint32 {
- if m != nil && m.U2FCounter != nil {
- return *m.U2FCounter
- }
- return 0
-}
-
-// *
-// Request: Ask device to do initialization involving user interaction
-// @next EntropyRequest
-// @next Failure
-type ResetDevice struct {
- DisplayRandom *bool `protobuf:"varint,1,opt,name=display_random,json=displayRandom" json:"display_random,omitempty"`
- Strength *uint32 `protobuf:"varint,2,opt,name=strength,def=256" json:"strength,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,3,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- PinProtection *bool `protobuf:"varint,4,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
- Language *string `protobuf:"bytes,5,opt,name=language,def=english" json:"language,omitempty"`
- Label *string `protobuf:"bytes,6,opt,name=label" json:"label,omitempty"`
- U2FCounter *uint32 `protobuf:"varint,7,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
- SkipBackup *bool `protobuf:"varint,8,opt,name=skip_backup,json=skipBackup" json:"skip_backup,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ResetDevice) Reset() { *m = ResetDevice{} }
-func (m *ResetDevice) String() string { return proto.CompactTextString(m) }
-func (*ResetDevice) ProtoMessage() {}
-func (*ResetDevice) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{27} }
-
-const Default_ResetDevice_Strength uint32 = 256
-const Default_ResetDevice_Language string = "english"
-
-func (m *ResetDevice) GetDisplayRandom() bool {
- if m != nil && m.DisplayRandom != nil {
- return *m.DisplayRandom
- }
- return false
-}
-
-func (m *ResetDevice) GetStrength() uint32 {
- if m != nil && m.Strength != nil {
- return *m.Strength
- }
- return Default_ResetDevice_Strength
-}
-
-func (m *ResetDevice) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-func (m *ResetDevice) GetPinProtection() bool {
- if m != nil && m.PinProtection != nil {
- return *m.PinProtection
- }
- return false
-}
-
-func (m *ResetDevice) GetLanguage() string {
- if m != nil && m.Language != nil {
- return *m.Language
- }
- return Default_ResetDevice_Language
-}
-
-func (m *ResetDevice) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
-}
-
-func (m *ResetDevice) GetU2FCounter() uint32 {
- if m != nil && m.U2FCounter != nil {
- return *m.U2FCounter
- }
- return 0
-}
-
-func (m *ResetDevice) GetSkipBackup() bool {
- if m != nil && m.SkipBackup != nil {
- return *m.SkipBackup
- }
- return false
-}
-
-// *
-// Request: Perform backup of the device seed if not backed up using ResetDevice
-// @next ButtonRequest
-type BackupDevice struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *BackupDevice) Reset() { *m = BackupDevice{} }
-func (m *BackupDevice) String() string { return proto.CompactTextString(m) }
-func (*BackupDevice) ProtoMessage() {}
-func (*BackupDevice) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{28} }
-
-// *
-// Response: Ask for additional entropy from host computer
-// @prev ResetDevice
-// @next EntropyAck
-type EntropyRequest struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EntropyRequest) Reset() { *m = EntropyRequest{} }
-func (m *EntropyRequest) String() string { return proto.CompactTextString(m) }
-func (*EntropyRequest) ProtoMessage() {}
-func (*EntropyRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{29} }
-
-// *
-// Request: Provide additional entropy for seed generation function
-// @prev EntropyRequest
-// @next ButtonRequest
-type EntropyAck struct {
- Entropy []byte `protobuf:"bytes,1,opt,name=entropy" json:"entropy,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EntropyAck) Reset() { *m = EntropyAck{} }
-func (m *EntropyAck) String() string { return proto.CompactTextString(m) }
-func (*EntropyAck) ProtoMessage() {}
-func (*EntropyAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{30} }
-
-func (m *EntropyAck) GetEntropy() []byte {
- if m != nil {
- return m.Entropy
- }
- return nil
-}
-
-// *
-// Request: Start recovery workflow asking user for specific words of mnemonic
-// Used to recovery device safely even on untrusted computer.
-// @next WordRequest
-type RecoveryDevice struct {
- WordCount *uint32 `protobuf:"varint,1,opt,name=word_count,json=wordCount" json:"word_count,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,2,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- PinProtection *bool `protobuf:"varint,3,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
- Language *string `protobuf:"bytes,4,opt,name=language,def=english" json:"language,omitempty"`
- Label *string `protobuf:"bytes,5,opt,name=label" json:"label,omitempty"`
- EnforceWordlist *bool `protobuf:"varint,6,opt,name=enforce_wordlist,json=enforceWordlist" json:"enforce_wordlist,omitempty"`
- // 7 reserved for unused recovery method
- Type *uint32 `protobuf:"varint,8,opt,name=type" json:"type,omitempty"`
- U2FCounter *uint32 `protobuf:"varint,9,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
- DryRun *bool `protobuf:"varint,10,opt,name=dry_run,json=dryRun" json:"dry_run,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *RecoveryDevice) Reset() { *m = RecoveryDevice{} }
-func (m *RecoveryDevice) String() string { return proto.CompactTextString(m) }
-func (*RecoveryDevice) ProtoMessage() {}
-func (*RecoveryDevice) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{31} }
-
-const Default_RecoveryDevice_Language string = "english"
-
-func (m *RecoveryDevice) GetWordCount() uint32 {
- if m != nil && m.WordCount != nil {
- return *m.WordCount
- }
- return 0
-}
-
-func (m *RecoveryDevice) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-func (m *RecoveryDevice) GetPinProtection() bool {
- if m != nil && m.PinProtection != nil {
- return *m.PinProtection
- }
- return false
-}
-
-func (m *RecoveryDevice) GetLanguage() string {
- if m != nil && m.Language != nil {
- return *m.Language
- }
- return Default_RecoveryDevice_Language
-}
-
-func (m *RecoveryDevice) GetLabel() string {
- if m != nil && m.Label != nil {
- return *m.Label
- }
- return ""
-}
-
-func (m *RecoveryDevice) GetEnforceWordlist() bool {
- if m != nil && m.EnforceWordlist != nil {
- return *m.EnforceWordlist
- }
- return false
-}
-
-func (m *RecoveryDevice) GetType() uint32 {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return 0
-}
-
-func (m *RecoveryDevice) GetU2FCounter() uint32 {
- if m != nil && m.U2FCounter != nil {
- return *m.U2FCounter
- }
- return 0
-}
-
-func (m *RecoveryDevice) GetDryRun() bool {
- if m != nil && m.DryRun != nil {
- return *m.DryRun
- }
- return false
-}
-
-// *
-// Response: Device is waiting for user to enter word of the mnemonic
-// Its position is shown only on device's internal display.
-// @prev RecoveryDevice
-// @prev WordAck
-type WordRequest struct {
- Type *WordRequestType `protobuf:"varint,1,opt,name=type,enum=WordRequestType" json:"type,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *WordRequest) Reset() { *m = WordRequest{} }
-func (m *WordRequest) String() string { return proto.CompactTextString(m) }
-func (*WordRequest) ProtoMessage() {}
-func (*WordRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{32} }
-
-func (m *WordRequest) GetType() WordRequestType {
- if m != nil && m.Type != nil {
- return *m.Type
- }
- return WordRequestType_WordRequestType_Plain
-}
-
-// *
-// Request: Computer replies with word from the mnemonic
-// @prev WordRequest
-// @next WordRequest
-// @next Success
-// @next Failure
-type WordAck struct {
- Word *string `protobuf:"bytes,1,req,name=word" json:"word,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *WordAck) Reset() { *m = WordAck{} }
-func (m *WordAck) String() string { return proto.CompactTextString(m) }
-func (*WordAck) ProtoMessage() {}
-func (*WordAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{33} }
-
-func (m *WordAck) GetWord() string {
- if m != nil && m.Word != nil {
- return *m.Word
- }
- return ""
-}
-
-// *
-// Request: Ask device to sign message
-// @next MessageSignature
-// @next Failure
-type SignMessage struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Message []byte `protobuf:"bytes,2,req,name=message" json:"message,omitempty"`
- CoinName *string `protobuf:"bytes,3,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- ScriptType *InputScriptType `protobuf:"varint,4,opt,name=script_type,json=scriptType,enum=InputScriptType,def=0" json:"script_type,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SignMessage) Reset() { *m = SignMessage{} }
-func (m *SignMessage) String() string { return proto.CompactTextString(m) }
-func (*SignMessage) ProtoMessage() {}
-func (*SignMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{34} }
-
-const Default_SignMessage_CoinName string = "Bitcoin"
-const Default_SignMessage_ScriptType InputScriptType = InputScriptType_SPENDADDRESS
-
-func (m *SignMessage) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *SignMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *SignMessage) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_SignMessage_CoinName
-}
-
-func (m *SignMessage) GetScriptType() InputScriptType {
- if m != nil && m.ScriptType != nil {
- return *m.ScriptType
- }
- return Default_SignMessage_ScriptType
-}
-
-// *
-// Request: Ask device to verify message
-// @next Success
-// @next Failure
-type VerifyMessage struct {
- Address *string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
- Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
- CoinName *string `protobuf:"bytes,4,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *VerifyMessage) Reset() { *m = VerifyMessage{} }
-func (m *VerifyMessage) String() string { return proto.CompactTextString(m) }
-func (*VerifyMessage) ProtoMessage() {}
-func (*VerifyMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{35} }
-
-const Default_VerifyMessage_CoinName string = "Bitcoin"
-
-func (m *VerifyMessage) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-func (m *VerifyMessage) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-func (m *VerifyMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *VerifyMessage) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_VerifyMessage_CoinName
-}
-
-// *
-// Response: Signed message
-// @prev SignMessage
-type MessageSignature struct {
- Address *string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *MessageSignature) Reset() { *m = MessageSignature{} }
-func (m *MessageSignature) String() string { return proto.CompactTextString(m) }
-func (*MessageSignature) ProtoMessage() {}
-func (*MessageSignature) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{36} }
-
-func (m *MessageSignature) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-func (m *MessageSignature) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-// *
-// Request: Ask device to encrypt message
-// @next EncryptedMessage
-// @next Failure
-type EncryptMessage struct {
- Pubkey []byte `protobuf:"bytes,1,opt,name=pubkey" json:"pubkey,omitempty"`
- Message []byte `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
- DisplayOnly *bool `protobuf:"varint,3,opt,name=display_only,json=displayOnly" json:"display_only,omitempty"`
- AddressN []uint32 `protobuf:"varint,4,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- CoinName *string `protobuf:"bytes,5,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EncryptMessage) Reset() { *m = EncryptMessage{} }
-func (m *EncryptMessage) String() string { return proto.CompactTextString(m) }
-func (*EncryptMessage) ProtoMessage() {}
-func (*EncryptMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{37} }
-
-const Default_EncryptMessage_CoinName string = "Bitcoin"
-
-func (m *EncryptMessage) GetPubkey() []byte {
- if m != nil {
- return m.Pubkey
- }
- return nil
-}
-
-func (m *EncryptMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *EncryptMessage) GetDisplayOnly() bool {
- if m != nil && m.DisplayOnly != nil {
- return *m.DisplayOnly
- }
- return false
-}
-
-func (m *EncryptMessage) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *EncryptMessage) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_EncryptMessage_CoinName
-}
-
-// *
-// Response: Encrypted message
-// @prev EncryptMessage
-type EncryptedMessage struct {
- Nonce []byte `protobuf:"bytes,1,opt,name=nonce" json:"nonce,omitempty"`
- Message []byte `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
- Hmac []byte `protobuf:"bytes,3,opt,name=hmac" json:"hmac,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EncryptedMessage) Reset() { *m = EncryptedMessage{} }
-func (m *EncryptedMessage) String() string { return proto.CompactTextString(m) }
-func (*EncryptedMessage) ProtoMessage() {}
-func (*EncryptedMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{38} }
-
-func (m *EncryptedMessage) GetNonce() []byte {
- if m != nil {
- return m.Nonce
- }
- return nil
-}
-
-func (m *EncryptedMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *EncryptedMessage) GetHmac() []byte {
- if m != nil {
- return m.Hmac
- }
- return nil
-}
-
-// *
-// Request: Ask device to decrypt message
-// @next Success
-// @next Failure
-type DecryptMessage struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Nonce []byte `protobuf:"bytes,2,opt,name=nonce" json:"nonce,omitempty"`
- Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
- Hmac []byte `protobuf:"bytes,4,opt,name=hmac" json:"hmac,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DecryptMessage) Reset() { *m = DecryptMessage{} }
-func (m *DecryptMessage) String() string { return proto.CompactTextString(m) }
-func (*DecryptMessage) ProtoMessage() {}
-func (*DecryptMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{39} }
-
-func (m *DecryptMessage) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *DecryptMessage) GetNonce() []byte {
- if m != nil {
- return m.Nonce
- }
- return nil
-}
-
-func (m *DecryptMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *DecryptMessage) GetHmac() []byte {
- if m != nil {
- return m.Hmac
- }
- return nil
-}
-
-// *
-// Response: Decrypted message
-// @prev DecryptedMessage
-type DecryptedMessage struct {
- Message []byte `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
- Address *string `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DecryptedMessage) Reset() { *m = DecryptedMessage{} }
-func (m *DecryptedMessage) String() string { return proto.CompactTextString(m) }
-func (*DecryptedMessage) ProtoMessage() {}
-func (*DecryptedMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{40} }
-
-func (m *DecryptedMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-func (m *DecryptedMessage) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-// *
-// Request: Ask device to encrypt or decrypt value of given key
-// @next CipheredKeyValue
-// @next Failure
-type CipherKeyValue struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Key *string `protobuf:"bytes,2,opt,name=key" json:"key,omitempty"`
- Value []byte `protobuf:"bytes,3,opt,name=value" json:"value,omitempty"`
- Encrypt *bool `protobuf:"varint,4,opt,name=encrypt" json:"encrypt,omitempty"`
- AskOnEncrypt *bool `protobuf:"varint,5,opt,name=ask_on_encrypt,json=askOnEncrypt" json:"ask_on_encrypt,omitempty"`
- AskOnDecrypt *bool `protobuf:"varint,6,opt,name=ask_on_decrypt,json=askOnDecrypt" json:"ask_on_decrypt,omitempty"`
- Iv []byte `protobuf:"bytes,7,opt,name=iv" json:"iv,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *CipherKeyValue) Reset() { *m = CipherKeyValue{} }
-func (m *CipherKeyValue) String() string { return proto.CompactTextString(m) }
-func (*CipherKeyValue) ProtoMessage() {}
-func (*CipherKeyValue) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{41} }
-
-func (m *CipherKeyValue) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *CipherKeyValue) GetKey() string {
- if m != nil && m.Key != nil {
- return *m.Key
- }
- return ""
-}
-
-func (m *CipherKeyValue) GetValue() []byte {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-func (m *CipherKeyValue) GetEncrypt() bool {
- if m != nil && m.Encrypt != nil {
- return *m.Encrypt
- }
- return false
-}
-
-func (m *CipherKeyValue) GetAskOnEncrypt() bool {
- if m != nil && m.AskOnEncrypt != nil {
- return *m.AskOnEncrypt
- }
- return false
-}
-
-func (m *CipherKeyValue) GetAskOnDecrypt() bool {
- if m != nil && m.AskOnDecrypt != nil {
- return *m.AskOnDecrypt
- }
- return false
-}
-
-func (m *CipherKeyValue) GetIv() []byte {
- if m != nil {
- return m.Iv
- }
- return nil
-}
-
-// *
-// Response: Return ciphered/deciphered value
-// @prev CipherKeyValue
-type CipheredKeyValue struct {
- Value []byte `protobuf:"bytes,1,opt,name=value" json:"value,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *CipheredKeyValue) Reset() { *m = CipheredKeyValue{} }
-func (m *CipheredKeyValue) String() string { return proto.CompactTextString(m) }
-func (*CipheredKeyValue) ProtoMessage() {}
-func (*CipheredKeyValue) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{42} }
-
-func (m *CipheredKeyValue) GetValue() []byte {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-// *
-// Request: Estimated size of the transaction
-// This behaves exactly like SignTx, which means that it can ask using TxRequest
-// This call is non-blocking (except possible PassphraseRequest to unlock the seed)
-// @next TxSize
-// @next Failure
-type EstimateTxSize struct {
- OutputsCount *uint32 `protobuf:"varint,1,req,name=outputs_count,json=outputsCount" json:"outputs_count,omitempty"`
- InputsCount *uint32 `protobuf:"varint,2,req,name=inputs_count,json=inputsCount" json:"inputs_count,omitempty"`
- CoinName *string `protobuf:"bytes,3,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EstimateTxSize) Reset() { *m = EstimateTxSize{} }
-func (m *EstimateTxSize) String() string { return proto.CompactTextString(m) }
-func (*EstimateTxSize) ProtoMessage() {}
-func (*EstimateTxSize) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{43} }
-
-const Default_EstimateTxSize_CoinName string = "Bitcoin"
-
-func (m *EstimateTxSize) GetOutputsCount() uint32 {
- if m != nil && m.OutputsCount != nil {
- return *m.OutputsCount
- }
- return 0
-}
-
-func (m *EstimateTxSize) GetInputsCount() uint32 {
- if m != nil && m.InputsCount != nil {
- return *m.InputsCount
- }
- return 0
-}
-
-func (m *EstimateTxSize) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_EstimateTxSize_CoinName
-}
-
-// *
-// Response: Estimated size of the transaction
-// @prev EstimateTxSize
-type TxSize struct {
- TxSize *uint32 `protobuf:"varint,1,opt,name=tx_size,json=txSize" json:"tx_size,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxSize) Reset() { *m = TxSize{} }
-func (m *TxSize) String() string { return proto.CompactTextString(m) }
-func (*TxSize) ProtoMessage() {}
-func (*TxSize) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{44} }
-
-func (m *TxSize) GetTxSize() uint32 {
- if m != nil && m.TxSize != nil {
- return *m.TxSize
- }
- return 0
-}
-
-// *
-// Request: Ask device to sign transaction
-// @next PassphraseRequest
-// @next PinMatrixRequest
-// @next TxRequest
-// @next Failure
-type SignTx struct {
- OutputsCount *uint32 `protobuf:"varint,1,req,name=outputs_count,json=outputsCount" json:"outputs_count,omitempty"`
- InputsCount *uint32 `protobuf:"varint,2,req,name=inputs_count,json=inputsCount" json:"inputs_count,omitempty"`
- CoinName *string `protobuf:"bytes,3,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- Version *uint32 `protobuf:"varint,4,opt,name=version,def=1" json:"version,omitempty"`
- LockTime *uint32 `protobuf:"varint,5,opt,name=lock_time,json=lockTime,def=0" json:"lock_time,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SignTx) Reset() { *m = SignTx{} }
-func (m *SignTx) String() string { return proto.CompactTextString(m) }
-func (*SignTx) ProtoMessage() {}
-func (*SignTx) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{45} }
-
-const Default_SignTx_CoinName string = "Bitcoin"
-const Default_SignTx_Version uint32 = 1
-const Default_SignTx_LockTime uint32 = 0
-
-func (m *SignTx) GetOutputsCount() uint32 {
- if m != nil && m.OutputsCount != nil {
- return *m.OutputsCount
- }
- return 0
-}
-
-func (m *SignTx) GetInputsCount() uint32 {
- if m != nil && m.InputsCount != nil {
- return *m.InputsCount
- }
- return 0
-}
-
-func (m *SignTx) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_SignTx_CoinName
-}
-
-func (m *SignTx) GetVersion() uint32 {
- if m != nil && m.Version != nil {
- return *m.Version
- }
- return Default_SignTx_Version
-}
-
-func (m *SignTx) GetLockTime() uint32 {
- if m != nil && m.LockTime != nil {
- return *m.LockTime
- }
- return Default_SignTx_LockTime
-}
-
-// *
-// Request: Simplified transaction signing
-// This method doesn't support streaming, so there are hardware limits in number of inputs and outputs.
-// In case of success, the result is returned using TxRequest message.
-// @next PassphraseRequest
-// @next PinMatrixRequest
-// @next TxRequest
-// @next Failure
-type SimpleSignTx struct {
- Inputs []*TxInputType `protobuf:"bytes,1,rep,name=inputs" json:"inputs,omitempty"`
- Outputs []*TxOutputType `protobuf:"bytes,2,rep,name=outputs" json:"outputs,omitempty"`
- Transactions []*TransactionType `protobuf:"bytes,3,rep,name=transactions" json:"transactions,omitempty"`
- CoinName *string `protobuf:"bytes,4,opt,name=coin_name,json=coinName,def=Bitcoin" json:"coin_name,omitempty"`
- Version *uint32 `protobuf:"varint,5,opt,name=version,def=1" json:"version,omitempty"`
- LockTime *uint32 `protobuf:"varint,6,opt,name=lock_time,json=lockTime,def=0" json:"lock_time,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SimpleSignTx) Reset() { *m = SimpleSignTx{} }
-func (m *SimpleSignTx) String() string { return proto.CompactTextString(m) }
-func (*SimpleSignTx) ProtoMessage() {}
-func (*SimpleSignTx) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{46} }
-
-const Default_SimpleSignTx_CoinName string = "Bitcoin"
-const Default_SimpleSignTx_Version uint32 = 1
-const Default_SimpleSignTx_LockTime uint32 = 0
-
-func (m *SimpleSignTx) GetInputs() []*TxInputType {
- if m != nil {
- return m.Inputs
- }
- return nil
-}
-
-func (m *SimpleSignTx) GetOutputs() []*TxOutputType {
- if m != nil {
- return m.Outputs
- }
- return nil
-}
-
-func (m *SimpleSignTx) GetTransactions() []*TransactionType {
- if m != nil {
- return m.Transactions
- }
- return nil
-}
-
-func (m *SimpleSignTx) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return Default_SimpleSignTx_CoinName
-}
-
-func (m *SimpleSignTx) GetVersion() uint32 {
- if m != nil && m.Version != nil {
- return *m.Version
- }
- return Default_SimpleSignTx_Version
-}
-
-func (m *SimpleSignTx) GetLockTime() uint32 {
- if m != nil && m.LockTime != nil {
- return *m.LockTime
- }
- return Default_SimpleSignTx_LockTime
-}
-
-// *
-// Response: Device asks for information for signing transaction or returns the last result
-// If request_index is set, device awaits TxAck message (with fields filled in according to request_type)
-// If signature_index is set, 'signature' contains signed input of signature_index's input
-// @prev SignTx
-// @prev SimpleSignTx
-// @prev TxAck
-type TxRequest struct {
- RequestType *RequestType `protobuf:"varint,1,opt,name=request_type,json=requestType,enum=RequestType" json:"request_type,omitempty"`
- Details *TxRequestDetailsType `protobuf:"bytes,2,opt,name=details" json:"details,omitempty"`
- Serialized *TxRequestSerializedType `protobuf:"bytes,3,opt,name=serialized" json:"serialized,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxRequest) Reset() { *m = TxRequest{} }
-func (m *TxRequest) String() string { return proto.CompactTextString(m) }
-func (*TxRequest) ProtoMessage() {}
-func (*TxRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{47} }
-
-func (m *TxRequest) GetRequestType() RequestType {
- if m != nil && m.RequestType != nil {
- return *m.RequestType
- }
- return RequestType_TXINPUT
-}
-
-func (m *TxRequest) GetDetails() *TxRequestDetailsType {
- if m != nil {
- return m.Details
- }
- return nil
-}
-
-func (m *TxRequest) GetSerialized() *TxRequestSerializedType {
- if m != nil {
- return m.Serialized
- }
- return nil
-}
-
-// *
-// Request: Reported transaction data
-// @prev TxRequest
-// @next TxRequest
-type TxAck struct {
- Tx *TransactionType `protobuf:"bytes,1,opt,name=tx" json:"tx,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxAck) Reset() { *m = TxAck{} }
-func (m *TxAck) String() string { return proto.CompactTextString(m) }
-func (*TxAck) ProtoMessage() {}
-func (*TxAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{48} }
-
-func (m *TxAck) GetTx() *TransactionType {
- if m != nil {
- return m.Tx
- }
- return nil
-}
-
-// *
-// Request: Ask device to sign transaction
-// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
-// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
-// @next PassphraseRequest
-// @next PinMatrixRequest
-// @next EthereumTxRequest
-// @next Failure
-type EthereumSignTx struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Nonce []byte `protobuf:"bytes,2,opt,name=nonce" json:"nonce,omitempty"`
- GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice" json:"gas_price,omitempty"`
- GasLimit []byte `protobuf:"bytes,4,opt,name=gas_limit,json=gasLimit" json:"gas_limit,omitempty"`
- To []byte `protobuf:"bytes,5,opt,name=to" json:"to,omitempty"`
- Value []byte `protobuf:"bytes,6,opt,name=value" json:"value,omitempty"`
- DataInitialChunk []byte `protobuf:"bytes,7,opt,name=data_initial_chunk,json=dataInitialChunk" json:"data_initial_chunk,omitempty"`
- DataLength *uint32 `protobuf:"varint,8,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
- ChainId *uint32 `protobuf:"varint,9,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumSignTx) Reset() { *m = EthereumSignTx{} }
-func (m *EthereumSignTx) String() string { return proto.CompactTextString(m) }
-func (*EthereumSignTx) ProtoMessage() {}
-func (*EthereumSignTx) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{49} }
-
-func (m *EthereumSignTx) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetNonce() []byte {
- if m != nil {
- return m.Nonce
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetGasPrice() []byte {
- if m != nil {
- return m.GasPrice
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetGasLimit() []byte {
- if m != nil {
- return m.GasLimit
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetTo() []byte {
- if m != nil {
- return m.To
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetValue() []byte {
- if m != nil {
- return m.Value
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetDataInitialChunk() []byte {
- if m != nil {
- return m.DataInitialChunk
- }
- return nil
-}
-
-func (m *EthereumSignTx) GetDataLength() uint32 {
- if m != nil && m.DataLength != nil {
- return *m.DataLength
- }
- return 0
-}
-
-func (m *EthereumSignTx) GetChainId() uint32 {
- if m != nil && m.ChainId != nil {
- return *m.ChainId
- }
- return 0
-}
-
-// *
-// Response: Device asks for more data from transaction payload, or returns the signature.
-// If data_length is set, device awaits that many more bytes of payload.
-// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
-// @prev EthereumSignTx
-// @next EthereumTxAck
-type EthereumTxRequest struct {
- DataLength *uint32 `protobuf:"varint,1,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
- SignatureV *uint32 `protobuf:"varint,2,opt,name=signature_v,json=signatureV" json:"signature_v,omitempty"`
- SignatureR []byte `protobuf:"bytes,3,opt,name=signature_r,json=signatureR" json:"signature_r,omitempty"`
- SignatureS []byte `protobuf:"bytes,4,opt,name=signature_s,json=signatureS" json:"signature_s,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumTxRequest) Reset() { *m = EthereumTxRequest{} }
-func (m *EthereumTxRequest) String() string { return proto.CompactTextString(m) }
-func (*EthereumTxRequest) ProtoMessage() {}
-func (*EthereumTxRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{50} }
-
-func (m *EthereumTxRequest) GetDataLength() uint32 {
- if m != nil && m.DataLength != nil {
- return *m.DataLength
- }
- return 0
-}
-
-func (m *EthereumTxRequest) GetSignatureV() uint32 {
- if m != nil && m.SignatureV != nil {
- return *m.SignatureV
- }
- return 0
-}
-
-func (m *EthereumTxRequest) GetSignatureR() []byte {
- if m != nil {
- return m.SignatureR
- }
- return nil
-}
-
-func (m *EthereumTxRequest) GetSignatureS() []byte {
- if m != nil {
- return m.SignatureS
- }
- return nil
-}
-
-// *
-// Request: Transaction payload data.
-// @prev EthereumTxRequest
-// @next EthereumTxRequest
-type EthereumTxAck struct {
- DataChunk []byte `protobuf:"bytes,1,opt,name=data_chunk,json=dataChunk" json:"data_chunk,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumTxAck) Reset() { *m = EthereumTxAck{} }
-func (m *EthereumTxAck) String() string { return proto.CompactTextString(m) }
-func (*EthereumTxAck) ProtoMessage() {}
-func (*EthereumTxAck) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{51} }
-
-func (m *EthereumTxAck) GetDataChunk() []byte {
- if m != nil {
- return m.DataChunk
- }
- return nil
-}
-
-// *
-// Request: Ask device to sign message
-// @next EthereumMessageSignature
-// @next Failure
-type EthereumSignMessage struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Message []byte `protobuf:"bytes,2,req,name=message" json:"message,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumSignMessage) Reset() { *m = EthereumSignMessage{} }
-func (m *EthereumSignMessage) String() string { return proto.CompactTextString(m) }
-func (*EthereumSignMessage) ProtoMessage() {}
-func (*EthereumSignMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{52} }
-
-func (m *EthereumSignMessage) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *EthereumSignMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-// *
-// Request: Ask device to verify message
-// @next Success
-// @next Failure
-type EthereumVerifyMessage struct {
- Address []byte `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
- Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumVerifyMessage) Reset() { *m = EthereumVerifyMessage{} }
-func (m *EthereumVerifyMessage) String() string { return proto.CompactTextString(m) }
-func (*EthereumVerifyMessage) ProtoMessage() {}
-func (*EthereumVerifyMessage) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{53} }
-
-func (m *EthereumVerifyMessage) GetAddress() []byte {
- if m != nil {
- return m.Address
- }
- return nil
-}
-
-func (m *EthereumVerifyMessage) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-func (m *EthereumVerifyMessage) GetMessage() []byte {
- if m != nil {
- return m.Message
- }
- return nil
-}
-
-// *
-// Response: Signed message
-// @prev EthereumSignMessage
-type EthereumMessageSignature struct {
- Address []byte `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *EthereumMessageSignature) Reset() { *m = EthereumMessageSignature{} }
-func (m *EthereumMessageSignature) String() string { return proto.CompactTextString(m) }
-func (*EthereumMessageSignature) ProtoMessage() {}
-func (*EthereumMessageSignature) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{54} }
-
-func (m *EthereumMessageSignature) GetAddress() []byte {
- if m != nil {
- return m.Address
- }
- return nil
-}
-
-func (m *EthereumMessageSignature) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-// *
-// Request: Ask device to sign identity
-// @next SignedIdentity
-// @next Failure
-type SignIdentity struct {
- Identity *IdentityType `protobuf:"bytes,1,opt,name=identity" json:"identity,omitempty"`
- ChallengeHidden []byte `protobuf:"bytes,2,opt,name=challenge_hidden,json=challengeHidden" json:"challenge_hidden,omitempty"`
- ChallengeVisual *string `protobuf:"bytes,3,opt,name=challenge_visual,json=challengeVisual" json:"challenge_visual,omitempty"`
- EcdsaCurveName *string `protobuf:"bytes,4,opt,name=ecdsa_curve_name,json=ecdsaCurveName" json:"ecdsa_curve_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SignIdentity) Reset() { *m = SignIdentity{} }
-func (m *SignIdentity) String() string { return proto.CompactTextString(m) }
-func (*SignIdentity) ProtoMessage() {}
-func (*SignIdentity) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{55} }
-
-func (m *SignIdentity) GetIdentity() *IdentityType {
- if m != nil {
- return m.Identity
- }
- return nil
-}
-
-func (m *SignIdentity) GetChallengeHidden() []byte {
- if m != nil {
- return m.ChallengeHidden
- }
- return nil
-}
-
-func (m *SignIdentity) GetChallengeVisual() string {
- if m != nil && m.ChallengeVisual != nil {
- return *m.ChallengeVisual
- }
- return ""
-}
-
-func (m *SignIdentity) GetEcdsaCurveName() string {
- if m != nil && m.EcdsaCurveName != nil {
- return *m.EcdsaCurveName
- }
- return ""
-}
-
-// *
-// Response: Device provides signed identity
-// @prev SignIdentity
-type SignedIdentity struct {
- Address *string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- PublicKey []byte `protobuf:"bytes,2,opt,name=public_key,json=publicKey" json:"public_key,omitempty"`
- Signature []byte `protobuf:"bytes,3,opt,name=signature" json:"signature,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SignedIdentity) Reset() { *m = SignedIdentity{} }
-func (m *SignedIdentity) String() string { return proto.CompactTextString(m) }
-func (*SignedIdentity) ProtoMessage() {}
-func (*SignedIdentity) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{56} }
-
-func (m *SignedIdentity) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-func (m *SignedIdentity) GetPublicKey() []byte {
- if m != nil {
- return m.PublicKey
- }
- return nil
-}
-
-func (m *SignedIdentity) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-// *
-// Request: Ask device to generate ECDH session key
-// @next ECDHSessionKey
-// @next Failure
-type GetECDHSessionKey struct {
- Identity *IdentityType `protobuf:"bytes,1,opt,name=identity" json:"identity,omitempty"`
- PeerPublicKey []byte `protobuf:"bytes,2,opt,name=peer_public_key,json=peerPublicKey" json:"peer_public_key,omitempty"`
- EcdsaCurveName *string `protobuf:"bytes,3,opt,name=ecdsa_curve_name,json=ecdsaCurveName" json:"ecdsa_curve_name,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *GetECDHSessionKey) Reset() { *m = GetECDHSessionKey{} }
-func (m *GetECDHSessionKey) String() string { return proto.CompactTextString(m) }
-func (*GetECDHSessionKey) ProtoMessage() {}
-func (*GetECDHSessionKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{57} }
-
-func (m *GetECDHSessionKey) GetIdentity() *IdentityType {
- if m != nil {
- return m.Identity
- }
- return nil
-}
-
-func (m *GetECDHSessionKey) GetPeerPublicKey() []byte {
- if m != nil {
- return m.PeerPublicKey
- }
- return nil
-}
-
-func (m *GetECDHSessionKey) GetEcdsaCurveName() string {
- if m != nil && m.EcdsaCurveName != nil {
- return *m.EcdsaCurveName
- }
- return ""
-}
-
-// *
-// Response: Device provides ECDH session key
-// @prev GetECDHSessionKey
-type ECDHSessionKey struct {
- SessionKey []byte `protobuf:"bytes,1,opt,name=session_key,json=sessionKey" json:"session_key,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *ECDHSessionKey) Reset() { *m = ECDHSessionKey{} }
-func (m *ECDHSessionKey) String() string { return proto.CompactTextString(m) }
-func (*ECDHSessionKey) ProtoMessage() {}
-func (*ECDHSessionKey) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{58} }
-
-func (m *ECDHSessionKey) GetSessionKey() []byte {
- if m != nil {
- return m.SessionKey
- }
- return nil
-}
-
-// *
-// Request: Set U2F counter
-// @next Success
-type SetU2FCounter struct {
- U2FCounter *uint32 `protobuf:"varint,1,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SetU2FCounter) Reset() { *m = SetU2FCounter{} }
-func (m *SetU2FCounter) String() string { return proto.CompactTextString(m) }
-func (*SetU2FCounter) ProtoMessage() {}
-func (*SetU2FCounter) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{59} }
-
-func (m *SetU2FCounter) GetU2FCounter() uint32 {
- if m != nil && m.U2FCounter != nil {
- return *m.U2FCounter
- }
- return 0
-}
-
-// *
-// Request: Ask device to erase its firmware (so it can be replaced via FirmwareUpload)
-// @next Success
-// @next FirmwareRequest
-// @next Failure
-type FirmwareErase struct {
- Length *uint32 `protobuf:"varint,1,opt,name=length" json:"length,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *FirmwareErase) Reset() { *m = FirmwareErase{} }
-func (m *FirmwareErase) String() string { return proto.CompactTextString(m) }
-func (*FirmwareErase) ProtoMessage() {}
-func (*FirmwareErase) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{60} }
-
-func (m *FirmwareErase) GetLength() uint32 {
- if m != nil && m.Length != nil {
- return *m.Length
- }
- return 0
-}
-
-// *
-// Response: Ask for firmware chunk
-// @next FirmwareUpload
-type FirmwareRequest struct {
- Offset *uint32 `protobuf:"varint,1,opt,name=offset" json:"offset,omitempty"`
- Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *FirmwareRequest) Reset() { *m = FirmwareRequest{} }
-func (m *FirmwareRequest) String() string { return proto.CompactTextString(m) }
-func (*FirmwareRequest) ProtoMessage() {}
-func (*FirmwareRequest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{61} }
-
-func (m *FirmwareRequest) GetOffset() uint32 {
- if m != nil && m.Offset != nil {
- return *m.Offset
- }
- return 0
-}
-
-func (m *FirmwareRequest) GetLength() uint32 {
- if m != nil && m.Length != nil {
- return *m.Length
- }
- return 0
-}
-
-// *
-// Request: Send firmware in binary form to the device
-// @next Success
-// @next Failure
-type FirmwareUpload struct {
- Payload []byte `protobuf:"bytes,1,req,name=payload" json:"payload,omitempty"`
- Hash []byte `protobuf:"bytes,2,opt,name=hash" json:"hash,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *FirmwareUpload) Reset() { *m = FirmwareUpload{} }
-func (m *FirmwareUpload) String() string { return proto.CompactTextString(m) }
-func (*FirmwareUpload) ProtoMessage() {}
-func (*FirmwareUpload) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{62} }
-
-func (m *FirmwareUpload) GetPayload() []byte {
- if m != nil {
- return m.Payload
- }
- return nil
-}
-
-func (m *FirmwareUpload) GetHash() []byte {
- if m != nil {
- return m.Hash
- }
- return nil
-}
-
-// *
-// Request: Perform a device self-test
-// @next Success
-// @next Failure
-type SelfTest struct {
- Payload []byte `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *SelfTest) Reset() { *m = SelfTest{} }
-func (m *SelfTest) String() string { return proto.CompactTextString(m) }
-func (*SelfTest) ProtoMessage() {}
-func (*SelfTest) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{63} }
-
-func (m *SelfTest) GetPayload() []byte {
- if m != nil {
- return m.Payload
- }
- return nil
-}
-
-// *
-// Request: "Press" the button on the device
-// @next Success
-type DebugLinkDecision struct {
- YesNo *bool `protobuf:"varint,1,req,name=yes_no,json=yesNo" json:"yes_no,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkDecision) Reset() { *m = DebugLinkDecision{} }
-func (m *DebugLinkDecision) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkDecision) ProtoMessage() {}
-func (*DebugLinkDecision) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{64} }
-
-func (m *DebugLinkDecision) GetYesNo() bool {
- if m != nil && m.YesNo != nil {
- return *m.YesNo
- }
- return false
-}
-
-// *
-// Request: Computer asks for device state
-// @next DebugLinkState
-type DebugLinkGetState struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkGetState) Reset() { *m = DebugLinkGetState{} }
-func (m *DebugLinkGetState) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkGetState) ProtoMessage() {}
-func (*DebugLinkGetState) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{65} }
-
-// *
-// Response: Device current state
-// @prev DebugLinkGetState
-type DebugLinkState struct {
- Layout []byte `protobuf:"bytes,1,opt,name=layout" json:"layout,omitempty"`
- Pin *string `protobuf:"bytes,2,opt,name=pin" json:"pin,omitempty"`
- Matrix *string `protobuf:"bytes,3,opt,name=matrix" json:"matrix,omitempty"`
- Mnemonic *string `protobuf:"bytes,4,opt,name=mnemonic" json:"mnemonic,omitempty"`
- Node *HDNodeType `protobuf:"bytes,5,opt,name=node" json:"node,omitempty"`
- PassphraseProtection *bool `protobuf:"varint,6,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
- ResetWord *string `protobuf:"bytes,7,opt,name=reset_word,json=resetWord" json:"reset_word,omitempty"`
- ResetEntropy []byte `protobuf:"bytes,8,opt,name=reset_entropy,json=resetEntropy" json:"reset_entropy,omitempty"`
- RecoveryFakeWord *string `protobuf:"bytes,9,opt,name=recovery_fake_word,json=recoveryFakeWord" json:"recovery_fake_word,omitempty"`
- RecoveryWordPos *uint32 `protobuf:"varint,10,opt,name=recovery_word_pos,json=recoveryWordPos" json:"recovery_word_pos,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkState) Reset() { *m = DebugLinkState{} }
-func (m *DebugLinkState) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkState) ProtoMessage() {}
-func (*DebugLinkState) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{66} }
-
-func (m *DebugLinkState) GetLayout() []byte {
- if m != nil {
- return m.Layout
- }
- return nil
-}
-
-func (m *DebugLinkState) GetPin() string {
- if m != nil && m.Pin != nil {
- return *m.Pin
- }
- return ""
-}
-
-func (m *DebugLinkState) GetMatrix() string {
- if m != nil && m.Matrix != nil {
- return *m.Matrix
- }
- return ""
-}
-
-func (m *DebugLinkState) GetMnemonic() string {
- if m != nil && m.Mnemonic != nil {
- return *m.Mnemonic
- }
- return ""
-}
-
-func (m *DebugLinkState) GetNode() *HDNodeType {
- if m != nil {
- return m.Node
- }
- return nil
-}
-
-func (m *DebugLinkState) GetPassphraseProtection() bool {
- if m != nil && m.PassphraseProtection != nil {
- return *m.PassphraseProtection
- }
- return false
-}
-
-func (m *DebugLinkState) GetResetWord() string {
- if m != nil && m.ResetWord != nil {
- return *m.ResetWord
- }
- return ""
-}
-
-func (m *DebugLinkState) GetResetEntropy() []byte {
- if m != nil {
- return m.ResetEntropy
- }
- return nil
-}
-
-func (m *DebugLinkState) GetRecoveryFakeWord() string {
- if m != nil && m.RecoveryFakeWord != nil {
- return *m.RecoveryFakeWord
- }
- return ""
-}
-
-func (m *DebugLinkState) GetRecoveryWordPos() uint32 {
- if m != nil && m.RecoveryWordPos != nil {
- return *m.RecoveryWordPos
- }
- return 0
-}
-
-// *
-// Request: Ask device to restart
-type DebugLinkStop struct {
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkStop) Reset() { *m = DebugLinkStop{} }
-func (m *DebugLinkStop) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkStop) ProtoMessage() {}
-func (*DebugLinkStop) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{67} }
-
-// *
-// Response: Device wants host to log event
-type DebugLinkLog struct {
- Level *uint32 `protobuf:"varint,1,opt,name=level" json:"level,omitempty"`
- Bucket *string `protobuf:"bytes,2,opt,name=bucket" json:"bucket,omitempty"`
- Text *string `protobuf:"bytes,3,opt,name=text" json:"text,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkLog) Reset() { *m = DebugLinkLog{} }
-func (m *DebugLinkLog) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkLog) ProtoMessage() {}
-func (*DebugLinkLog) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{68} }
-
-func (m *DebugLinkLog) GetLevel() uint32 {
- if m != nil && m.Level != nil {
- return *m.Level
- }
- return 0
-}
-
-func (m *DebugLinkLog) GetBucket() string {
- if m != nil && m.Bucket != nil {
- return *m.Bucket
- }
- return ""
-}
-
-func (m *DebugLinkLog) GetText() string {
- if m != nil && m.Text != nil {
- return *m.Text
- }
- return ""
-}
-
-// *
-// Request: Read memory from device
-// @next DebugLinkMemory
-type DebugLinkMemoryRead struct {
- Address *uint32 `protobuf:"varint,1,opt,name=address" json:"address,omitempty"`
- Length *uint32 `protobuf:"varint,2,opt,name=length" json:"length,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkMemoryRead) Reset() { *m = DebugLinkMemoryRead{} }
-func (m *DebugLinkMemoryRead) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkMemoryRead) ProtoMessage() {}
-func (*DebugLinkMemoryRead) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{69} }
-
-func (m *DebugLinkMemoryRead) GetAddress() uint32 {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return 0
-}
-
-func (m *DebugLinkMemoryRead) GetLength() uint32 {
- if m != nil && m.Length != nil {
- return *m.Length
- }
- return 0
-}
-
-// *
-// Response: Device sends memory back
-// @prev DebugLinkMemoryRead
-type DebugLinkMemory struct {
- Memory []byte `protobuf:"bytes,1,opt,name=memory" json:"memory,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkMemory) Reset() { *m = DebugLinkMemory{} }
-func (m *DebugLinkMemory) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkMemory) ProtoMessage() {}
-func (*DebugLinkMemory) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{70} }
-
-func (m *DebugLinkMemory) GetMemory() []byte {
- if m != nil {
- return m.Memory
- }
- return nil
-}
-
-// *
-// Request: Write memory to device.
-// WARNING: Writing to the wrong location can irreparably break the device.
-type DebugLinkMemoryWrite struct {
- Address *uint32 `protobuf:"varint,1,opt,name=address" json:"address,omitempty"`
- Memory []byte `protobuf:"bytes,2,opt,name=memory" json:"memory,omitempty"`
- Flash *bool `protobuf:"varint,3,opt,name=flash" json:"flash,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkMemoryWrite) Reset() { *m = DebugLinkMemoryWrite{} }
-func (m *DebugLinkMemoryWrite) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkMemoryWrite) ProtoMessage() {}
-func (*DebugLinkMemoryWrite) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{71} }
-
-func (m *DebugLinkMemoryWrite) GetAddress() uint32 {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return 0
-}
-
-func (m *DebugLinkMemoryWrite) GetMemory() []byte {
- if m != nil {
- return m.Memory
- }
- return nil
-}
-
-func (m *DebugLinkMemoryWrite) GetFlash() bool {
- if m != nil && m.Flash != nil {
- return *m.Flash
- }
- return false
-}
-
-// *
-// Request: Erase block of flash on device
-// WARNING: Writing to the wrong location can irreparably break the device.
-type DebugLinkFlashErase struct {
- Sector *uint32 `protobuf:"varint,1,opt,name=sector" json:"sector,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *DebugLinkFlashErase) Reset() { *m = DebugLinkFlashErase{} }
-func (m *DebugLinkFlashErase) String() string { return proto.CompactTextString(m) }
-func (*DebugLinkFlashErase) ProtoMessage() {}
-func (*DebugLinkFlashErase) Descriptor() ([]byte, []int) { return fileDescriptor1, []int{72} }
-
-func (m *DebugLinkFlashErase) GetSector() uint32 {
- if m != nil && m.Sector != nil {
- return *m.Sector
- }
- return 0
-}
-
-func init() {
- proto.RegisterType((*Initialize)(nil), "Initialize")
- proto.RegisterType((*GetFeatures)(nil), "GetFeatures")
- proto.RegisterType((*Features)(nil), "Features")
- proto.RegisterType((*ClearSession)(nil), "ClearSession")
- proto.RegisterType((*ApplySettings)(nil), "ApplySettings")
- proto.RegisterType((*ApplyFlags)(nil), "ApplyFlags")
- proto.RegisterType((*ChangePin)(nil), "ChangePin")
- proto.RegisterType((*Ping)(nil), "Ping")
- proto.RegisterType((*Success)(nil), "Success")
- proto.RegisterType((*Failure)(nil), "Failure")
- proto.RegisterType((*ButtonRequest)(nil), "ButtonRequest")
- proto.RegisterType((*ButtonAck)(nil), "ButtonAck")
- proto.RegisterType((*PinMatrixRequest)(nil), "PinMatrixRequest")
- proto.RegisterType((*PinMatrixAck)(nil), "PinMatrixAck")
- proto.RegisterType((*Cancel)(nil), "Cancel")
- proto.RegisterType((*PassphraseRequest)(nil), "PassphraseRequest")
- proto.RegisterType((*PassphraseAck)(nil), "PassphraseAck")
- proto.RegisterType((*GetEntropy)(nil), "GetEntropy")
- proto.RegisterType((*Entropy)(nil), "Entropy")
- proto.RegisterType((*GetPublicKey)(nil), "GetPublicKey")
- proto.RegisterType((*PublicKey)(nil), "PublicKey")
- proto.RegisterType((*GetAddress)(nil), "GetAddress")
- proto.RegisterType((*EthereumGetAddress)(nil), "EthereumGetAddress")
- proto.RegisterType((*Address)(nil), "Address")
- proto.RegisterType((*EthereumAddress)(nil), "EthereumAddress")
- proto.RegisterType((*WipeDevice)(nil), "WipeDevice")
- proto.RegisterType((*LoadDevice)(nil), "LoadDevice")
- proto.RegisterType((*ResetDevice)(nil), "ResetDevice")
- proto.RegisterType((*BackupDevice)(nil), "BackupDevice")
- proto.RegisterType((*EntropyRequest)(nil), "EntropyRequest")
- proto.RegisterType((*EntropyAck)(nil), "EntropyAck")
- proto.RegisterType((*RecoveryDevice)(nil), "RecoveryDevice")
- proto.RegisterType((*WordRequest)(nil), "WordRequest")
- proto.RegisterType((*WordAck)(nil), "WordAck")
- proto.RegisterType((*SignMessage)(nil), "SignMessage")
- proto.RegisterType((*VerifyMessage)(nil), "VerifyMessage")
- proto.RegisterType((*MessageSignature)(nil), "MessageSignature")
- proto.RegisterType((*EncryptMessage)(nil), "EncryptMessage")
- proto.RegisterType((*EncryptedMessage)(nil), "EncryptedMessage")
- proto.RegisterType((*DecryptMessage)(nil), "DecryptMessage")
- proto.RegisterType((*DecryptedMessage)(nil), "DecryptedMessage")
- proto.RegisterType((*CipherKeyValue)(nil), "CipherKeyValue")
- proto.RegisterType((*CipheredKeyValue)(nil), "CipheredKeyValue")
- proto.RegisterType((*EstimateTxSize)(nil), "EstimateTxSize")
- proto.RegisterType((*TxSize)(nil), "TxSize")
- proto.RegisterType((*SignTx)(nil), "SignTx")
- proto.RegisterType((*SimpleSignTx)(nil), "SimpleSignTx")
- proto.RegisterType((*TxRequest)(nil), "TxRequest")
- proto.RegisterType((*TxAck)(nil), "TxAck")
- proto.RegisterType((*EthereumSignTx)(nil), "EthereumSignTx")
- proto.RegisterType((*EthereumTxRequest)(nil), "EthereumTxRequest")
- proto.RegisterType((*EthereumTxAck)(nil), "EthereumTxAck")
- proto.RegisterType((*EthereumSignMessage)(nil), "EthereumSignMessage")
- proto.RegisterType((*EthereumVerifyMessage)(nil), "EthereumVerifyMessage")
- proto.RegisterType((*EthereumMessageSignature)(nil), "EthereumMessageSignature")
- proto.RegisterType((*SignIdentity)(nil), "SignIdentity")
- proto.RegisterType((*SignedIdentity)(nil), "SignedIdentity")
- proto.RegisterType((*GetECDHSessionKey)(nil), "GetECDHSessionKey")
- proto.RegisterType((*ECDHSessionKey)(nil), "ECDHSessionKey")
- proto.RegisterType((*SetU2FCounter)(nil), "SetU2FCounter")
- proto.RegisterType((*FirmwareErase)(nil), "FirmwareErase")
- proto.RegisterType((*FirmwareRequest)(nil), "FirmwareRequest")
- proto.RegisterType((*FirmwareUpload)(nil), "FirmwareUpload")
- proto.RegisterType((*SelfTest)(nil), "SelfTest")
- proto.RegisterType((*DebugLinkDecision)(nil), "DebugLinkDecision")
- proto.RegisterType((*DebugLinkGetState)(nil), "DebugLinkGetState")
- proto.RegisterType((*DebugLinkState)(nil), "DebugLinkState")
- proto.RegisterType((*DebugLinkStop)(nil), "DebugLinkStop")
- proto.RegisterType((*DebugLinkLog)(nil), "DebugLinkLog")
- proto.RegisterType((*DebugLinkMemoryRead)(nil), "DebugLinkMemoryRead")
- proto.RegisterType((*DebugLinkMemory)(nil), "DebugLinkMemory")
- proto.RegisterType((*DebugLinkMemoryWrite)(nil), "DebugLinkMemoryWrite")
- proto.RegisterType((*DebugLinkFlashErase)(nil), "DebugLinkFlashErase")
- proto.RegisterEnum("MessageType", MessageType_name, MessageType_value)
-}
-
-func init() { proto.RegisterFile("messages.proto", fileDescriptor1) }
-
-var fileDescriptor1 = []byte{
- // 3424 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x5a, 0xcb, 0x6f, 0xdc, 0x46,
- 0x9a, 0x5f, 0x76, 0xb7, 0xfa, 0xf1, 0x35, 0xbb, 0x55, 0xa2, 0x2d, 0xbb, 0x2d, 0x5b, 0xb6, 0x4c,
- 0xc9, 0xb6, 0x64, 0x27, 0xed, 0x44, 0x79, 0x6c, 0xd6, 0xbb, 0x79, 0xc8, 0x7a, 0xd8, 0xde, 0xd8,
- 0x8e, 0xc0, 0x56, 0x9c, 0xdb, 0x12, 0x14, 0x59, 0xea, 0xae, 0x55, 0x37, 0xc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 0xc5, 0x02, 0xe1, 0xa5, 0xda,
- 0xf7, 0x25, 0x86, 0xca, 0xdf, 0x35, 0xd0, 0xd1, 0x52, 0xed, 0x87, 0x12, 0x43, 0xe5, 0xaa, 0x65,
- 0x34, 0x14, 0xac, 0x0a, 0xe1, 0x2c, 0x57, 0xd0, 0x68, 0x24, 0x18, 0x15, 0x8c, 0x59, 0x52, 0x13,
- 0x23, 0x57, 0xb0, 0x2b, 0x84, 0x61, 0x01, 0x8a, 0x3c, 0xc1, 0xf1, 0x2e, 0xac, 0x9c, 0x03, 0x63,
- 0x15, 0x2f, 0xf2, 0x05, 0xcb, 0x59, 0xab, 0x67, 0xd5, 0x2b, 0xfa, 0x9a, 0x43, 0x1f, 0xbe, 0x0f,
- 0xab, 0xb6, 0x37, 0xe9, 0x87, 0x56, 0xe4, 0x85, 0x23, 0x32, 0xb6, 0x0e, 0xc3, 0x7e, 0x14, 0xe0,
- 0x97, 0x5e, 0xd0, 0x1f, 0x93, 0x43, 0xfe, 0x6f, 0x7e, 0x87, 0xf1, 0xd1, 0xc3, 0xce, 0x01, 0x23,
- 0x0a, 0xae, 0x7f, 0x0f, 0x00, 0x00, 0xff, 0xff, 0x2a, 0xe4, 0xc0, 0x85, 0x16, 0x28, 0x00, 0x00,
-}
diff --git a/accounts/usbwallet/internal/trezor/messages.proto b/accounts/usbwallet/internal/trezor/messages.proto
deleted file mode 100644
index 8cb9c8cc25..0000000000
--- a/accounts/usbwallet/internal/trezor/messages.proto
+++ /dev/null
@@ -1,905 +0,0 @@
-// This file originates from the SatoshiLabs Trezor `common` repository at:
-// https://github.com/trezor/trezor-common/blob/master/protob/messages.proto
-// dated 28.07.2017, commit dd8ec3231fb5f7992360aff9bdfe30bb58130f4b.
-
-syntax = "proto2";
-
-/**
- * Messages for TREZOR communication
- */
-
-// Sugar for easier handling in Java
-option java_package = "com.satoshilabs.trezor.lib.protobuf";
-option java_outer_classname = "TrezorMessage";
-
-import "types.proto";
-
-/**
- * Mapping between Trezor wire identifier (uint) and a protobuf message
- */
-enum MessageType {
- MessageType_Initialize = 0 [(wire_in) = true];
- MessageType_Ping = 1 [(wire_in) = true];
- MessageType_Success = 2 [(wire_out) = true];
- MessageType_Failure = 3 [(wire_out) = true];
- MessageType_ChangePin = 4 [(wire_in) = true];
- MessageType_WipeDevice = 5 [(wire_in) = true];
- MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true];
- MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true];
- MessageType_FirmwareRequest = 8 [(wire_out) = true, (wire_bootloader) = true];
- MessageType_GetEntropy = 9 [(wire_in) = true];
- MessageType_Entropy = 10 [(wire_out) = true];
- MessageType_GetPublicKey = 11 [(wire_in) = true];
- MessageType_PublicKey = 12 [(wire_out) = true];
- MessageType_LoadDevice = 13 [(wire_in) = true];
- MessageType_ResetDevice = 14 [(wire_in) = true];
- MessageType_SignTx = 15 [(wire_in) = true];
- MessageType_SimpleSignTx = 16 [(wire_in) = true, deprecated = true];
- MessageType_Features = 17 [(wire_out) = true];
- MessageType_PinMatrixRequest = 18 [(wire_out) = true];
- MessageType_PinMatrixAck = 19 [(wire_in) = true, (wire_tiny) = true];
- MessageType_Cancel = 20 [(wire_in) = true];
- MessageType_TxRequest = 21 [(wire_out) = true];
- MessageType_TxAck = 22 [(wire_in) = true];
- MessageType_CipherKeyValue = 23 [(wire_in) = true];
- MessageType_ClearSession = 24 [(wire_in) = true];
- MessageType_ApplySettings = 25 [(wire_in) = true];
- MessageType_ButtonRequest = 26 [(wire_out) = true];
- MessageType_ButtonAck = 27 [(wire_in) = true, (wire_tiny) = true];
- MessageType_ApplyFlags = 28 [(wire_in) = true];
- MessageType_GetAddress = 29 [(wire_in) = true];
- MessageType_Address = 30 [(wire_out) = true];
- MessageType_SelfTest = 32 [(wire_in) = true, (wire_bootloader) = true];
- MessageType_BackupDevice = 34 [(wire_in) = true];
- MessageType_EntropyRequest = 35 [(wire_out) = true];
- MessageType_EntropyAck = 36 [(wire_in) = true];
- MessageType_SignMessage = 38 [(wire_in) = true];
- MessageType_VerifyMessage = 39 [(wire_in) = true];
- MessageType_MessageSignature = 40 [(wire_out) = true];
- MessageType_PassphraseRequest = 41 [(wire_out) = true];
- MessageType_PassphraseAck = 42 [(wire_in) = true, (wire_tiny) = true];
- MessageType_EstimateTxSize = 43 [(wire_in) = true, deprecated = true];
- MessageType_TxSize = 44 [(wire_out) = true, deprecated = true];
- MessageType_RecoveryDevice = 45 [(wire_in) = true];
- MessageType_WordRequest = 46 [(wire_out) = true];
- MessageType_WordAck = 47 [(wire_in) = true];
- MessageType_CipheredKeyValue = 48 [(wire_out) = true];
- MessageType_EncryptMessage = 49 [(wire_in) = true, deprecated = true];
- MessageType_EncryptedMessage = 50 [(wire_out) = true, deprecated = true];
- MessageType_DecryptMessage = 51 [(wire_in) = true, deprecated = true];
- MessageType_DecryptedMessage = 52 [(wire_out) = true, deprecated = true];
- MessageType_SignIdentity = 53 [(wire_in) = true];
- MessageType_SignedIdentity = 54 [(wire_out) = true];
- MessageType_GetFeatures = 55 [(wire_in) = true];
- MessageType_EthereumGetAddress = 56 [(wire_in) = true];
- MessageType_EthereumAddress = 57 [(wire_out) = true];
- MessageType_EthereumSignTx = 58 [(wire_in) = true];
- MessageType_EthereumTxRequest = 59 [(wire_out) = true];
- MessageType_EthereumTxAck = 60 [(wire_in) = true];
- MessageType_GetECDHSessionKey = 61 [(wire_in) = true];
- MessageType_ECDHSessionKey = 62 [(wire_out) = true];
- MessageType_SetU2FCounter = 63 [(wire_in) = true];
- MessageType_EthereumSignMessage = 64 [(wire_in) = true];
- MessageType_EthereumVerifyMessage = 65 [(wire_in) = true];
- MessageType_EthereumMessageSignature = 66 [(wire_out) = true];
- MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true, (wire_tiny) = true];
- MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true];
- MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
- MessageType_DebugLinkStop = 103 [(wire_debug_in) = true];
- MessageType_DebugLinkLog = 104 [(wire_debug_out) = true];
- MessageType_DebugLinkMemoryRead = 110 [(wire_debug_in) = true];
- MessageType_DebugLinkMemory = 111 [(wire_debug_out) = true];
- MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true];
- MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true];
-}
-
-////////////////////
-// Basic messages //
-////////////////////
-
-/**
- * Request: Reset device to default state and ask for device details
- * @next Features
- */
-message Initialize {
-}
-
-/**
- * Request: Ask for device details (no device reset)
- * @next Features
- */
-message GetFeatures {
-}
-
-/**
- * Response: Reports various information about the device
- * @prev Initialize
- * @prev GetFeatures
- */
-message Features {
- optional string vendor = 1; // name of the manufacturer, e.g. "bitcointrezor.com"
- optional uint32 major_version = 2; // major version of the device, e.g. 1
- optional uint32 minor_version = 3; // minor version of the device, e.g. 0
- optional uint32 patch_version = 4; // patch version of the device, e.g. 0
- optional bool bootloader_mode = 5; // is device in bootloader mode?
- optional string device_id = 6; // device's unique identifier
- optional bool pin_protection = 7; // is device protected by PIN?
- optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
- optional string language = 9; // device language
- optional string label = 10; // device description label
- repeated CoinType coins = 11; // supported coins
- optional bool initialized = 12; // does device contain seed?
- optional bytes revision = 13; // SCM revision of firmware
- optional bytes bootloader_hash = 14; // hash of the bootloader
- optional bool imported = 15; // was storage imported from an external source?
- optional bool pin_cached = 16; // is PIN already cached in session?
- optional bool passphrase_cached = 17; // is passphrase already cached in session?
- optional bool firmware_present = 18; // is valid firmware loaded?
- optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
- optional uint32 flags = 20; // device flags (equals to Storage.flags)
-}
-
-/**
- * Request: clear session (removes cached PIN, passphrase, etc).
- * @next Success
- */
-message ClearSession {
-}
-
-/**
- * Request: change language and/or label of the device
- * @next Success
- * @next Failure
- * @next ButtonRequest
- * @next PinMatrixRequest
- */
-message ApplySettings {
- optional string language = 1;
- optional string label = 2;
- optional bool use_passphrase = 3;
- optional bytes homescreen = 4;
-}
-
-/**
- * Request: set flags of the device
- * @next Success
- * @next Failure
- */
-message ApplyFlags {
- optional uint32 flags = 1; // bitmask, can only set bits, not unset
-}
-
-/**
- * Request: Starts workflow for setting/changing/removing the PIN
- * @next ButtonRequest
- * @next PinMatrixRequest
- */
-message ChangePin {
- optional bool remove = 1; // is PIN removal requested?
-}
-
-/**
- * Request: Test if the device is alive, device sends back the message in Success response
- * @next Success
- */
-message Ping {
- optional string message = 1; // message to send back in Success message
- optional bool button_protection = 2; // ask for button press
- optional bool pin_protection = 3; // ask for PIN if set in device
- optional bool passphrase_protection = 4; // ask for passphrase if set in device
-}
-
-/**
- * Response: Success of the previous request
- */
-message Success {
- optional string message = 1; // human readable description of action or request-specific payload
-}
-
-/**
- * Response: Failure of the previous request
- */
-message Failure {
- optional FailureType code = 1; // computer-readable definition of the error state
- optional string message = 2; // human-readable message of the error state
-}
-
-/**
- * Response: Device is waiting for HW button press.
- * @next ButtonAck
- * @next Cancel
- */
-message ButtonRequest {
- optional ButtonRequestType code = 1;
- optional string data = 2;
-}
-
-/**
- * Request: Computer agrees to wait for HW button press
- * @prev ButtonRequest
- */
-message ButtonAck {
-}
-
-/**
- * Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
- * @next PinMatrixAck
- * @next Cancel
- */
-message PinMatrixRequest {
- optional PinMatrixRequestType type = 1;
-}
-
-/**
- * Request: Computer responds with encoded PIN
- * @prev PinMatrixRequest
- */
-message PinMatrixAck {
- required string pin = 1; // matrix encoded PIN entered by user
-}
-
-/**
- * Request: Abort last operation that required user interaction
- * @prev ButtonRequest
- * @prev PinMatrixRequest
- * @prev PassphraseRequest
- */
-message Cancel {
-}
-
-/**
- * Response: Device awaits encryption passphrase
- * @next PassphraseAck
- * @next Cancel
- */
-message PassphraseRequest {
-}
-
-/**
- * Request: Send passphrase back
- * @prev PassphraseRequest
- */
-message PassphraseAck {
- required string passphrase = 1;
-}
-
-/**
- * Request: Request a sample of random data generated by hardware RNG. May be used for testing.
- * @next ButtonRequest
- * @next Entropy
- * @next Failure
- */
-message GetEntropy {
- required uint32 size = 1; // size of requested entropy
-}
-
-/**
- * Response: Reply with random data generated by internal RNG
- * @prev GetEntropy
- */
-message Entropy {
- required bytes entropy = 1; // stream of random generated bytes
-}
-
-/**
- * Request: Ask device for public key corresponding to address_n path
- * @next PassphraseRequest
- * @next PublicKey
- * @next Failure
- */
-message GetPublicKey {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- optional string ecdsa_curve_name = 2; // ECDSA curve name to use
- optional bool show_display = 3; // optionally show on display before sending the result
- optional string coin_name = 4 [default='Bitcoin'];
-}
-
-/**
- * Response: Contains public key derived from device private seed
- * @prev GetPublicKey
- */
-message PublicKey {
- required HDNodeType node = 1; // BIP32 public node
- optional string xpub = 2; // serialized form of public node
-}
-
-/**
- * Request: Ask device for address corresponding to address_n path
- * @next PassphraseRequest
- * @next Address
- * @next Failure
- */
-message GetAddress {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- optional string coin_name = 2 [default='Bitcoin'];
- optional bool show_display = 3 ; // optionally show on display before sending the result
- optional MultisigRedeemScriptType multisig = 4; // filled if we are showing a multisig address
- optional InputScriptType script_type = 5 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
-}
-
-/**
- * Request: Ask device for Ethereum address corresponding to address_n path
- * @next PassphraseRequest
- * @next EthereumAddress
- * @next Failure
- */
-message EthereumGetAddress {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- optional bool show_display = 2; // optionally show on display before sending the result
-}
-
-/**
- * Response: Contains address derived from device private seed
- * @prev GetAddress
- */
-message Address {
- required string address = 1; // Coin address in Base58 encoding
-}
-
-/**
- * Response: Contains an Ethereum address derived from device private seed
- * @prev EthereumGetAddress
- */
-message EthereumAddress {
- required bytes address = 1; // Coin address as an Ethereum 160 bit hash
-}
-
-/**
- * Request: Request device to wipe all sensitive data and settings
- * @next ButtonRequest
- */
-message WipeDevice {
-}
-
-/**
- * Request: Load seed and related internal settings from the computer
- * @next ButtonRequest
- * @next Success
- * @next Failure
- */
-message LoadDevice {
- optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words)
- optional HDNodeType node = 2; // BIP-32 node
- optional string pin = 3; // set PIN protection
- optional bool passphrase_protection = 4; // enable master node encryption using passphrase
- optional string language = 5 [default='english']; // device language
- optional string label = 6; // device label
- optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum
- optional uint32 u2f_counter = 8; // U2F counter
-}
-
-/**
- * Request: Ask device to do initialization involving user interaction
- * @next EntropyRequest
- * @next Failure
- */
-message ResetDevice {
- optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy
- optional uint32 strength = 2 [default=256]; // strength of seed in bits
- optional bool passphrase_protection = 3; // enable master node encryption using passphrase
- optional bool pin_protection = 4; // enable PIN protection
- optional string language = 5 [default='english']; // device language
- optional string label = 6; // device label
- optional uint32 u2f_counter = 7; // U2F counter
- optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow
-}
-
-/**
- * Request: Perform backup of the device seed if not backed up using ResetDevice
- * @next ButtonRequest
- */
-message BackupDevice {
-}
-
-/**
- * Response: Ask for additional entropy from host computer
- * @prev ResetDevice
- * @next EntropyAck
- */
-message EntropyRequest {
-}
-
-/**
- * Request: Provide additional entropy for seed generation function
- * @prev EntropyRequest
- * @next ButtonRequest
- */
-message EntropyAck {
- optional bytes entropy = 1; // 256 bits (32 bytes) of random data
-}
-
-/**
- * Request: Start recovery workflow asking user for specific words of mnemonic
- * Used to recovery device safely even on untrusted computer.
- * @next WordRequest
- */
-message RecoveryDevice {
- optional uint32 word_count = 1; // number of words in BIP-39 mnemonic
- optional bool passphrase_protection = 2; // enable master node encryption using passphrase
- optional bool pin_protection = 3; // enable PIN protection
- optional string language = 4 [default='english']; // device language
- optional string label = 5; // device label
- optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process
- // 7 reserved for unused recovery method
- optional uint32 type = 8; // supported recovery type (see RecoveryType)
- optional uint32 u2f_counter = 9; // U2F counter
- optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation)
-}
-
-/**
- * Response: Device is waiting for user to enter word of the mnemonic
- * Its position is shown only on device's internal display.
- * @prev RecoveryDevice
- * @prev WordAck
- */
-message WordRequest {
- optional WordRequestType type = 1;
-}
-
-/**
- * Request: Computer replies with word from the mnemonic
- * @prev WordRequest
- * @next WordRequest
- * @next Success
- * @next Failure
- */
-message WordAck {
- required string word = 1; // one word of mnemonic on asked position
-}
-
-//////////////////////////////
-// Message signing messages //
-//////////////////////////////
-
-/**
- * Request: Ask device to sign message
- * @next MessageSignature
- * @next Failure
- */
-message SignMessage {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- required bytes message = 2; // message to be signed
- optional string coin_name = 3 [default='Bitcoin']; // coin to use for signing
- optional InputScriptType script_type = 4 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
-}
-
-/**
- * Request: Ask device to verify message
- * @next Success
- * @next Failure
- */
-message VerifyMessage {
- optional string address = 1; // address to verify
- optional bytes signature = 2; // signature to verify
- optional bytes message = 3; // message to verify
- optional string coin_name = 4 [default='Bitcoin']; // coin to use for verifying
-}
-
-/**
- * Response: Signed message
- * @prev SignMessage
- */
-message MessageSignature {
- optional string address = 1; // address used to sign the message
- optional bytes signature = 2; // signature of the message
-}
-
-///////////////////////////
-// Encryption/decryption //
-///////////////////////////
-
-/**
- * Request: Ask device to encrypt message
- * @next EncryptedMessage
- * @next Failure
- */
-message EncryptMessage {
- optional bytes pubkey = 1; // public key
- optional bytes message = 2; // message to encrypt
- optional bool display_only = 3; // show just on display? (don't send back via wire)
- repeated uint32 address_n = 4; // BIP-32 path to derive the signing key from master node
- optional string coin_name = 5 [default='Bitcoin']; // coin to use for signing
-}
-
-/**
- * Response: Encrypted message
- * @prev EncryptMessage
- */
-message EncryptedMessage {
- optional bytes nonce = 1; // nonce used during encryption
- optional bytes message = 2; // encrypted message
- optional bytes hmac = 3; // message hmac
-}
-
-/**
- * Request: Ask device to decrypt message
- * @next Success
- * @next Failure
- */
-message DecryptMessage {
- repeated uint32 address_n = 1; // BIP-32 path to derive the decryption key from master node
- optional bytes nonce = 2; // nonce used during encryption
- optional bytes message = 3; // message to decrypt
- optional bytes hmac = 4; // message hmac
-}
-
-/**
- * Response: Decrypted message
- * @prev DecryptedMessage
- */
-message DecryptedMessage {
- optional bytes message = 1; // decrypted message
- optional string address = 2; // address used to sign the message (if used)
-}
-
-/**
- * Request: Ask device to encrypt or decrypt value of given key
- * @next CipheredKeyValue
- * @next Failure
- */
-message CipherKeyValue {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- optional string key = 2; // key component of key:value
- optional bytes value = 3; // value component of key:value
- optional bool encrypt = 4; // are we encrypting (True) or decrypting (False)?
- optional bool ask_on_encrypt = 5; // should we ask on encrypt operation?
- optional bool ask_on_decrypt = 6; // should we ask on decrypt operation?
- optional bytes iv = 7; // initialization vector (will be computed if not set)
-}
-
-/**
- * Response: Return ciphered/deciphered value
- * @prev CipherKeyValue
- */
-message CipheredKeyValue {
- optional bytes value = 1; // ciphered/deciphered value
-}
-
-//////////////////////////////////
-// Transaction signing messages //
-//////////////////////////////////
-
-/**
- * Request: Estimated size of the transaction
- * This behaves exactly like SignTx, which means that it can ask using TxRequest
- * This call is non-blocking (except possible PassphraseRequest to unlock the seed)
- * @next TxSize
- * @next Failure
- */
-message EstimateTxSize {
- required uint32 outputs_count = 1; // number of transaction outputs
- required uint32 inputs_count = 2; // number of transaction inputs
- optional string coin_name = 3 [default='Bitcoin']; // coin to use
-}
-
-/**
- * Response: Estimated size of the transaction
- * @prev EstimateTxSize
- */
-message TxSize {
- optional uint32 tx_size = 1; // estimated size of transaction in bytes
-}
-
-/**
- * Request: Ask device to sign transaction
- * @next PassphraseRequest
- * @next PinMatrixRequest
- * @next TxRequest
- * @next Failure
- */
-message SignTx {
- required uint32 outputs_count = 1; // number of transaction outputs
- required uint32 inputs_count = 2; // number of transaction inputs
- optional string coin_name = 3 [default='Bitcoin']; // coin to use
- optional uint32 version = 4 [default=1]; // transaction version
- optional uint32 lock_time = 5 [default=0]; // transaction lock_time
-}
-
-/**
- * Request: Simplified transaction signing
- * This method doesn't support streaming, so there are hardware limits in number of inputs and outputs.
- * In case of success, the result is returned using TxRequest message.
- * @next PassphraseRequest
- * @next PinMatrixRequest
- * @next TxRequest
- * @next Failure
- */
-message SimpleSignTx {
- repeated TxInputType inputs = 1; // transaction inputs
- repeated TxOutputType outputs = 2; // transaction outputs
- repeated TransactionType transactions = 3; // transactions whose outputs are used to build current inputs
- optional string coin_name = 4 [default='Bitcoin']; // coin to use
- optional uint32 version = 5 [default=1]; // transaction version
- optional uint32 lock_time = 6 [default=0]; // transaction lock_time
-}
-
-/**
- * Response: Device asks for information for signing transaction or returns the last result
- * If request_index is set, device awaits TxAck message (with fields filled in according to request_type)
- * If signature_index is set, 'signature' contains signed input of signature_index's input
- * @prev SignTx
- * @prev SimpleSignTx
- * @prev TxAck
- */
-message TxRequest {
- optional RequestType request_type = 1; // what should be filled in TxAck message?
- optional TxRequestDetailsType details = 2; // request for tx details
- optional TxRequestSerializedType serialized = 3; // serialized data and request for next
-}
-
-/**
- * Request: Reported transaction data
- * @prev TxRequest
- * @next TxRequest
- */
-message TxAck {
- optional TransactionType tx = 1;
-}
-
-/**
- * Request: Ask device to sign transaction
- * All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
- * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
- * @next PassphraseRequest
- * @next PinMatrixRequest
- * @next EthereumTxRequest
- * @next Failure
- */
-message EthereumSignTx {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- optional bytes nonce = 2; // <=256 bit unsigned big endian
- optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
- optional bytes gas_limit = 4; // <=256 bit unsigned big endian
- optional bytes to = 5; // 160 bit address hash
- optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
- optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
- optional uint32 data_length = 8; // Length of transaction payload
- optional uint32 chain_id = 9; // Chain Id for EIP 155
-}
-
-/**
- * Response: Device asks for more data from transaction payload, or returns the signature.
- * If data_length is set, device awaits that many more bytes of payload.
- * Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
- * @prev EthereumSignTx
- * @next EthereumTxAck
- */
-message EthereumTxRequest {
- optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
- optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
- optional bytes signature_r = 3; // Computed signature R component (256 bit)
- optional bytes signature_s = 4; // Computed signature S component (256 bit)
-}
-
-/**
- * Request: Transaction payload data.
- * @prev EthereumTxRequest
- * @next EthereumTxRequest
- */
-message EthereumTxAck {
- optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
-}
-
-////////////////////////////////////////
-// Ethereum: Message signing messages //
-////////////////////////////////////////
-
-/**
- * Request: Ask device to sign message
- * @next EthereumMessageSignature
- * @next Failure
- */
-message EthereumSignMessage {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- required bytes message = 2; // message to be signed
-}
-
-/**
- * Request: Ask device to verify message
- * @next Success
- * @next Failure
- */
-message EthereumVerifyMessage {
- optional bytes address = 1; // address to verify
- optional bytes signature = 2; // signature to verify
- optional bytes message = 3; // message to verify
-}
-
-/**
- * Response: Signed message
- * @prev EthereumSignMessage
- */
-message EthereumMessageSignature {
- optional bytes address = 1; // address used to sign the message
- optional bytes signature = 2; // signature of the message
-}
-
-///////////////////////
-// Identity messages //
-///////////////////////
-
-/**
- * Request: Ask device to sign identity
- * @next SignedIdentity
- * @next Failure
- */
-message SignIdentity {
- optional IdentityType identity = 1; // identity
- optional bytes challenge_hidden = 2; // non-visible challenge
- optional string challenge_visual = 3; // challenge shown on display (e.g. date+time)
- optional string ecdsa_curve_name = 4; // ECDSA curve name to use
-}
-
-/**
- * Response: Device provides signed identity
- * @prev SignIdentity
- */
-message SignedIdentity {
- optional string address = 1; // identity address
- optional bytes public_key = 2; // identity public key
- optional bytes signature = 3; // signature of the identity data
-}
-
-///////////////////
-// ECDH messages //
-///////////////////
-
-/**
- * Request: Ask device to generate ECDH session key
- * @next ECDHSessionKey
- * @next Failure
- */
-message GetECDHSessionKey {
- optional IdentityType identity = 1; // identity
- optional bytes peer_public_key = 2; // peer's public key
- optional string ecdsa_curve_name = 3; // ECDSA curve name to use
-}
-
-/**
- * Response: Device provides ECDH session key
- * @prev GetECDHSessionKey
- */
-message ECDHSessionKey {
- optional bytes session_key = 1; // ECDH session key
-}
-
-///////////////////
-// U2F messages //
-///////////////////
-
-/**
- * Request: Set U2F counter
- * @next Success
- */
-message SetU2FCounter {
- optional uint32 u2f_counter = 1; // counter
-}
-
-/////////////////////////
-// Bootloader messages //
-/////////////////////////
-
-/**
- * Request: Ask device to erase its firmware (so it can be replaced via FirmwareUpload)
- * @next Success
- * @next FirmwareRequest
- * @next Failure
- */
-message FirmwareErase {
- optional uint32 length = 1; // length of new firmware
-}
-
-/**
- * Response: Ask for firmware chunk
- * @next FirmwareUpload
- */
-message FirmwareRequest {
- optional uint32 offset = 1; // offset of requested firmware chunk
- optional uint32 length = 2; // length of requested firmware chunk
-}
-
-/**
- * Request: Send firmware in binary form to the device
- * @next Success
- * @next Failure
- */
-message FirmwareUpload {
- required bytes payload = 1; // firmware to be loaded into device
- optional bytes hash = 2; // hash of the payload
-}
-
-
-/**
- * Request: Perform a device self-test
- * @next Success
- * @next Failure
- */
-message SelfTest {
- optional bytes payload = 1; // payload to be used in self-test
-}
-
-/////////////////////////////////////////////////////////////
-// Debug messages (only available if DebugLink is enabled) //
-/////////////////////////////////////////////////////////////
-
-/**
- * Request: "Press" the button on the device
- * @next Success
- */
-message DebugLinkDecision {
- required bool yes_no = 1; // true for "Confirm", false for "Cancel"
-}
-
-/**
- * Request: Computer asks for device state
- * @next DebugLinkState
- */
-message DebugLinkGetState {
-}
-
-/**
- * Response: Device current state
- * @prev DebugLinkGetState
- */
-message DebugLinkState {
- optional bytes layout = 1; // raw buffer of display
- optional string pin = 2; // current PIN, blank if PIN is not set/enabled
- optional string matrix = 3; // current PIN matrix
- optional string mnemonic = 4; // current BIP-39 mnemonic
- optional HDNodeType node = 5; // current BIP-32 node
- optional bool passphrase_protection = 6; // is node/mnemonic encrypted using passphrase?
- optional string reset_word = 7; // word on device display during ResetDevice workflow
- optional bytes reset_entropy = 8; // current entropy during ResetDevice workflow
- optional string recovery_fake_word = 9; // (fake) word on display during RecoveryDevice workflow
- optional uint32 recovery_word_pos = 10; // index of mnemonic word the device is expecting during RecoveryDevice workflow
-}
-
-/**
- * Request: Ask device to restart
- */
-message DebugLinkStop {
-}
-
-/**
- * Response: Device wants host to log event
- */
-message DebugLinkLog {
- optional uint32 level = 1;
- optional string bucket = 2;
- optional string text = 3;
-}
-
-/**
- * Request: Read memory from device
- * @next DebugLinkMemory
- */
-message DebugLinkMemoryRead {
- optional uint32 address = 1;
- optional uint32 length = 2;
-}
-
-/**
- * Response: Device sends memory back
- * @prev DebugLinkMemoryRead
- */
-message DebugLinkMemory {
- optional bytes memory = 1;
-}
-
-/**
- * Request: Write memory to device.
- * WARNING: Writing to the wrong location can irreparably break the device.
- */
-message DebugLinkMemoryWrite {
- optional uint32 address = 1;
- optional bytes memory = 2;
- optional bool flash = 3;
-}
-
-/**
- * Request: Erase block of flash on device
- * WARNING: Writing to the wrong location can irreparably break the device.
- */
-message DebugLinkFlashErase {
- optional uint32 sector = 1;
-}
diff --git a/accounts/usbwallet/internal/trezor/trezor.go b/accounts/usbwallet/internal/trezor/trezor.go
deleted file mode 100644
index 80cc75efc4..0000000000
--- a/accounts/usbwallet/internal/trezor/trezor.go
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2017 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 .
-
-// This file contains the implementation for interacting with the Trezor hardware
-// wallets. The wire protocol spec can be found on the SatoshiLabs website:
-// https://doc.satoshilabs.com/trezor-tech/api-protobuf.html
-
-//go:generate protoc --go_out=import_path=trezor:. types.proto messages.proto
-
-// Package trezor contains the wire protocol wrapper in Go.
-package trezor
-
-import (
- "reflect"
-
- "github.com/golang/protobuf/proto"
-)
-
-// Type returns the protocol buffer type number of a specific message. If the
-// message is nil, this method panics!
-func Type(msg proto.Message) uint16 {
- return uint16(MessageType_value["MessageType_"+reflect.TypeOf(msg).Elem().Name()])
-}
-
-// Name returns the friendly message type name of a specific protocol buffer
-// type number.
-func Name(kind uint16) string {
- name := MessageType_name[int32(kind)]
- if len(name) < 12 {
- return name
- }
- return name[12:]
-}
diff --git a/accounts/usbwallet/internal/trezor/types.pb.go b/accounts/usbwallet/internal/trezor/types.pb.go
deleted file mode 100644
index 25b7672d23..0000000000
--- a/accounts/usbwallet/internal/trezor/types.pb.go
+++ /dev/null
@@ -1,1333 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// source: types.proto
-
-/*
-Package trezor is a generated protocol buffer package.
-
-It is generated from these files:
- types.proto
- messages.proto
-
-It has these top-level messages:
- HDNodeType
- HDNodePathType
- CoinType
- MultisigRedeemScriptType
- TxInputType
- TxOutputType
- TxOutputBinType
- TransactionType
- TxRequestDetailsType
- TxRequestSerializedType
- IdentityType
- Initialize
- GetFeatures
- Features
- ClearSession
- ApplySettings
- ApplyFlags
- ChangePin
- Ping
- Success
- Failure
- ButtonRequest
- ButtonAck
- PinMatrixRequest
- PinMatrixAck
- Cancel
- PassphraseRequest
- PassphraseAck
- GetEntropy
- Entropy
- GetPublicKey
- PublicKey
- GetAddress
- EthereumGetAddress
- Address
- EthereumAddress
- WipeDevice
- LoadDevice
- ResetDevice
- BackupDevice
- EntropyRequest
- EntropyAck
- RecoveryDevice
- WordRequest
- WordAck
- SignMessage
- VerifyMessage
- MessageSignature
- EncryptMessage
- EncryptedMessage
- DecryptMessage
- DecryptedMessage
- CipherKeyValue
- CipheredKeyValue
- EstimateTxSize
- TxSize
- SignTx
- SimpleSignTx
- TxRequest
- TxAck
- EthereumSignTx
- EthereumTxRequest
- EthereumTxAck
- EthereumSignMessage
- EthereumVerifyMessage
- EthereumMessageSignature
- SignIdentity
- SignedIdentity
- GetECDHSessionKey
- ECDHSessionKey
- SetU2FCounter
- FirmwareErase
- FirmwareRequest
- FirmwareUpload
- SelfTest
- DebugLinkDecision
- DebugLinkGetState
- DebugLinkState
- DebugLinkStop
- DebugLinkLog
- DebugLinkMemoryRead
- DebugLinkMemory
- DebugLinkMemoryWrite
- DebugLinkFlashErase
-*/
-package trezor
-
-import proto "github.com/golang/protobuf/proto"
-import fmt "fmt"
-import math "math"
-import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor"
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ = proto.Marshal
-var _ = fmt.Errorf
-var _ = math.Inf
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the proto package it is being compiled against.
-// A compilation error at this line likely means your copy of the
-// proto package needs to be updated.
-const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package
-
-// *
-// Type of failures returned by Failure message
-// @used_in Failure
-type FailureType int32
-
-const (
- FailureType_Failure_UnexpectedMessage FailureType = 1
- FailureType_Failure_ButtonExpected FailureType = 2
- FailureType_Failure_DataError FailureType = 3
- FailureType_Failure_ActionCancelled FailureType = 4
- FailureType_Failure_PinExpected FailureType = 5
- FailureType_Failure_PinCancelled FailureType = 6
- FailureType_Failure_PinInvalid FailureType = 7
- FailureType_Failure_InvalidSignature FailureType = 8
- FailureType_Failure_ProcessError FailureType = 9
- FailureType_Failure_NotEnoughFunds FailureType = 10
- FailureType_Failure_NotInitialized FailureType = 11
- FailureType_Failure_FirmwareError FailureType = 99
-)
-
-var FailureType_name = map[int32]string{
- 1: "Failure_UnexpectedMessage",
- 2: "Failure_ButtonExpected",
- 3: "Failure_DataError",
- 4: "Failure_ActionCancelled",
- 5: "Failure_PinExpected",
- 6: "Failure_PinCancelled",
- 7: "Failure_PinInvalid",
- 8: "Failure_InvalidSignature",
- 9: "Failure_ProcessError",
- 10: "Failure_NotEnoughFunds",
- 11: "Failure_NotInitialized",
- 99: "Failure_FirmwareError",
-}
-var FailureType_value = map[string]int32{
- "Failure_UnexpectedMessage": 1,
- "Failure_ButtonExpected": 2,
- "Failure_DataError": 3,
- "Failure_ActionCancelled": 4,
- "Failure_PinExpected": 5,
- "Failure_PinCancelled": 6,
- "Failure_PinInvalid": 7,
- "Failure_InvalidSignature": 8,
- "Failure_ProcessError": 9,
- "Failure_NotEnoughFunds": 10,
- "Failure_NotInitialized": 11,
- "Failure_FirmwareError": 99,
-}
-
-func (x FailureType) Enum() *FailureType {
- p := new(FailureType)
- *p = x
- return p
-}
-func (x FailureType) String() string {
- return proto.EnumName(FailureType_name, int32(x))
-}
-func (x *FailureType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(FailureType_value, data, "FailureType")
- if err != nil {
- return err
- }
- *x = FailureType(value)
- return nil
-}
-func (FailureType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
-
-// *
-// Type of script which will be used for transaction output
-// @used_in TxOutputType
-type OutputScriptType int32
-
-const (
- OutputScriptType_PAYTOADDRESS OutputScriptType = 0
- OutputScriptType_PAYTOSCRIPTHASH OutputScriptType = 1
- OutputScriptType_PAYTOMULTISIG OutputScriptType = 2
- OutputScriptType_PAYTOOPRETURN OutputScriptType = 3
- OutputScriptType_PAYTOWITNESS OutputScriptType = 4
- OutputScriptType_PAYTOP2SHWITNESS OutputScriptType = 5
-)
-
-var OutputScriptType_name = map[int32]string{
- 0: "PAYTOADDRESS",
- 1: "PAYTOSCRIPTHASH",
- 2: "PAYTOMULTISIG",
- 3: "PAYTOOPRETURN",
- 4: "PAYTOWITNESS",
- 5: "PAYTOP2SHWITNESS",
-}
-var OutputScriptType_value = map[string]int32{
- "PAYTOADDRESS": 0,
- "PAYTOSCRIPTHASH": 1,
- "PAYTOMULTISIG": 2,
- "PAYTOOPRETURN": 3,
- "PAYTOWITNESS": 4,
- "PAYTOP2SHWITNESS": 5,
-}
-
-func (x OutputScriptType) Enum() *OutputScriptType {
- p := new(OutputScriptType)
- *p = x
- return p
-}
-func (x OutputScriptType) String() string {
- return proto.EnumName(OutputScriptType_name, int32(x))
-}
-func (x *OutputScriptType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(OutputScriptType_value, data, "OutputScriptType")
- if err != nil {
- return err
- }
- *x = OutputScriptType(value)
- return nil
-}
-func (OutputScriptType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
-
-// *
-// Type of script which will be used for transaction output
-// @used_in TxInputType
-type InputScriptType int32
-
-const (
- InputScriptType_SPENDADDRESS InputScriptType = 0
- InputScriptType_SPENDMULTISIG InputScriptType = 1
- InputScriptType_EXTERNAL InputScriptType = 2
- InputScriptType_SPENDWITNESS InputScriptType = 3
- InputScriptType_SPENDP2SHWITNESS InputScriptType = 4
-)
-
-var InputScriptType_name = map[int32]string{
- 0: "SPENDADDRESS",
- 1: "SPENDMULTISIG",
- 2: "EXTERNAL",
- 3: "SPENDWITNESS",
- 4: "SPENDP2SHWITNESS",
-}
-var InputScriptType_value = map[string]int32{
- "SPENDADDRESS": 0,
- "SPENDMULTISIG": 1,
- "EXTERNAL": 2,
- "SPENDWITNESS": 3,
- "SPENDP2SHWITNESS": 4,
-}
-
-func (x InputScriptType) Enum() *InputScriptType {
- p := new(InputScriptType)
- *p = x
- return p
-}
-func (x InputScriptType) String() string {
- return proto.EnumName(InputScriptType_name, int32(x))
-}
-func (x *InputScriptType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(InputScriptType_value, data, "InputScriptType")
- if err != nil {
- return err
- }
- *x = InputScriptType(value)
- return nil
-}
-func (InputScriptType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
-
-// *
-// Type of information required by transaction signing process
-// @used_in TxRequest
-type RequestType int32
-
-const (
- RequestType_TXINPUT RequestType = 0
- RequestType_TXOUTPUT RequestType = 1
- RequestType_TXMETA RequestType = 2
- RequestType_TXFINISHED RequestType = 3
- RequestType_TXEXTRADATA RequestType = 4
-)
-
-var RequestType_name = map[int32]string{
- 0: "TXINPUT",
- 1: "TXOUTPUT",
- 2: "TXMETA",
- 3: "TXFINISHED",
- 4: "TXEXTRADATA",
-}
-var RequestType_value = map[string]int32{
- "TXINPUT": 0,
- "TXOUTPUT": 1,
- "TXMETA": 2,
- "TXFINISHED": 3,
- "TXEXTRADATA": 4,
-}
-
-func (x RequestType) Enum() *RequestType {
- p := new(RequestType)
- *p = x
- return p
-}
-func (x RequestType) String() string {
- return proto.EnumName(RequestType_name, int32(x))
-}
-func (x *RequestType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(RequestType_value, data, "RequestType")
- if err != nil {
- return err
- }
- *x = RequestType(value)
- return nil
-}
-func (RequestType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
-
-// *
-// Type of button request
-// @used_in ButtonRequest
-type ButtonRequestType int32
-
-const (
- ButtonRequestType_ButtonRequest_Other ButtonRequestType = 1
- ButtonRequestType_ButtonRequest_FeeOverThreshold ButtonRequestType = 2
- ButtonRequestType_ButtonRequest_ConfirmOutput ButtonRequestType = 3
- ButtonRequestType_ButtonRequest_ResetDevice ButtonRequestType = 4
- ButtonRequestType_ButtonRequest_ConfirmWord ButtonRequestType = 5
- ButtonRequestType_ButtonRequest_WipeDevice ButtonRequestType = 6
- ButtonRequestType_ButtonRequest_ProtectCall ButtonRequestType = 7
- ButtonRequestType_ButtonRequest_SignTx ButtonRequestType = 8
- ButtonRequestType_ButtonRequest_FirmwareCheck ButtonRequestType = 9
- ButtonRequestType_ButtonRequest_Address ButtonRequestType = 10
- ButtonRequestType_ButtonRequest_PublicKey ButtonRequestType = 11
-)
-
-var ButtonRequestType_name = map[int32]string{
- 1: "ButtonRequest_Other",
- 2: "ButtonRequest_FeeOverThreshold",
- 3: "ButtonRequest_ConfirmOutput",
- 4: "ButtonRequest_ResetDevice",
- 5: "ButtonRequest_ConfirmWord",
- 6: "ButtonRequest_WipeDevice",
- 7: "ButtonRequest_ProtectCall",
- 8: "ButtonRequest_SignTx",
- 9: "ButtonRequest_FirmwareCheck",
- 10: "ButtonRequest_Address",
- 11: "ButtonRequest_PublicKey",
-}
-var ButtonRequestType_value = map[string]int32{
- "ButtonRequest_Other": 1,
- "ButtonRequest_FeeOverThreshold": 2,
- "ButtonRequest_ConfirmOutput": 3,
- "ButtonRequest_ResetDevice": 4,
- "ButtonRequest_ConfirmWord": 5,
- "ButtonRequest_WipeDevice": 6,
- "ButtonRequest_ProtectCall": 7,
- "ButtonRequest_SignTx": 8,
- "ButtonRequest_FirmwareCheck": 9,
- "ButtonRequest_Address": 10,
- "ButtonRequest_PublicKey": 11,
-}
-
-func (x ButtonRequestType) Enum() *ButtonRequestType {
- p := new(ButtonRequestType)
- *p = x
- return p
-}
-func (x ButtonRequestType) String() string {
- return proto.EnumName(ButtonRequestType_name, int32(x))
-}
-func (x *ButtonRequestType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(ButtonRequestType_value, data, "ButtonRequestType")
- if err != nil {
- return err
- }
- *x = ButtonRequestType(value)
- return nil
-}
-func (ButtonRequestType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
-
-// *
-// Type of PIN request
-// @used_in PinMatrixRequest
-type PinMatrixRequestType int32
-
-const (
- PinMatrixRequestType_PinMatrixRequestType_Current PinMatrixRequestType = 1
- PinMatrixRequestType_PinMatrixRequestType_NewFirst PinMatrixRequestType = 2
- PinMatrixRequestType_PinMatrixRequestType_NewSecond PinMatrixRequestType = 3
-)
-
-var PinMatrixRequestType_name = map[int32]string{
- 1: "PinMatrixRequestType_Current",
- 2: "PinMatrixRequestType_NewFirst",
- 3: "PinMatrixRequestType_NewSecond",
-}
-var PinMatrixRequestType_value = map[string]int32{
- "PinMatrixRequestType_Current": 1,
- "PinMatrixRequestType_NewFirst": 2,
- "PinMatrixRequestType_NewSecond": 3,
-}
-
-func (x PinMatrixRequestType) Enum() *PinMatrixRequestType {
- p := new(PinMatrixRequestType)
- *p = x
- return p
-}
-func (x PinMatrixRequestType) String() string {
- return proto.EnumName(PinMatrixRequestType_name, int32(x))
-}
-func (x *PinMatrixRequestType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(PinMatrixRequestType_value, data, "PinMatrixRequestType")
- if err != nil {
- return err
- }
- *x = PinMatrixRequestType(value)
- return nil
-}
-func (PinMatrixRequestType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
-
-// *
-// Type of recovery procedure. These should be used as bitmask, e.g.,
-// `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
-// listing every method supported by the host computer.
-//
-// Note that ScrambledWords must be supported by every implementation
-// for backward compatibility; there is no way to not support it.
-//
-// @used_in RecoveryDevice
-type RecoveryDeviceType int32
-
-const (
- // use powers of two when extending this field
- RecoveryDeviceType_RecoveryDeviceType_ScrambledWords RecoveryDeviceType = 0
- RecoveryDeviceType_RecoveryDeviceType_Matrix RecoveryDeviceType = 1
-)
-
-var RecoveryDeviceType_name = map[int32]string{
- 0: "RecoveryDeviceType_ScrambledWords",
- 1: "RecoveryDeviceType_Matrix",
-}
-var RecoveryDeviceType_value = map[string]int32{
- "RecoveryDeviceType_ScrambledWords": 0,
- "RecoveryDeviceType_Matrix": 1,
-}
-
-func (x RecoveryDeviceType) Enum() *RecoveryDeviceType {
- p := new(RecoveryDeviceType)
- *p = x
- return p
-}
-func (x RecoveryDeviceType) String() string {
- return proto.EnumName(RecoveryDeviceType_name, int32(x))
-}
-func (x *RecoveryDeviceType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(RecoveryDeviceType_value, data, "RecoveryDeviceType")
- if err != nil {
- return err
- }
- *x = RecoveryDeviceType(value)
- return nil
-}
-func (RecoveryDeviceType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
-
-// *
-// Type of Recovery Word request
-// @used_in WordRequest
-type WordRequestType int32
-
-const (
- WordRequestType_WordRequestType_Plain WordRequestType = 0
- WordRequestType_WordRequestType_Matrix9 WordRequestType = 1
- WordRequestType_WordRequestType_Matrix6 WordRequestType = 2
-)
-
-var WordRequestType_name = map[int32]string{
- 0: "WordRequestType_Plain",
- 1: "WordRequestType_Matrix9",
- 2: "WordRequestType_Matrix6",
-}
-var WordRequestType_value = map[string]int32{
- "WordRequestType_Plain": 0,
- "WordRequestType_Matrix9": 1,
- "WordRequestType_Matrix6": 2,
-}
-
-func (x WordRequestType) Enum() *WordRequestType {
- p := new(WordRequestType)
- *p = x
- return p
-}
-func (x WordRequestType) String() string {
- return proto.EnumName(WordRequestType_name, int32(x))
-}
-func (x *WordRequestType) UnmarshalJSON(data []byte) error {
- value, err := proto.UnmarshalJSONEnum(WordRequestType_value, data, "WordRequestType")
- if err != nil {
- return err
- }
- *x = WordRequestType(value)
- return nil
-}
-func (WordRequestType) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
-
-// *
-// Structure representing BIP32 (hierarchical deterministic) node
-// Used for imports of private key into the device and exporting public key out of device
-// @used_in PublicKey
-// @used_in LoadDevice
-// @used_in DebugLinkState
-// @used_in Storage
-type HDNodeType struct {
- Depth *uint32 `protobuf:"varint,1,req,name=depth" json:"depth,omitempty"`
- Fingerprint *uint32 `protobuf:"varint,2,req,name=fingerprint" json:"fingerprint,omitempty"`
- ChildNum *uint32 `protobuf:"varint,3,req,name=child_num,json=childNum" json:"child_num,omitempty"`
- ChainCode []byte `protobuf:"bytes,4,req,name=chain_code,json=chainCode" json:"chain_code,omitempty"`
- PrivateKey []byte `protobuf:"bytes,5,opt,name=private_key,json=privateKey" json:"private_key,omitempty"`
- PublicKey []byte `protobuf:"bytes,6,opt,name=public_key,json=publicKey" json:"public_key,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *HDNodeType) Reset() { *m = HDNodeType{} }
-func (m *HDNodeType) String() string { return proto.CompactTextString(m) }
-func (*HDNodeType) ProtoMessage() {}
-func (*HDNodeType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
-
-func (m *HDNodeType) GetDepth() uint32 {
- if m != nil && m.Depth != nil {
- return *m.Depth
- }
- return 0
-}
-
-func (m *HDNodeType) GetFingerprint() uint32 {
- if m != nil && m.Fingerprint != nil {
- return *m.Fingerprint
- }
- return 0
-}
-
-func (m *HDNodeType) GetChildNum() uint32 {
- if m != nil && m.ChildNum != nil {
- return *m.ChildNum
- }
- return 0
-}
-
-func (m *HDNodeType) GetChainCode() []byte {
- if m != nil {
- return m.ChainCode
- }
- return nil
-}
-
-func (m *HDNodeType) GetPrivateKey() []byte {
- if m != nil {
- return m.PrivateKey
- }
- return nil
-}
-
-func (m *HDNodeType) GetPublicKey() []byte {
- if m != nil {
- return m.PublicKey
- }
- return nil
-}
-
-type HDNodePathType struct {
- Node *HDNodeType `protobuf:"bytes,1,req,name=node" json:"node,omitempty"`
- AddressN []uint32 `protobuf:"varint,2,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *HDNodePathType) Reset() { *m = HDNodePathType{} }
-func (m *HDNodePathType) String() string { return proto.CompactTextString(m) }
-func (*HDNodePathType) ProtoMessage() {}
-func (*HDNodePathType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
-
-func (m *HDNodePathType) GetNode() *HDNodeType {
- if m != nil {
- return m.Node
- }
- return nil
-}
-
-func (m *HDNodePathType) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-// *
-// Structure representing Coin
-// @used_in Features
-type CoinType struct {
- CoinName *string `protobuf:"bytes,1,opt,name=coin_name,json=coinName" json:"coin_name,omitempty"`
- CoinShortcut *string `protobuf:"bytes,2,opt,name=coin_shortcut,json=coinShortcut" json:"coin_shortcut,omitempty"`
- AddressType *uint32 `protobuf:"varint,3,opt,name=address_type,json=addressType,def=0" json:"address_type,omitempty"`
- MaxfeeKb *uint64 `protobuf:"varint,4,opt,name=maxfee_kb,json=maxfeeKb" json:"maxfee_kb,omitempty"`
- AddressTypeP2Sh *uint32 `protobuf:"varint,5,opt,name=address_type_p2sh,json=addressTypeP2sh,def=5" json:"address_type_p2sh,omitempty"`
- SignedMessageHeader *string `protobuf:"bytes,8,opt,name=signed_message_header,json=signedMessageHeader" json:"signed_message_header,omitempty"`
- XpubMagic *uint32 `protobuf:"varint,9,opt,name=xpub_magic,json=xpubMagic,def=76067358" json:"xpub_magic,omitempty"`
- XprvMagic *uint32 `protobuf:"varint,10,opt,name=xprv_magic,json=xprvMagic,def=76066276" json:"xprv_magic,omitempty"`
- Segwit *bool `protobuf:"varint,11,opt,name=segwit" json:"segwit,omitempty"`
- Forkid *uint32 `protobuf:"varint,12,opt,name=forkid" json:"forkid,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *CoinType) Reset() { *m = CoinType{} }
-func (m *CoinType) String() string { return proto.CompactTextString(m) }
-func (*CoinType) ProtoMessage() {}
-func (*CoinType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
-
-const Default_CoinType_AddressType uint32 = 0
-const Default_CoinType_AddressTypeP2Sh uint32 = 5
-const Default_CoinType_XpubMagic uint32 = 76067358
-const Default_CoinType_XprvMagic uint32 = 76066276
-
-func (m *CoinType) GetCoinName() string {
- if m != nil && m.CoinName != nil {
- return *m.CoinName
- }
- return ""
-}
-
-func (m *CoinType) GetCoinShortcut() string {
- if m != nil && m.CoinShortcut != nil {
- return *m.CoinShortcut
- }
- return ""
-}
-
-func (m *CoinType) GetAddressType() uint32 {
- if m != nil && m.AddressType != nil {
- return *m.AddressType
- }
- return Default_CoinType_AddressType
-}
-
-func (m *CoinType) GetMaxfeeKb() uint64 {
- if m != nil && m.MaxfeeKb != nil {
- return *m.MaxfeeKb
- }
- return 0
-}
-
-func (m *CoinType) GetAddressTypeP2Sh() uint32 {
- if m != nil && m.AddressTypeP2Sh != nil {
- return *m.AddressTypeP2Sh
- }
- return Default_CoinType_AddressTypeP2Sh
-}
-
-func (m *CoinType) GetSignedMessageHeader() string {
- if m != nil && m.SignedMessageHeader != nil {
- return *m.SignedMessageHeader
- }
- return ""
-}
-
-func (m *CoinType) GetXpubMagic() uint32 {
- if m != nil && m.XpubMagic != nil {
- return *m.XpubMagic
- }
- return Default_CoinType_XpubMagic
-}
-
-func (m *CoinType) GetXprvMagic() uint32 {
- if m != nil && m.XprvMagic != nil {
- return *m.XprvMagic
- }
- return Default_CoinType_XprvMagic
-}
-
-func (m *CoinType) GetSegwit() bool {
- if m != nil && m.Segwit != nil {
- return *m.Segwit
- }
- return false
-}
-
-func (m *CoinType) GetForkid() uint32 {
- if m != nil && m.Forkid != nil {
- return *m.Forkid
- }
- return 0
-}
-
-// *
-// Type of redeem script used in input
-// @used_in TxInputType
-type MultisigRedeemScriptType struct {
- Pubkeys []*HDNodePathType `protobuf:"bytes,1,rep,name=pubkeys" json:"pubkeys,omitempty"`
- Signatures [][]byte `protobuf:"bytes,2,rep,name=signatures" json:"signatures,omitempty"`
- M *uint32 `protobuf:"varint,3,opt,name=m" json:"m,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *MultisigRedeemScriptType) Reset() { *m = MultisigRedeemScriptType{} }
-func (m *MultisigRedeemScriptType) String() string { return proto.CompactTextString(m) }
-func (*MultisigRedeemScriptType) ProtoMessage() {}
-func (*MultisigRedeemScriptType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
-
-func (m *MultisigRedeemScriptType) GetPubkeys() []*HDNodePathType {
- if m != nil {
- return m.Pubkeys
- }
- return nil
-}
-
-func (m *MultisigRedeemScriptType) GetSignatures() [][]byte {
- if m != nil {
- return m.Signatures
- }
- return nil
-}
-
-func (m *MultisigRedeemScriptType) GetM() uint32 {
- if m != nil && m.M != nil {
- return *m.M
- }
- return 0
-}
-
-// *
-// Structure representing transaction input
-// @used_in SimpleSignTx
-// @used_in TransactionType
-type TxInputType struct {
- AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- PrevHash []byte `protobuf:"bytes,2,req,name=prev_hash,json=prevHash" json:"prev_hash,omitempty"`
- PrevIndex *uint32 `protobuf:"varint,3,req,name=prev_index,json=prevIndex" json:"prev_index,omitempty"`
- ScriptSig []byte `protobuf:"bytes,4,opt,name=script_sig,json=scriptSig" json:"script_sig,omitempty"`
- Sequence *uint32 `protobuf:"varint,5,opt,name=sequence,def=4294967295" json:"sequence,omitempty"`
- ScriptType *InputScriptType `protobuf:"varint,6,opt,name=script_type,json=scriptType,enum=InputScriptType,def=0" json:"script_type,omitempty"`
- Multisig *MultisigRedeemScriptType `protobuf:"bytes,7,opt,name=multisig" json:"multisig,omitempty"`
- Amount *uint64 `protobuf:"varint,8,opt,name=amount" json:"amount,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxInputType) Reset() { *m = TxInputType{} }
-func (m *TxInputType) String() string { return proto.CompactTextString(m) }
-func (*TxInputType) ProtoMessage() {}
-func (*TxInputType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
-
-const Default_TxInputType_Sequence uint32 = 4294967295
-const Default_TxInputType_ScriptType InputScriptType = InputScriptType_SPENDADDRESS
-
-func (m *TxInputType) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *TxInputType) GetPrevHash() []byte {
- if m != nil {
- return m.PrevHash
- }
- return nil
-}
-
-func (m *TxInputType) GetPrevIndex() uint32 {
- if m != nil && m.PrevIndex != nil {
- return *m.PrevIndex
- }
- return 0
-}
-
-func (m *TxInputType) GetScriptSig() []byte {
- if m != nil {
- return m.ScriptSig
- }
- return nil
-}
-
-func (m *TxInputType) GetSequence() uint32 {
- if m != nil && m.Sequence != nil {
- return *m.Sequence
- }
- return Default_TxInputType_Sequence
-}
-
-func (m *TxInputType) GetScriptType() InputScriptType {
- if m != nil && m.ScriptType != nil {
- return *m.ScriptType
- }
- return Default_TxInputType_ScriptType
-}
-
-func (m *TxInputType) GetMultisig() *MultisigRedeemScriptType {
- if m != nil {
- return m.Multisig
- }
- return nil
-}
-
-func (m *TxInputType) GetAmount() uint64 {
- if m != nil && m.Amount != nil {
- return *m.Amount
- }
- return 0
-}
-
-// *
-// Structure representing transaction output
-// @used_in SimpleSignTx
-// @used_in TransactionType
-type TxOutputType struct {
- Address *string `protobuf:"bytes,1,opt,name=address" json:"address,omitempty"`
- AddressN []uint32 `protobuf:"varint,2,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
- Amount *uint64 `protobuf:"varint,3,req,name=amount" json:"amount,omitempty"`
- ScriptType *OutputScriptType `protobuf:"varint,4,req,name=script_type,json=scriptType,enum=OutputScriptType" json:"script_type,omitempty"`
- Multisig *MultisigRedeemScriptType `protobuf:"bytes,5,opt,name=multisig" json:"multisig,omitempty"`
- OpReturnData []byte `protobuf:"bytes,6,opt,name=op_return_data,json=opReturnData" json:"op_return_data,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxOutputType) Reset() { *m = TxOutputType{} }
-func (m *TxOutputType) String() string { return proto.CompactTextString(m) }
-func (*TxOutputType) ProtoMessage() {}
-func (*TxOutputType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
-
-func (m *TxOutputType) GetAddress() string {
- if m != nil && m.Address != nil {
- return *m.Address
- }
- return ""
-}
-
-func (m *TxOutputType) GetAddressN() []uint32 {
- if m != nil {
- return m.AddressN
- }
- return nil
-}
-
-func (m *TxOutputType) GetAmount() uint64 {
- if m != nil && m.Amount != nil {
- return *m.Amount
- }
- return 0
-}
-
-func (m *TxOutputType) GetScriptType() OutputScriptType {
- if m != nil && m.ScriptType != nil {
- return *m.ScriptType
- }
- return OutputScriptType_PAYTOADDRESS
-}
-
-func (m *TxOutputType) GetMultisig() *MultisigRedeemScriptType {
- if m != nil {
- return m.Multisig
- }
- return nil
-}
-
-func (m *TxOutputType) GetOpReturnData() []byte {
- if m != nil {
- return m.OpReturnData
- }
- return nil
-}
-
-// *
-// Structure representing compiled transaction output
-// @used_in TransactionType
-type TxOutputBinType struct {
- Amount *uint64 `protobuf:"varint,1,req,name=amount" json:"amount,omitempty"`
- ScriptPubkey []byte `protobuf:"bytes,2,req,name=script_pubkey,json=scriptPubkey" json:"script_pubkey,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxOutputBinType) Reset() { *m = TxOutputBinType{} }
-func (m *TxOutputBinType) String() string { return proto.CompactTextString(m) }
-func (*TxOutputBinType) ProtoMessage() {}
-func (*TxOutputBinType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
-
-func (m *TxOutputBinType) GetAmount() uint64 {
- if m != nil && m.Amount != nil {
- return *m.Amount
- }
- return 0
-}
-
-func (m *TxOutputBinType) GetScriptPubkey() []byte {
- if m != nil {
- return m.ScriptPubkey
- }
- return nil
-}
-
-// *
-// Structure representing transaction
-// @used_in SimpleSignTx
-type TransactionType struct {
- Version *uint32 `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
- Inputs []*TxInputType `protobuf:"bytes,2,rep,name=inputs" json:"inputs,omitempty"`
- BinOutputs []*TxOutputBinType `protobuf:"bytes,3,rep,name=bin_outputs,json=binOutputs" json:"bin_outputs,omitempty"`
- Outputs []*TxOutputType `protobuf:"bytes,5,rep,name=outputs" json:"outputs,omitempty"`
- LockTime *uint32 `protobuf:"varint,4,opt,name=lock_time,json=lockTime" json:"lock_time,omitempty"`
- InputsCnt *uint32 `protobuf:"varint,6,opt,name=inputs_cnt,json=inputsCnt" json:"inputs_cnt,omitempty"`
- OutputsCnt *uint32 `protobuf:"varint,7,opt,name=outputs_cnt,json=outputsCnt" json:"outputs_cnt,omitempty"`
- ExtraData []byte `protobuf:"bytes,8,opt,name=extra_data,json=extraData" json:"extra_data,omitempty"`
- ExtraDataLen *uint32 `protobuf:"varint,9,opt,name=extra_data_len,json=extraDataLen" json:"extra_data_len,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TransactionType) Reset() { *m = TransactionType{} }
-func (m *TransactionType) String() string { return proto.CompactTextString(m) }
-func (*TransactionType) ProtoMessage() {}
-func (*TransactionType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
-
-func (m *TransactionType) GetVersion() uint32 {
- if m != nil && m.Version != nil {
- return *m.Version
- }
- return 0
-}
-
-func (m *TransactionType) GetInputs() []*TxInputType {
- if m != nil {
- return m.Inputs
- }
- return nil
-}
-
-func (m *TransactionType) GetBinOutputs() []*TxOutputBinType {
- if m != nil {
- return m.BinOutputs
- }
- return nil
-}
-
-func (m *TransactionType) GetOutputs() []*TxOutputType {
- if m != nil {
- return m.Outputs
- }
- return nil
-}
-
-func (m *TransactionType) GetLockTime() uint32 {
- if m != nil && m.LockTime != nil {
- return *m.LockTime
- }
- return 0
-}
-
-func (m *TransactionType) GetInputsCnt() uint32 {
- if m != nil && m.InputsCnt != nil {
- return *m.InputsCnt
- }
- return 0
-}
-
-func (m *TransactionType) GetOutputsCnt() uint32 {
- if m != nil && m.OutputsCnt != nil {
- return *m.OutputsCnt
- }
- return 0
-}
-
-func (m *TransactionType) GetExtraData() []byte {
- if m != nil {
- return m.ExtraData
- }
- return nil
-}
-
-func (m *TransactionType) GetExtraDataLen() uint32 {
- if m != nil && m.ExtraDataLen != nil {
- return *m.ExtraDataLen
- }
- return 0
-}
-
-// *
-// Structure representing request details
-// @used_in TxRequest
-type TxRequestDetailsType struct {
- RequestIndex *uint32 `protobuf:"varint,1,opt,name=request_index,json=requestIndex" json:"request_index,omitempty"`
- TxHash []byte `protobuf:"bytes,2,opt,name=tx_hash,json=txHash" json:"tx_hash,omitempty"`
- ExtraDataLen *uint32 `protobuf:"varint,3,opt,name=extra_data_len,json=extraDataLen" json:"extra_data_len,omitempty"`
- ExtraDataOffset *uint32 `protobuf:"varint,4,opt,name=extra_data_offset,json=extraDataOffset" json:"extra_data_offset,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxRequestDetailsType) Reset() { *m = TxRequestDetailsType{} }
-func (m *TxRequestDetailsType) String() string { return proto.CompactTextString(m) }
-func (*TxRequestDetailsType) ProtoMessage() {}
-func (*TxRequestDetailsType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
-
-func (m *TxRequestDetailsType) GetRequestIndex() uint32 {
- if m != nil && m.RequestIndex != nil {
- return *m.RequestIndex
- }
- return 0
-}
-
-func (m *TxRequestDetailsType) GetTxHash() []byte {
- if m != nil {
- return m.TxHash
- }
- return nil
-}
-
-func (m *TxRequestDetailsType) GetExtraDataLen() uint32 {
- if m != nil && m.ExtraDataLen != nil {
- return *m.ExtraDataLen
- }
- return 0
-}
-
-func (m *TxRequestDetailsType) GetExtraDataOffset() uint32 {
- if m != nil && m.ExtraDataOffset != nil {
- return *m.ExtraDataOffset
- }
- return 0
-}
-
-// *
-// Structure representing serialized data
-// @used_in TxRequest
-type TxRequestSerializedType struct {
- SignatureIndex *uint32 `protobuf:"varint,1,opt,name=signature_index,json=signatureIndex" json:"signature_index,omitempty"`
- Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
- SerializedTx []byte `protobuf:"bytes,3,opt,name=serialized_tx,json=serializedTx" json:"serialized_tx,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *TxRequestSerializedType) Reset() { *m = TxRequestSerializedType{} }
-func (m *TxRequestSerializedType) String() string { return proto.CompactTextString(m) }
-func (*TxRequestSerializedType) ProtoMessage() {}
-func (*TxRequestSerializedType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
-
-func (m *TxRequestSerializedType) GetSignatureIndex() uint32 {
- if m != nil && m.SignatureIndex != nil {
- return *m.SignatureIndex
- }
- return 0
-}
-
-func (m *TxRequestSerializedType) GetSignature() []byte {
- if m != nil {
- return m.Signature
- }
- return nil
-}
-
-func (m *TxRequestSerializedType) GetSerializedTx() []byte {
- if m != nil {
- return m.SerializedTx
- }
- return nil
-}
-
-// *
-// Structure representing identity data
-// @used_in IdentityType
-type IdentityType struct {
- Proto *string `protobuf:"bytes,1,opt,name=proto" json:"proto,omitempty"`
- User *string `protobuf:"bytes,2,opt,name=user" json:"user,omitempty"`
- Host *string `protobuf:"bytes,3,opt,name=host" json:"host,omitempty"`
- Port *string `protobuf:"bytes,4,opt,name=port" json:"port,omitempty"`
- Path *string `protobuf:"bytes,5,opt,name=path" json:"path,omitempty"`
- Index *uint32 `protobuf:"varint,6,opt,name=index,def=0" json:"index,omitempty"`
- XXX_unrecognized []byte `json:"-"`
-}
-
-func (m *IdentityType) Reset() { *m = IdentityType{} }
-func (m *IdentityType) String() string { return proto.CompactTextString(m) }
-func (*IdentityType) ProtoMessage() {}
-func (*IdentityType) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
-
-const Default_IdentityType_Index uint32 = 0
-
-func (m *IdentityType) GetProto() string {
- if m != nil && m.Proto != nil {
- return *m.Proto
- }
- return ""
-}
-
-func (m *IdentityType) GetUser() string {
- if m != nil && m.User != nil {
- return *m.User
- }
- return ""
-}
-
-func (m *IdentityType) GetHost() string {
- if m != nil && m.Host != nil {
- return *m.Host
- }
- return ""
-}
-
-func (m *IdentityType) GetPort() string {
- if m != nil && m.Port != nil {
- return *m.Port
- }
- return ""
-}
-
-func (m *IdentityType) GetPath() string {
- if m != nil && m.Path != nil {
- return *m.Path
- }
- return ""
-}
-
-func (m *IdentityType) GetIndex() uint32 {
- if m != nil && m.Index != nil {
- return *m.Index
- }
- return Default_IdentityType_Index
-}
-
-var E_WireIn = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50002,
- Name: "wire_in",
- Tag: "varint,50002,opt,name=wire_in,json=wireIn",
- Filename: "types.proto",
-}
-
-var E_WireOut = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50003,
- Name: "wire_out",
- Tag: "varint,50003,opt,name=wire_out,json=wireOut",
- Filename: "types.proto",
-}
-
-var E_WireDebugIn = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50004,
- Name: "wire_debug_in",
- Tag: "varint,50004,opt,name=wire_debug_in,json=wireDebugIn",
- Filename: "types.proto",
-}
-
-var E_WireDebugOut = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50005,
- Name: "wire_debug_out",
- Tag: "varint,50005,opt,name=wire_debug_out,json=wireDebugOut",
- Filename: "types.proto",
-}
-
-var E_WireTiny = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50006,
- Name: "wire_tiny",
- Tag: "varint,50006,opt,name=wire_tiny,json=wireTiny",
- Filename: "types.proto",
-}
-
-var E_WireBootloader = &proto.ExtensionDesc{
- ExtendedType: (*google_protobuf.EnumValueOptions)(nil),
- ExtensionType: (*bool)(nil),
- Field: 50007,
- Name: "wire_bootloader",
- Tag: "varint,50007,opt,name=wire_bootloader,json=wireBootloader",
- Filename: "types.proto",
-}
-
-func init() {
- proto.RegisterType((*HDNodeType)(nil), "HDNodeType")
- proto.RegisterType((*HDNodePathType)(nil), "HDNodePathType")
- proto.RegisterType((*CoinType)(nil), "CoinType")
- proto.RegisterType((*MultisigRedeemScriptType)(nil), "MultisigRedeemScriptType")
- proto.RegisterType((*TxInputType)(nil), "TxInputType")
- proto.RegisterType((*TxOutputType)(nil), "TxOutputType")
- proto.RegisterType((*TxOutputBinType)(nil), "TxOutputBinType")
- proto.RegisterType((*TransactionType)(nil), "TransactionType")
- proto.RegisterType((*TxRequestDetailsType)(nil), "TxRequestDetailsType")
- proto.RegisterType((*TxRequestSerializedType)(nil), "TxRequestSerializedType")
- proto.RegisterType((*IdentityType)(nil), "IdentityType")
- proto.RegisterEnum("FailureType", FailureType_name, FailureType_value)
- proto.RegisterEnum("OutputScriptType", OutputScriptType_name, OutputScriptType_value)
- proto.RegisterEnum("InputScriptType", InputScriptType_name, InputScriptType_value)
- proto.RegisterEnum("RequestType", RequestType_name, RequestType_value)
- proto.RegisterEnum("ButtonRequestType", ButtonRequestType_name, ButtonRequestType_value)
- proto.RegisterEnum("PinMatrixRequestType", PinMatrixRequestType_name, PinMatrixRequestType_value)
- proto.RegisterEnum("RecoveryDeviceType", RecoveryDeviceType_name, RecoveryDeviceType_value)
- proto.RegisterEnum("WordRequestType", WordRequestType_name, WordRequestType_value)
- proto.RegisterExtension(E_WireIn)
- proto.RegisterExtension(E_WireOut)
- proto.RegisterExtension(E_WireDebugIn)
- proto.RegisterExtension(E_WireDebugOut)
- proto.RegisterExtension(E_WireTiny)
- proto.RegisterExtension(E_WireBootloader)
-}
-
-func init() { proto.RegisterFile("types.proto", fileDescriptor0) }
-
-var fileDescriptor0 = []byte{
- // 1899 bytes of a gzipped FileDescriptorProto
- 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x57, 0xdb, 0x72, 0x1a, 0xc9,
- 0x19, 0xf6, 0x00, 0x92, 0xe0, 0x07, 0xc4, 0xa8, 0x7d, 0xd0, 0x78, 0x6d, 0xaf, 0x31, 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, 0xed, 0x77, 0x50, 0x53, 0x16, 0x06, 0x8c, 0x89, 0x98,
- 0xa9, 0x3f, 0x4f, 0xb7, 0xb0, 0xf3, 0x6f, 0x63, 0x47, 0x25, 0xb2, 0x3b, 0x53, 0xdd, 0xfd, 0x0a,
- 0x9e, 0x87, 0x6c, 0xdc, 0x4c, 0x02, 0xc1, 0x92, 0x11, 0x89, 0x83, 0x41, 0xd2, 0x14, 0x1c, 0x7f,
- 0xcb, 0x78, 0x33, 0x26, 0x83, 0x99, 0xbd, 0x5d, 0xf0, 0x14, 0x28, 0xdb, 0xfb, 0xff, 0x00, 0x00,
- 0x00, 0xff, 0xff, 0x70, 0x88, 0xcd, 0x71, 0xe2, 0x0f, 0x00, 0x00,
-}
diff --git a/accounts/usbwallet/internal/trezor/types.proto b/accounts/usbwallet/internal/trezor/types.proto
deleted file mode 100644
index acbe79e3ff..0000000000
--- a/accounts/usbwallet/internal/trezor/types.proto
+++ /dev/null
@@ -1,278 +0,0 @@
-// This file originates from the SatoshiLabs Trezor `common` repository at:
-// https://github.com/trezor/trezor-common/blob/master/protob/types.proto
-// dated 28.07.2017, commit dd8ec3231fb5f7992360aff9bdfe30bb58130f4b.
-
-syntax = "proto2";
-
-/**
- * Types for TREZOR communication
- *
- * @author Marek Palatinus
- * @version 1.2
- */
-
-// Sugar for easier handling in Java
-option java_package = "com.satoshilabs.trezor.lib.protobuf";
-option java_outer_classname = "TrezorType";
-
-import "google/protobuf/descriptor.proto";
-
-/**
- * Options for specifying message direction and type of wire (normal/debug)
- */
-extend google.protobuf.EnumValueOptions {
- optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR
- optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC
- optional bool wire_debug_in = 50004; // message can be transmitted via debug wire from PC to TREZOR
- optional bool wire_debug_out = 50005; // message can be transmitted via debug wire from TREZOR to PC
- optional bool wire_tiny = 50006; // message is handled by TREZOR when the USB stack is in tiny mode
- optional bool wire_bootloader = 50007; // message is only handled by TREZOR Bootloader
-}
-
-/**
- * Type of failures returned by Failure message
- * @used_in Failure
- */
-enum FailureType {
- Failure_UnexpectedMessage = 1;
- Failure_ButtonExpected = 2;
- Failure_DataError = 3;
- Failure_ActionCancelled = 4;
- Failure_PinExpected = 5;
- Failure_PinCancelled = 6;
- Failure_PinInvalid = 7;
- Failure_InvalidSignature = 8;
- Failure_ProcessError = 9;
- Failure_NotEnoughFunds = 10;
- Failure_NotInitialized = 11;
- Failure_FirmwareError = 99;
-}
-
-/**
- * Type of script which will be used for transaction output
- * @used_in TxOutputType
- */
-enum OutputScriptType {
- PAYTOADDRESS = 0; // used for all addresses (bitcoin, p2sh, witness)
- PAYTOSCRIPTHASH = 1; // p2sh address (deprecated; use PAYTOADDRESS)
- PAYTOMULTISIG = 2; // only for change output
- PAYTOOPRETURN = 3; // op_return
- PAYTOWITNESS = 4; // only for change output
- PAYTOP2SHWITNESS = 5; // only for change output
-}
-
-/**
- * Type of script which will be used for transaction output
- * @used_in TxInputType
- */
-enum InputScriptType {
- SPENDADDRESS = 0; // standard p2pkh address
- SPENDMULTISIG = 1; // p2sh multisig address
- EXTERNAL = 2; // reserved for external inputs (coinjoin)
- SPENDWITNESS = 3; // native segwit
- SPENDP2SHWITNESS = 4; // segwit over p2sh (backward compatible)
-}
-
-/**
- * Type of information required by transaction signing process
- * @used_in TxRequest
- */
-enum RequestType {
- TXINPUT = 0;
- TXOUTPUT = 1;
- TXMETA = 2;
- TXFINISHED = 3;
- TXEXTRADATA = 4;
-}
-
-/**
- * Type of button request
- * @used_in ButtonRequest
- */
-enum ButtonRequestType {
- ButtonRequest_Other = 1;
- ButtonRequest_FeeOverThreshold = 2;
- ButtonRequest_ConfirmOutput = 3;
- ButtonRequest_ResetDevice = 4;
- ButtonRequest_ConfirmWord = 5;
- ButtonRequest_WipeDevice = 6;
- ButtonRequest_ProtectCall = 7;
- ButtonRequest_SignTx = 8;
- ButtonRequest_FirmwareCheck = 9;
- ButtonRequest_Address = 10;
- ButtonRequest_PublicKey = 11;
-}
-
-/**
- * Type of PIN request
- * @used_in PinMatrixRequest
- */
-enum PinMatrixRequestType {
- PinMatrixRequestType_Current = 1;
- PinMatrixRequestType_NewFirst = 2;
- PinMatrixRequestType_NewSecond = 3;
-}
-
-/**
- * Type of recovery procedure. These should be used as bitmask, e.g.,
- * `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
- * listing every method supported by the host computer.
- *
- * Note that ScrambledWords must be supported by every implementation
- * for backward compatibility; there is no way to not support it.
- *
- * @used_in RecoveryDevice
- */
-enum RecoveryDeviceType {
- // use powers of two when extending this field
- RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order
- RecoveryDeviceType_Matrix = 1; // matrix recovery type
-}
-
-/**
- * Type of Recovery Word request
- * @used_in WordRequest
- */
-enum WordRequestType {
- WordRequestType_Plain = 0;
- WordRequestType_Matrix9 = 1;
- WordRequestType_Matrix6 = 2;
-}
-
-/**
- * Structure representing BIP32 (hierarchical deterministic) node
- * Used for imports of private key into the device and exporting public key out of device
- * @used_in PublicKey
- * @used_in LoadDevice
- * @used_in DebugLinkState
- * @used_in Storage
- */
-message HDNodeType {
- required uint32 depth = 1;
- required uint32 fingerprint = 2;
- required uint32 child_num = 3;
- required bytes chain_code = 4;
- optional bytes private_key = 5;
- optional bytes public_key = 6;
-}
-
-message HDNodePathType {
- required HDNodeType node = 1; // BIP-32 node in deserialized form
- repeated uint32 address_n = 2; // BIP-32 path to derive the key from node
-}
-
-/**
- * Structure representing Coin
- * @used_in Features
- */
-message CoinType {
- optional string coin_name = 1;
- optional string coin_shortcut = 2;
- optional uint32 address_type = 3 [default=0];
- optional uint64 maxfee_kb = 4;
- optional uint32 address_type_p2sh = 5 [default=5];
- optional string signed_message_header = 8;
- optional uint32 xpub_magic = 9 [default=76067358]; // default=0x0488b21e
- optional uint32 xprv_magic = 10 [default=76066276]; // default=0x0488ade4
- optional bool segwit = 11;
- optional uint32 forkid = 12;
-}
-
-/**
- * Type of redeem script used in input
- * @used_in TxInputType
- */
-message MultisigRedeemScriptType {
- repeated HDNodePathType pubkeys = 1; // pubkeys from multisig address (sorted lexicographically)
- repeated bytes signatures = 2; // existing signatures for partially signed input
- optional uint32 m = 3; // "m" from n, how many valid signatures is necessary for spending
-}
-
-/**
- * Structure representing transaction input
- * @used_in SimpleSignTx
- * @used_in TransactionType
- */
-message TxInputType {
- repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
- required bytes prev_hash = 2; // hash of previous transaction output to spend by this input
- required uint32 prev_index = 3; // index of previous output to spend
- optional bytes script_sig = 4; // script signature, unset for tx to sign
- optional uint32 sequence = 5 [default=4294967295]; // sequence (default=0xffffffff)
- optional InputScriptType script_type = 6 [default=SPENDADDRESS]; // defines template of input script
- optional MultisigRedeemScriptType multisig = 7; // Filled if input is going to spend multisig tx
- optional uint64 amount = 8; // amount of previous transaction output (for segwit only)
-}
-
-/**
- * Structure representing transaction output
- * @used_in SimpleSignTx
- * @used_in TransactionType
- */
-message TxOutputType {
- optional string address = 1; // target coin address in Base58 encoding
- repeated uint32 address_n = 2; // BIP-32 path to derive the key from master node; has higher priority than "address"
- required uint64 amount = 3; // amount to spend in satoshis
- required OutputScriptType script_type = 4; // output script type
- optional MultisigRedeemScriptType multisig = 5; // defines multisig address; script_type must be PAYTOMULTISIG
- optional bytes op_return_data = 6; // defines op_return data; script_type must be PAYTOOPRETURN, amount must be 0
-}
-
-/**
- * Structure representing compiled transaction output
- * @used_in TransactionType
- */
-message TxOutputBinType {
- required uint64 amount = 1;
- required bytes script_pubkey = 2;
-}
-
-/**
- * Structure representing transaction
- * @used_in SimpleSignTx
- */
-message TransactionType {
- optional uint32 version = 1;
- repeated TxInputType inputs = 2;
- repeated TxOutputBinType bin_outputs = 3;
- repeated TxOutputType outputs = 5;
- optional uint32 lock_time = 4;
- optional uint32 inputs_cnt = 6;
- optional uint32 outputs_cnt = 7;
- optional bytes extra_data = 8;
- optional uint32 extra_data_len = 9;
-}
-
-/**
- * Structure representing request details
- * @used_in TxRequest
- */
-message TxRequestDetailsType {
- optional uint32 request_index = 1; // device expects TxAck message from the computer
- optional bytes tx_hash = 2; // tx_hash of requested transaction
- optional uint32 extra_data_len = 3; // length of requested extra data
- optional uint32 extra_data_offset = 4; // offset of requested extra data
-}
-
-/**
- * Structure representing serialized data
- * @used_in TxRequest
- */
-message TxRequestSerializedType {
- optional uint32 signature_index = 1; // 'signature' field contains signed input of this index
- optional bytes signature = 2; // signature of the signature_index input
- optional bytes serialized_tx = 3; // part of serialized and signed transaction
-}
-
-/**
- * Structure representing identity data
- * @used_in IdentityType
- */
-message IdentityType {
- optional string proto = 1; // proto part of URI
- optional string user = 2; // user part of URI
- optional string host = 3; // host part of URI
- optional string port = 4; // port part of URI
- optional string path = 5; // path part of URI
- optional uint32 index = 6 [default=0]; // identity index
-}
diff --git a/accounts/usbwallet/ledger.go b/accounts/usbwallet/ledger.go
index d912ef36cf..10be882967 100644
--- a/accounts/usbwallet/ledger.go
+++ b/accounts/usbwallet/ledger.go
@@ -28,12 +28,11 @@ import (
"io"
"math/big"
- "github.com/PlatONnetwork/PlatON-Go/crypto"
-
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/common/hexutil"
"github.com/PlatONnetwork/PlatON-Go/core/types"
+ "github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/log"
"github.com/PlatONnetwork/PlatON-Go/rlp"
)
@@ -53,8 +52,10 @@ const (
ledgerOpRetrieveAddress ledgerOpcode = 0x02 // Returns the public key and Ethereum address for a given BIP 32 path
ledgerOpSignTransaction ledgerOpcode = 0x04 // Signs an Ethereum transaction after having the user validate the parameters
ledgerOpGetConfiguration ledgerOpcode = 0x06 // Returns specific wallet application configuration
+ ledgerOpSignTypedMessage ledgerOpcode = 0x0c // Signs an Ethereum message following the EIP 712 specification
ledgerP1DirectlyFetchAddress ledgerParam1 = 0x00 // Return address directly from the wallet
+ ledgerP1InitTypedMessageData ledgerParam1 = 0x00 // First chunk of Typed Message data
ledgerP1InitTransactionData ledgerParam1 = 0x00 // First transaction data block for signing
ledgerP1ContTransactionData ledgerParam1 = 0x80 // Subsequent transaction data block for signing
ledgerP2DiscardAddressChainCode ledgerParam2 = 0x00 // Do not return the chain code along with the address
@@ -163,7 +164,7 @@ func (w *ledgerDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
return common.Address{}, nil, accounts.ErrWalletClosed
}
// Ensure the wallet is capable of signing the given transaction
- if chainID != nil && w.version[0] <= 1 && w.version[2] <= 2 {
+ if chainID != nil && w.version[0] <= 1 && w.version[1] <= 0 && w.version[2] <= 2 {
//lint:ignore ST1005 brand name displayed on the console
return common.Address{}, nil, fmt.Errorf("Ledger v%d.%d.%d doesn't support signing this transaction, please update to v1.0.3 at least", w.version[0], w.version[1], w.version[2])
}
@@ -171,6 +172,24 @@ func (w *ledgerDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
return w.ledgerSign(path, tx, chainID)
}
+// SignTypedMessage implements usbwallet.driver, sending the message to the Ledger and
+// waiting for the user to sign or deny the transaction.
+//
+// Note: this was introduced in the ledger 1.5.0 firmware
+func (w *ledgerDriver) SignTypedMessage(path accounts.DerivationPath, domainHash []byte, messageHash []byte) ([]byte, error) {
+ // If the Ethereum app doesn't run, abort
+ if w.offline() {
+ return nil, accounts.ErrWalletClosed
+ }
+ // Ensure the wallet is capable of signing the given transaction
+ if w.version[0] < 1 && w.version[1] < 5 {
+ //lint:ignore ST1005 brand name displayed on the console
+ return nil, fmt.Errorf("Ledger version >= 1.5.0 required for EIP-712 signing (found version v%d.%d.%d)", w.version[0], w.version[1], w.version[2])
+ }
+ // All infos gathered and metadata checks out, request signing
+ return w.ledgerSignTypedMessage(path, domainHash, messageHash)
+}
+
// ledgerVersion retrieves the current version of the Ethereum wallet app running
// on the Ledger wallet.
//
@@ -223,7 +242,7 @@ func (w *ledgerDriver) ledgerVersion() ([3]byte, error) {
// Number of BIP 32 derivations to perform (max 10) | 1 byte
// First derivation index (big endian) | 4 bytes
// ... | 4 bytes
-// last derivation index (big endian) | 4 bytes
+// Last derivation index (big endian) | 4 bytes
//
// And the output data is:
//
@@ -260,7 +279,9 @@ func (w *ledgerDriver) ledgerDerive(derivationPath []uint32) (common.Address, er
// Decode the hex sting into an Ethereum address and return
var address common.Address
- hex.Decode(address[:], hexstr)
+ if _, err = hex.Decode(address[:], hexstr); err != nil {
+ return common.Address{}, err
+ }
return address, nil
}
@@ -282,7 +303,7 @@ func (w *ledgerDriver) ledgerDerive(derivationPath []uint32) (common.Address, er
// Number of BIP 32 derivations to perform (max 10) | 1 byte
// First derivation index (big endian) | 4 bytes
// ... | 4 bytes
-// last derivation index (big endian) | 4 bytes
+// Last derivation index (big endian) | 4 bytes
// RLP transaction chunk | arbitrary
//
// And the input for subsequent transaction blocks (first 255 bytes) are:
@@ -349,9 +370,12 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
// Create the correct signer and signature transform based on the chain ID
var signer types.Signer
- signer = types.NewEIP155Signer(chainID)
- signature[64] = signature[64] - byte(chainID.Uint64()*2+35)
-
+ if chainID == nil {
+ signer = new(types.HomesteadSigner)
+ } else {
+ signer = types.NewEIP155Signer(chainID)
+ signature[64] -= byte(chainID.Uint64()*2 + 35)
+ }
signed, err := tx.WithSignature(signer, signature)
if err != nil {
return common.Address{}, nil, err
@@ -363,6 +387,66 @@ func (w *ledgerDriver) ledgerSign(derivationPath []uint32, tx *types.Transaction
return sender, signed, nil
}
+// ledgerSignTypedMessage sends the transaction to the Ledger wallet, and waits for the user
+// to confirm or deny the transaction.
+//
+// The signing protocol is defined as follows:
+//
+// CLA | INS | P1 | P2 | Lc | Le
+// ----+-----+----+-----------------------------+-----+---
+// E0 | 0C | 00 | implementation version : 00 | variable | variable
+//
+// Where the input is:
+//
+// Description | Length
+// -------------------------------------------------+----------
+// Number of BIP 32 derivations to perform (max 10) | 1 byte
+// First derivation index (big endian) | 4 bytes
+// ... | 4 bytes
+// Last derivation index (big endian) | 4 bytes
+// domain hash | 32 bytes
+// message hash | 32 bytes
+//
+// And the output data is:
+//
+// Description | Length
+// ------------+---------
+// signature V | 1 byte
+// signature R | 32 bytes
+// signature S | 32 bytes
+func (w *ledgerDriver) ledgerSignTypedMessage(derivationPath []uint32, domainHash []byte, messageHash []byte) ([]byte, error) {
+ // Flatten the derivation path into the Ledger request
+ path := make([]byte, 1+4*len(derivationPath))
+ path[0] = byte(len(derivationPath))
+ for i, component := range derivationPath {
+ binary.BigEndian.PutUint32(path[1+4*i:], component)
+ }
+ // Create the 712 message
+ payload := append(path, domainHash...)
+ payload = append(payload, messageHash...)
+
+ // Send the request and wait for the response
+ var (
+ op = ledgerP1InitTypedMessageData
+ reply []byte
+ err error
+ )
+
+ // Send the message over, ensuring it's processed correctly
+ reply, err = w.ledgerExchange(ledgerOpSignTypedMessage, op, 0, payload)
+
+ if err != nil {
+ return nil, err
+ }
+
+ // Extract the Ethereum signature and do a sanity validation
+ if len(reply) != crypto.SignatureLength {
+ return nil, errors.New("reply lacks signature")
+ }
+ signature := append(reply[1:], reply[0])
+ return signature, nil
+}
+
// ledgerExchange performs a data exchange with the Ledger wallet, sending it a
// message and retrieving the response.
//
diff --git a/accounts/usbwallet/trezor.go b/accounts/usbwallet/trezor.go
index daa751f0fe..4aa91472a6 100644
--- a/accounts/usbwallet/trezor.go
+++ b/accounts/usbwallet/trezor.go
@@ -28,7 +28,7 @@ import (
"math/big"
"github.com/PlatONnetwork/PlatON-Go/accounts"
- "github.com/PlatONnetwork/PlatON-Go/accounts/usbwallet/internal/trezor"
+ "github.com/PlatONnetwork/PlatON-Go/accounts/usbwallet/trezor"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/common/hexutil"
"github.com/PlatONnetwork/PlatON-Go/core/types"
@@ -41,6 +41,9 @@ import (
// encoded passphrase.
var ErrTrezorPINNeeded = errors.New("trezor: pin needed")
+// ErrTrezorPassphraseNeeded is returned if opening the trezor requires a passphrase
+var ErrTrezorPassphraseNeeded = errors.New("trezor: passphrase needed")
+
// errTrezorReplyInvalidHeader is the error message returned by a Trezor data exchange
// if the device replies with a mismatching header. This usually means the device
// is in browser mode.
@@ -48,12 +51,13 @@ var errTrezorReplyInvalidHeader = errors.New("trezor: invalid reply header")
// trezorDriver implements the communication with a Trezor hardware wallet.
type trezorDriver struct {
- device io.ReadWriter // USB device connection to communicate through
- version [3]uint32 // Current version of the Trezor firmware
- label string // Current textual label of the Trezor device
- pinwait bool // Flags whether the device is waiting for PIN entry
- failure error // Any failure that would make the device unusable
- log log.Logger // Contextual logger to tag the trezor with its id
+ device io.ReadWriter // USB device connection to communicate through
+ version [3]uint32 // Current version of the Trezor firmware
+ label string // Current textual label of the Trezor device
+ pinwait bool // Flags whether the device is waiting for PIN entry
+ passphrasewait bool // Flags whether the device is waiting for passphrase entry
+ failure error // Any failure that would make the device unusable
+ log log.Logger // Contextual logger to tag the trezor with its id
}
// newTrezorDriver creates a new instance of a Trezor USB protocol driver.
@@ -79,19 +83,21 @@ func (w *trezorDriver) Status() (string, error) {
}
// Open implements usbwallet.driver, attempting to initialize the connection to
-// the Trezor hardware wallet. Initializing the Trezor is a two phase operation:
-// * The first phase is to initialize the connection and read the wallet's
-// features. This phase is invoked is the provided passphrase is empty. The
-// device will display the pinpad as a result and will return an appropriate
-// error to notify the user that a second open phase is needed.
-// * The second phase is to unlock access to the Trezor, which is done by the
-// user actually providing a passphrase mapping a keyboard keypad to the pin
-// number of the user (shuffled according to the pinpad displayed).
+// the Trezor hardware wallet. Initializing the Trezor is a two or three phase operation:
+// - The first phase is to initialize the connection and read the wallet's
+// features. This phase is invoked if the provided passphrase is empty. The
+// device will display the pinpad as a result and will return an appropriate
+// error to notify the user that a second open phase is needed.
+// - The second phase is to unlock access to the Trezor, which is done by the
+// user actually providing a passphrase mapping a keyboard keypad to the pin
+// number of the user (shuffled according to the pinpad displayed).
+// - If needed the device will ask for passphrase which will require calling
+// open again with the actual passphrase (3rd phase)
func (w *trezorDriver) Open(device io.ReadWriter, passphrase string) error {
w.device, w.failure = device, nil
// If phase 1 is requested, init the connection and wait for user callback
- if passphrase == "" {
+ if passphrase == "" && !w.passphrasewait {
// If we're already waiting for a PIN entry, insta-return
if w.pinwait {
return ErrTrezorPINNeeded
@@ -104,26 +110,46 @@ func (w *trezorDriver) Open(device io.ReadWriter, passphrase string) error {
w.version = [3]uint32{features.GetMajorVersion(), features.GetMinorVersion(), features.GetPatchVersion()}
w.label = features.GetLabel()
- // Do a manual ping, forcing the device to ask for its PIN
+ // Do a manual ping, forcing the device to ask for its PIN and Passphrase
askPin := true
- res, err := w.trezorExchange(&trezor.Ping{PinProtection: &askPin}, new(trezor.PinMatrixRequest), new(trezor.Success))
+ askPassphrase := true
+ res, err := w.trezorExchange(&trezor.Ping{PinProtection: &askPin, PassphraseProtection: &askPassphrase}, new(trezor.PinMatrixRequest), new(trezor.PassphraseRequest), new(trezor.Success))
if err != nil {
return err
}
// Only return the PIN request if the device wasn't unlocked until now
- if res == 1 {
- return nil // Device responded with trezor.Success
+ switch res {
+ case 0:
+ w.pinwait = true
+ return ErrTrezorPINNeeded
+ case 1:
+ w.pinwait = false
+ w.passphrasewait = true
+ return ErrTrezorPassphraseNeeded
+ case 2:
+ return nil // responded with trezor.Success
}
- w.pinwait = true
- return ErrTrezorPINNeeded
}
// Phase 2 requested with actual PIN entry
- w.pinwait = false
-
- if _, err := w.trezorExchange(&trezor.PinMatrixAck{Pin: &passphrase}, new(trezor.Success)); err != nil {
- w.failure = err
- return err
+ if w.pinwait {
+ w.pinwait = false
+ res, err := w.trezorExchange(&trezor.PinMatrixAck{Pin: &passphrase}, new(trezor.Success), new(trezor.PassphraseRequest))
+ if err != nil {
+ w.failure = err
+ return err
+ }
+ if res == 1 {
+ w.passphrasewait = true
+ return ErrTrezorPassphraseNeeded
+ }
+ } else if w.passphrasewait {
+ w.passphrasewait = false
+ if _, err := w.trezorExchange(&trezor.PassphraseAck{Passphrase: &passphrase}, new(trezor.Success)); err != nil {
+ w.failure = err
+ return err
+ }
}
+
return nil
}
@@ -159,6 +185,10 @@ func (w *trezorDriver) SignTx(path accounts.DerivationPath, tx *types.Transactio
return w.trezorSign(path, tx, chainID)
}
+func (w *trezorDriver) SignTypedMessage(path accounts.DerivationPath, domainHash []byte, messageHash []byte) ([]byte, error) {
+ return nil, accounts.ErrNotSupported
+}
+
// trezorDerive sends a derivation request to the Trezor device and returns the
// Ethereum address located on that path.
func (w *trezorDriver) trezorDerive(derivationPath []uint32) (common.Address, error) {
@@ -166,7 +196,13 @@ func (w *trezorDriver) trezorDerive(derivationPath []uint32) (common.Address, er
if _, err := w.trezorExchange(&trezor.EthereumGetAddress{AddressN: derivationPath}, address); err != nil {
return common.Address{}, err
}
- return common.BytesToAddress(address.GetAddress()), nil
+ if addr := address.GetAddressBin(); len(addr) > 0 { // Older firmwares use binary fomats
+ return common.BytesToAddress(addr), nil
+ }
+ if addr := address.GetAddressHex(); len(addr) > 0 { // Newer firmwares use hexadecimal fomats
+ return common.HexToAddress(addr), nil
+ }
+ return common.Address{}, errors.New("missing derived address")
}
// trezorSign sends the transaction to the Trezor wallet, and waits for the user
@@ -185,7 +221,10 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
DataLength: &length,
}
if to := tx.To(); to != nil {
- request.To = (*to)[:] // Non contract deploy, set recipient explicitly
+ // Non contract deploy, set recipient explicitly
+ hex := to.Hex()
+ request.ToHex = &hex // Newer firmwares (old will ignore)
+ request.ToBin = (*to)[:] // Older firmwares (new will ignore)
}
if length > 1024 { // Send the data chunked if that was requested
request.DataInitialChunk, data = data[:1024], data[1024:]
@@ -217,8 +256,14 @@ func (w *trezorDriver) trezorSign(derivationPath []uint32, tx *types.Transaction
// Create the correct signer and signature transform based on the chain ID
var signer types.Signer
- signer = types.NewEIP155Signer(chainID)
- signature[64] = signature[64] - byte(chainID.Uint64()*2+35)
+ if chainID == nil {
+ signer = new(types.HomesteadSigner)
+ } else {
+ // Trezor backend does not support typed transactions yet.
+ signer = types.NewEIP155Signer(chainID)
+ signature[64] -= byte(chainID.Uint64()*2 + 35)
+ }
+
// Inject the final signature into the transaction and sanity check the sender
signed, err := tx.WithSignature(signer, signature)
if err != nil {
diff --git a/accounts/usbwallet/trezor/messages-common.pb.go b/accounts/usbwallet/trezor/messages-common.pb.go
new file mode 100644
index 0000000000..304bec0e36
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-common.pb.go
@@ -0,0 +1,811 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: messages-common.proto
+
+package trezor
+
+import (
+ fmt "fmt"
+ math "math"
+
+ proto "github.com/golang/protobuf/proto"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+type Failure_FailureType int32
+
+const (
+ Failure_Failure_UnexpectedMessage Failure_FailureType = 1
+ Failure_Failure_ButtonExpected Failure_FailureType = 2
+ Failure_Failure_DataError Failure_FailureType = 3
+ Failure_Failure_ActionCancelled Failure_FailureType = 4
+ Failure_Failure_PinExpected Failure_FailureType = 5
+ Failure_Failure_PinCancelled Failure_FailureType = 6
+ Failure_Failure_PinInvalid Failure_FailureType = 7
+ Failure_Failure_InvalidSignature Failure_FailureType = 8
+ Failure_Failure_ProcessError Failure_FailureType = 9
+ Failure_Failure_NotEnoughFunds Failure_FailureType = 10
+ Failure_Failure_NotInitialized Failure_FailureType = 11
+ Failure_Failure_PinMismatch Failure_FailureType = 12
+ Failure_Failure_FirmwareError Failure_FailureType = 99
+)
+
+var Failure_FailureType_name = map[int32]string{
+ 1: "Failure_UnexpectedMessage",
+ 2: "Failure_ButtonExpected",
+ 3: "Failure_DataError",
+ 4: "Failure_ActionCancelled",
+ 5: "Failure_PinExpected",
+ 6: "Failure_PinCancelled",
+ 7: "Failure_PinInvalid",
+ 8: "Failure_InvalidSignature",
+ 9: "Failure_ProcessError",
+ 10: "Failure_NotEnoughFunds",
+ 11: "Failure_NotInitialized",
+ 12: "Failure_PinMismatch",
+ 99: "Failure_FirmwareError",
+}
+
+var Failure_FailureType_value = map[string]int32{
+ "Failure_UnexpectedMessage": 1,
+ "Failure_ButtonExpected": 2,
+ "Failure_DataError": 3,
+ "Failure_ActionCancelled": 4,
+ "Failure_PinExpected": 5,
+ "Failure_PinCancelled": 6,
+ "Failure_PinInvalid": 7,
+ "Failure_InvalidSignature": 8,
+ "Failure_ProcessError": 9,
+ "Failure_NotEnoughFunds": 10,
+ "Failure_NotInitialized": 11,
+ "Failure_PinMismatch": 12,
+ "Failure_FirmwareError": 99,
+}
+
+func (x Failure_FailureType) Enum() *Failure_FailureType {
+ p := new(Failure_FailureType)
+ *p = x
+ return p
+}
+
+func (x Failure_FailureType) String() string {
+ return proto.EnumName(Failure_FailureType_name, int32(x))
+}
+
+func (x *Failure_FailureType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(Failure_FailureType_value, data, "Failure_FailureType")
+ if err != nil {
+ return err
+ }
+ *x = Failure_FailureType(value)
+ return nil
+}
+
+func (Failure_FailureType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{1, 0}
+}
+
+//*
+// Type of button request
+type ButtonRequest_ButtonRequestType int32
+
+const (
+ ButtonRequest_ButtonRequest_Other ButtonRequest_ButtonRequestType = 1
+ ButtonRequest_ButtonRequest_FeeOverThreshold ButtonRequest_ButtonRequestType = 2
+ ButtonRequest_ButtonRequest_ConfirmOutput ButtonRequest_ButtonRequestType = 3
+ ButtonRequest_ButtonRequest_ResetDevice ButtonRequest_ButtonRequestType = 4
+ ButtonRequest_ButtonRequest_ConfirmWord ButtonRequest_ButtonRequestType = 5
+ ButtonRequest_ButtonRequest_WipeDevice ButtonRequest_ButtonRequestType = 6
+ ButtonRequest_ButtonRequest_ProtectCall ButtonRequest_ButtonRequestType = 7
+ ButtonRequest_ButtonRequest_SignTx ButtonRequest_ButtonRequestType = 8
+ ButtonRequest_ButtonRequest_FirmwareCheck ButtonRequest_ButtonRequestType = 9
+ ButtonRequest_ButtonRequest_Address ButtonRequest_ButtonRequestType = 10
+ ButtonRequest_ButtonRequest_PublicKey ButtonRequest_ButtonRequestType = 11
+ ButtonRequest_ButtonRequest_MnemonicWordCount ButtonRequest_ButtonRequestType = 12
+ ButtonRequest_ButtonRequest_MnemonicInput ButtonRequest_ButtonRequestType = 13
+ ButtonRequest_ButtonRequest_PassphraseType ButtonRequest_ButtonRequestType = 14
+ ButtonRequest_ButtonRequest_UnknownDerivationPath ButtonRequest_ButtonRequestType = 15
+)
+
+var ButtonRequest_ButtonRequestType_name = map[int32]string{
+ 1: "ButtonRequest_Other",
+ 2: "ButtonRequest_FeeOverThreshold",
+ 3: "ButtonRequest_ConfirmOutput",
+ 4: "ButtonRequest_ResetDevice",
+ 5: "ButtonRequest_ConfirmWord",
+ 6: "ButtonRequest_WipeDevice",
+ 7: "ButtonRequest_ProtectCall",
+ 8: "ButtonRequest_SignTx",
+ 9: "ButtonRequest_FirmwareCheck",
+ 10: "ButtonRequest_Address",
+ 11: "ButtonRequest_PublicKey",
+ 12: "ButtonRequest_MnemonicWordCount",
+ 13: "ButtonRequest_MnemonicInput",
+ 14: "ButtonRequest_PassphraseType",
+ 15: "ButtonRequest_UnknownDerivationPath",
+}
+
+var ButtonRequest_ButtonRequestType_value = map[string]int32{
+ "ButtonRequest_Other": 1,
+ "ButtonRequest_FeeOverThreshold": 2,
+ "ButtonRequest_ConfirmOutput": 3,
+ "ButtonRequest_ResetDevice": 4,
+ "ButtonRequest_ConfirmWord": 5,
+ "ButtonRequest_WipeDevice": 6,
+ "ButtonRequest_ProtectCall": 7,
+ "ButtonRequest_SignTx": 8,
+ "ButtonRequest_FirmwareCheck": 9,
+ "ButtonRequest_Address": 10,
+ "ButtonRequest_PublicKey": 11,
+ "ButtonRequest_MnemonicWordCount": 12,
+ "ButtonRequest_MnemonicInput": 13,
+ "ButtonRequest_PassphraseType": 14,
+ "ButtonRequest_UnknownDerivationPath": 15,
+}
+
+func (x ButtonRequest_ButtonRequestType) Enum() *ButtonRequest_ButtonRequestType {
+ p := new(ButtonRequest_ButtonRequestType)
+ *p = x
+ return p
+}
+
+func (x ButtonRequest_ButtonRequestType) String() string {
+ return proto.EnumName(ButtonRequest_ButtonRequestType_name, int32(x))
+}
+
+func (x *ButtonRequest_ButtonRequestType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(ButtonRequest_ButtonRequestType_value, data, "ButtonRequest_ButtonRequestType")
+ if err != nil {
+ return err
+ }
+ *x = ButtonRequest_ButtonRequestType(value)
+ return nil
+}
+
+func (ButtonRequest_ButtonRequestType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{2, 0}
+}
+
+//*
+// Type of PIN request
+type PinMatrixRequest_PinMatrixRequestType int32
+
+const (
+ PinMatrixRequest_PinMatrixRequestType_Current PinMatrixRequest_PinMatrixRequestType = 1
+ PinMatrixRequest_PinMatrixRequestType_NewFirst PinMatrixRequest_PinMatrixRequestType = 2
+ PinMatrixRequest_PinMatrixRequestType_NewSecond PinMatrixRequest_PinMatrixRequestType = 3
+)
+
+var PinMatrixRequest_PinMatrixRequestType_name = map[int32]string{
+ 1: "PinMatrixRequestType_Current",
+ 2: "PinMatrixRequestType_NewFirst",
+ 3: "PinMatrixRequestType_NewSecond",
+}
+
+var PinMatrixRequest_PinMatrixRequestType_value = map[string]int32{
+ "PinMatrixRequestType_Current": 1,
+ "PinMatrixRequestType_NewFirst": 2,
+ "PinMatrixRequestType_NewSecond": 3,
+}
+
+func (x PinMatrixRequest_PinMatrixRequestType) Enum() *PinMatrixRequest_PinMatrixRequestType {
+ p := new(PinMatrixRequest_PinMatrixRequestType)
+ *p = x
+ return p
+}
+
+func (x PinMatrixRequest_PinMatrixRequestType) String() string {
+ return proto.EnumName(PinMatrixRequest_PinMatrixRequestType_name, int32(x))
+}
+
+func (x *PinMatrixRequest_PinMatrixRequestType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(PinMatrixRequest_PinMatrixRequestType_value, data, "PinMatrixRequest_PinMatrixRequestType")
+ if err != nil {
+ return err
+ }
+ *x = PinMatrixRequest_PinMatrixRequestType(value)
+ return nil
+}
+
+func (PinMatrixRequest_PinMatrixRequestType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{4, 0}
+}
+
+//*
+// Response: Success of the previous request
+// @end
+type Success struct {
+ Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Success) Reset() { *m = Success{} }
+func (m *Success) String() string { return proto.CompactTextString(m) }
+func (*Success) ProtoMessage() {}
+func (*Success) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{0}
+}
+
+func (m *Success) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Success.Unmarshal(m, b)
+}
+func (m *Success) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Success.Marshal(b, m, deterministic)
+}
+func (m *Success) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Success.Merge(m, src)
+}
+func (m *Success) XXX_Size() int {
+ return xxx_messageInfo_Success.Size(m)
+}
+func (m *Success) XXX_DiscardUnknown() {
+ xxx_messageInfo_Success.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Success proto.InternalMessageInfo
+
+func (m *Success) GetMessage() string {
+ if m != nil && m.Message != nil {
+ return *m.Message
+ }
+ return ""
+}
+
+//*
+// Response: Failure of the previous request
+// @end
+type Failure struct {
+ Code *Failure_FailureType `protobuf:"varint,1,opt,name=code,enum=hw.trezor.messages.common.Failure_FailureType" json:"code,omitempty"`
+ Message *string `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Failure) Reset() { *m = Failure{} }
+func (m *Failure) String() string { return proto.CompactTextString(m) }
+func (*Failure) ProtoMessage() {}
+func (*Failure) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{1}
+}
+
+func (m *Failure) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Failure.Unmarshal(m, b)
+}
+func (m *Failure) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Failure.Marshal(b, m, deterministic)
+}
+func (m *Failure) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Failure.Merge(m, src)
+}
+func (m *Failure) XXX_Size() int {
+ return xxx_messageInfo_Failure.Size(m)
+}
+func (m *Failure) XXX_DiscardUnknown() {
+ xxx_messageInfo_Failure.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Failure proto.InternalMessageInfo
+
+func (m *Failure) GetCode() Failure_FailureType {
+ if m != nil && m.Code != nil {
+ return *m.Code
+ }
+ return Failure_Failure_UnexpectedMessage
+}
+
+func (m *Failure) GetMessage() string {
+ if m != nil && m.Message != nil {
+ return *m.Message
+ }
+ return ""
+}
+
+//*
+// Response: Device is waiting for HW button press.
+// @auxstart
+// @next ButtonAck
+type ButtonRequest struct {
+ Code *ButtonRequest_ButtonRequestType `protobuf:"varint,1,opt,name=code,enum=hw.trezor.messages.common.ButtonRequest_ButtonRequestType" json:"code,omitempty"`
+ Data *string `protobuf:"bytes,2,opt,name=data" json:"data,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ButtonRequest) Reset() { *m = ButtonRequest{} }
+func (m *ButtonRequest) String() string { return proto.CompactTextString(m) }
+func (*ButtonRequest) ProtoMessage() {}
+func (*ButtonRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{2}
+}
+
+func (m *ButtonRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ButtonRequest.Unmarshal(m, b)
+}
+func (m *ButtonRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ButtonRequest.Marshal(b, m, deterministic)
+}
+func (m *ButtonRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ButtonRequest.Merge(m, src)
+}
+func (m *ButtonRequest) XXX_Size() int {
+ return xxx_messageInfo_ButtonRequest.Size(m)
+}
+func (m *ButtonRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_ButtonRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ButtonRequest proto.InternalMessageInfo
+
+func (m *ButtonRequest) GetCode() ButtonRequest_ButtonRequestType {
+ if m != nil && m.Code != nil {
+ return *m.Code
+ }
+ return ButtonRequest_ButtonRequest_Other
+}
+
+func (m *ButtonRequest) GetData() string {
+ if m != nil && m.Data != nil {
+ return *m.Data
+ }
+ return ""
+}
+
+//*
+// Request: Computer agrees to wait for HW button press
+// @auxend
+type ButtonAck struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ButtonAck) Reset() { *m = ButtonAck{} }
+func (m *ButtonAck) String() string { return proto.CompactTextString(m) }
+func (*ButtonAck) ProtoMessage() {}
+func (*ButtonAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{3}
+}
+
+func (m *ButtonAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ButtonAck.Unmarshal(m, b)
+}
+func (m *ButtonAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ButtonAck.Marshal(b, m, deterministic)
+}
+func (m *ButtonAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ButtonAck.Merge(m, src)
+}
+func (m *ButtonAck) XXX_Size() int {
+ return xxx_messageInfo_ButtonAck.Size(m)
+}
+func (m *ButtonAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_ButtonAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ButtonAck proto.InternalMessageInfo
+
+//*
+// Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
+// @auxstart
+// @next PinMatrixAck
+type PinMatrixRequest struct {
+ Type *PinMatrixRequest_PinMatrixRequestType `protobuf:"varint,1,opt,name=type,enum=hw.trezor.messages.common.PinMatrixRequest_PinMatrixRequestType" json:"type,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PinMatrixRequest) Reset() { *m = PinMatrixRequest{} }
+func (m *PinMatrixRequest) String() string { return proto.CompactTextString(m) }
+func (*PinMatrixRequest) ProtoMessage() {}
+func (*PinMatrixRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{4}
+}
+
+func (m *PinMatrixRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PinMatrixRequest.Unmarshal(m, b)
+}
+func (m *PinMatrixRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PinMatrixRequest.Marshal(b, m, deterministic)
+}
+func (m *PinMatrixRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PinMatrixRequest.Merge(m, src)
+}
+func (m *PinMatrixRequest) XXX_Size() int {
+ return xxx_messageInfo_PinMatrixRequest.Size(m)
+}
+func (m *PinMatrixRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_PinMatrixRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PinMatrixRequest proto.InternalMessageInfo
+
+func (m *PinMatrixRequest) GetType() PinMatrixRequest_PinMatrixRequestType {
+ if m != nil && m.Type != nil {
+ return *m.Type
+ }
+ return PinMatrixRequest_PinMatrixRequestType_Current
+}
+
+//*
+// Request: Computer responds with encoded PIN
+// @auxend
+type PinMatrixAck struct {
+ Pin *string `protobuf:"bytes,1,req,name=pin" json:"pin,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PinMatrixAck) Reset() { *m = PinMatrixAck{} }
+func (m *PinMatrixAck) String() string { return proto.CompactTextString(m) }
+func (*PinMatrixAck) ProtoMessage() {}
+func (*PinMatrixAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{5}
+}
+
+func (m *PinMatrixAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PinMatrixAck.Unmarshal(m, b)
+}
+func (m *PinMatrixAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PinMatrixAck.Marshal(b, m, deterministic)
+}
+func (m *PinMatrixAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PinMatrixAck.Merge(m, src)
+}
+func (m *PinMatrixAck) XXX_Size() int {
+ return xxx_messageInfo_PinMatrixAck.Size(m)
+}
+func (m *PinMatrixAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_PinMatrixAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PinMatrixAck proto.InternalMessageInfo
+
+func (m *PinMatrixAck) GetPin() string {
+ if m != nil && m.Pin != nil {
+ return *m.Pin
+ }
+ return ""
+}
+
+//*
+// Response: Device awaits encryption passphrase
+// @auxstart
+// @next PassphraseAck
+type PassphraseRequest struct {
+ OnDevice *bool `protobuf:"varint,1,opt,name=on_device,json=onDevice" json:"on_device,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PassphraseRequest) Reset() { *m = PassphraseRequest{} }
+func (m *PassphraseRequest) String() string { return proto.CompactTextString(m) }
+func (*PassphraseRequest) ProtoMessage() {}
+func (*PassphraseRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{6}
+}
+
+func (m *PassphraseRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PassphraseRequest.Unmarshal(m, b)
+}
+func (m *PassphraseRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PassphraseRequest.Marshal(b, m, deterministic)
+}
+func (m *PassphraseRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PassphraseRequest.Merge(m, src)
+}
+func (m *PassphraseRequest) XXX_Size() int {
+ return xxx_messageInfo_PassphraseRequest.Size(m)
+}
+func (m *PassphraseRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_PassphraseRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PassphraseRequest proto.InternalMessageInfo
+
+func (m *PassphraseRequest) GetOnDevice() bool {
+ if m != nil && m.OnDevice != nil {
+ return *m.OnDevice
+ }
+ return false
+}
+
+//*
+// Request: Send passphrase back
+// @next PassphraseStateRequest
+type PassphraseAck struct {
+ Passphrase *string `protobuf:"bytes,1,opt,name=passphrase" json:"passphrase,omitempty"`
+ State []byte `protobuf:"bytes,2,opt,name=state" json:"state,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PassphraseAck) Reset() { *m = PassphraseAck{} }
+func (m *PassphraseAck) String() string { return proto.CompactTextString(m) }
+func (*PassphraseAck) ProtoMessage() {}
+func (*PassphraseAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{7}
+}
+
+func (m *PassphraseAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PassphraseAck.Unmarshal(m, b)
+}
+func (m *PassphraseAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PassphraseAck.Marshal(b, m, deterministic)
+}
+func (m *PassphraseAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PassphraseAck.Merge(m, src)
+}
+func (m *PassphraseAck) XXX_Size() int {
+ return xxx_messageInfo_PassphraseAck.Size(m)
+}
+func (m *PassphraseAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_PassphraseAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PassphraseAck proto.InternalMessageInfo
+
+func (m *PassphraseAck) GetPassphrase() string {
+ if m != nil && m.Passphrase != nil {
+ return *m.Passphrase
+ }
+ return ""
+}
+
+func (m *PassphraseAck) GetState() []byte {
+ if m != nil {
+ return m.State
+ }
+ return nil
+}
+
+//*
+// Response: Device awaits passphrase state
+// @next PassphraseStateAck
+type PassphraseStateRequest struct {
+ State []byte `protobuf:"bytes,1,opt,name=state" json:"state,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PassphraseStateRequest) Reset() { *m = PassphraseStateRequest{} }
+func (m *PassphraseStateRequest) String() string { return proto.CompactTextString(m) }
+func (*PassphraseStateRequest) ProtoMessage() {}
+func (*PassphraseStateRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{8}
+}
+
+func (m *PassphraseStateRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PassphraseStateRequest.Unmarshal(m, b)
+}
+func (m *PassphraseStateRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PassphraseStateRequest.Marshal(b, m, deterministic)
+}
+func (m *PassphraseStateRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PassphraseStateRequest.Merge(m, src)
+}
+func (m *PassphraseStateRequest) XXX_Size() int {
+ return xxx_messageInfo_PassphraseStateRequest.Size(m)
+}
+func (m *PassphraseStateRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_PassphraseStateRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PassphraseStateRequest proto.InternalMessageInfo
+
+func (m *PassphraseStateRequest) GetState() []byte {
+ if m != nil {
+ return m.State
+ }
+ return nil
+}
+
+//*
+// Request: Send passphrase state back
+// @auxend
+type PassphraseStateAck struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *PassphraseStateAck) Reset() { *m = PassphraseStateAck{} }
+func (m *PassphraseStateAck) String() string { return proto.CompactTextString(m) }
+func (*PassphraseStateAck) ProtoMessage() {}
+func (*PassphraseStateAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{9}
+}
+
+func (m *PassphraseStateAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_PassphraseStateAck.Unmarshal(m, b)
+}
+func (m *PassphraseStateAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_PassphraseStateAck.Marshal(b, m, deterministic)
+}
+func (m *PassphraseStateAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_PassphraseStateAck.Merge(m, src)
+}
+func (m *PassphraseStateAck) XXX_Size() int {
+ return xxx_messageInfo_PassphraseStateAck.Size(m)
+}
+func (m *PassphraseStateAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_PassphraseStateAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_PassphraseStateAck proto.InternalMessageInfo
+
+//*
+// Structure representing BIP32 (hierarchical deterministic) node
+// Used for imports of private key into the device and exporting public key out of device
+// @embed
+type HDNodeType struct {
+ Depth *uint32 `protobuf:"varint,1,req,name=depth" json:"depth,omitempty"`
+ Fingerprint *uint32 `protobuf:"varint,2,req,name=fingerprint" json:"fingerprint,omitempty"`
+ ChildNum *uint32 `protobuf:"varint,3,req,name=child_num,json=childNum" json:"child_num,omitempty"`
+ ChainCode []byte `protobuf:"bytes,4,req,name=chain_code,json=chainCode" json:"chain_code,omitempty"`
+ PrivateKey []byte `protobuf:"bytes,5,opt,name=private_key,json=privateKey" json:"private_key,omitempty"`
+ PublicKey []byte `protobuf:"bytes,6,opt,name=public_key,json=publicKey" json:"public_key,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *HDNodeType) Reset() { *m = HDNodeType{} }
+func (m *HDNodeType) String() string { return proto.CompactTextString(m) }
+func (*HDNodeType) ProtoMessage() {}
+func (*HDNodeType) Descriptor() ([]byte, []int) {
+ return fileDescriptor_aaf30d059fdbc38d, []int{10}
+}
+
+func (m *HDNodeType) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_HDNodeType.Unmarshal(m, b)
+}
+func (m *HDNodeType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_HDNodeType.Marshal(b, m, deterministic)
+}
+func (m *HDNodeType) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_HDNodeType.Merge(m, src)
+}
+func (m *HDNodeType) XXX_Size() int {
+ return xxx_messageInfo_HDNodeType.Size(m)
+}
+func (m *HDNodeType) XXX_DiscardUnknown() {
+ xxx_messageInfo_HDNodeType.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_HDNodeType proto.InternalMessageInfo
+
+func (m *HDNodeType) GetDepth() uint32 {
+ if m != nil && m.Depth != nil {
+ return *m.Depth
+ }
+ return 0
+}
+
+func (m *HDNodeType) GetFingerprint() uint32 {
+ if m != nil && m.Fingerprint != nil {
+ return *m.Fingerprint
+ }
+ return 0
+}
+
+func (m *HDNodeType) GetChildNum() uint32 {
+ if m != nil && m.ChildNum != nil {
+ return *m.ChildNum
+ }
+ return 0
+}
+
+func (m *HDNodeType) GetChainCode() []byte {
+ if m != nil {
+ return m.ChainCode
+ }
+ return nil
+}
+
+func (m *HDNodeType) GetPrivateKey() []byte {
+ if m != nil {
+ return m.PrivateKey
+ }
+ return nil
+}
+
+func (m *HDNodeType) GetPublicKey() []byte {
+ if m != nil {
+ return m.PublicKey
+ }
+ return nil
+}
+
+func init() {
+ proto.RegisterEnum("hw.trezor.messages.common.Failure_FailureType", Failure_FailureType_name, Failure_FailureType_value)
+ proto.RegisterEnum("hw.trezor.messages.common.ButtonRequest_ButtonRequestType", ButtonRequest_ButtonRequestType_name, ButtonRequest_ButtonRequestType_value)
+ proto.RegisterEnum("hw.trezor.messages.common.PinMatrixRequest_PinMatrixRequestType", PinMatrixRequest_PinMatrixRequestType_name, PinMatrixRequest_PinMatrixRequestType_value)
+ proto.RegisterType((*Success)(nil), "hw.trezor.messages.common.Success")
+ proto.RegisterType((*Failure)(nil), "hw.trezor.messages.common.Failure")
+ proto.RegisterType((*ButtonRequest)(nil), "hw.trezor.messages.common.ButtonRequest")
+ proto.RegisterType((*ButtonAck)(nil), "hw.trezor.messages.common.ButtonAck")
+ proto.RegisterType((*PinMatrixRequest)(nil), "hw.trezor.messages.common.PinMatrixRequest")
+ proto.RegisterType((*PinMatrixAck)(nil), "hw.trezor.messages.common.PinMatrixAck")
+ proto.RegisterType((*PassphraseRequest)(nil), "hw.trezor.messages.common.PassphraseRequest")
+ proto.RegisterType((*PassphraseAck)(nil), "hw.trezor.messages.common.PassphraseAck")
+ proto.RegisterType((*PassphraseStateRequest)(nil), "hw.trezor.messages.common.PassphraseStateRequest")
+ proto.RegisterType((*PassphraseStateAck)(nil), "hw.trezor.messages.common.PassphraseStateAck")
+ proto.RegisterType((*HDNodeType)(nil), "hw.trezor.messages.common.HDNodeType")
+}
+
+func init() { proto.RegisterFile("messages-common.proto", fileDescriptor_aaf30d059fdbc38d) }
+
+var fileDescriptor_aaf30d059fdbc38d = []byte{
+ // 846 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x54, 0xcd, 0x52, 0x23, 0x37,
+ 0x10, 0x2e, 0xff, 0x80, 0xed, 0xb6, 0xd9, 0x08, 0xc5, 0x80, 0x09, 0xb0, 0x38, 0xc3, 0x21, 0x5c,
+ 0xe2, 0x4a, 0xe5, 0x98, 0x53, 0x58, 0x83, 0x2b, 0xd4, 0x16, 0x86, 0x1a, 0xd8, 0xda, 0xa3, 0x4b,
+ 0xd1, 0xf4, 0x32, 0x2a, 0xcf, 0x48, 0x13, 0x8d, 0x06, 0xf0, 0x5e, 0xf2, 0x6a, 0x79, 0x89, 0xbc,
+ 0x42, 0xaa, 0x52, 0xb9, 0xe4, 0x11, 0xb6, 0x34, 0x3f, 0x78, 0xc6, 0x66, 0x39, 0xcd, 0xe8, 0xfb,
+ 0xbe, 0xee, 0x96, 0xba, 0x3f, 0x09, 0x76, 0x42, 0x8c, 0x63, 0x76, 0x8f, 0xf1, 0x8f, 0x5c, 0x85,
+ 0xa1, 0x92, 0xa3, 0x48, 0x2b, 0xa3, 0xe8, 0xbe, 0xff, 0x38, 0x32, 0x1a, 0x3f, 0x2b, 0x3d, 0x2a,
+ 0x04, 0xa3, 0x4c, 0xe0, 0x9c, 0x40, 0xeb, 0x36, 0xe1, 0x1c, 0xe3, 0x98, 0x0e, 0xa0, 0x95, 0xb3,
+ 0x83, 0xda, 0xb0, 0x76, 0xda, 0x71, 0x8b, 0xa5, 0xf3, 0x77, 0x03, 0x5a, 0x13, 0x26, 0x82, 0x44,
+ 0x23, 0x7d, 0x07, 0x4d, 0xae, 0xbc, 0x4c, 0xf2, 0xe6, 0xe7, 0xd1, 0xe8, 0xab, 0xa9, 0x47, 0x79,
+ 0x44, 0xf1, 0xbd, 0x5b, 0x44, 0xe8, 0xa6,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 0x36, 0x62, 0xc3, 0x4c, 0xf6,
+ 0xd8, 0xf6, 0xdc, 0x6c, 0xe1, 0x8c, 0x60, 0x77, 0x99, 0xe6, 0xd6, 0x42, 0x45, 0xf5, 0x67, 0x7d,
+ 0xad, 0xac, 0xef, 0x03, 0x5d, 0xd1, 0xdb, 0x61, 0xfe, 0x55, 0x03, 0xf8, 0xed, 0x7c, 0xaa, 0xbc,
+ 0xec, 0xbd, 0xee, 0xc3, 0x86, 0x87, 0x91, 0xf1, 0xd3, 0x13, 0x6e, 0xb9, 0xd9, 0x82, 0x0e, 0xa1,
+ 0xfb, 0x49, 0xc8, 0x7b, 0xd4, 0x91, 0x16, 0xd2, 0x0c, 0xea, 0x29, 0x57, 0x86, 0xec, 0x81, 0xb9,
+ 0x2f, 0x02, 0x6f, 0x26, 0x93, 0x70, 0xd0, 0x48, 0xf9, 0x76, 0x0a, 0x4c, 0x93, 0x90, 0x1e, 0x01,
+ 0x70, 0x9f, 0x09, 0x39, 0x4b, 0x9f, 0xa6, 0xe6, 0xb0, 0x7e, 0xda, 0x73, 0x3b, 0x29, 0x32, 0xb6,
+ 0x6f, 0xcc, 0x31, 0x74, 0xa3, 0xd4, 0x6f, 0x38, 0x9b, 0xe3, 0x62, 0xb0, 0x91, 0x6e, 0x1a, 0x72,
+ 0xe8, 0x3d, 0x2e, 0x6c, 0x7c, 0x94, 0xde, 0x8e, 0x94, 0xdf, 0x4c, 0xf9, 0x4e, 0x54, 0xdc, 0x97,
+ 0x2f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb2, 0x7d, 0x20, 0xa6, 0x35, 0x07, 0x00, 0x00,
+}
diff --git a/accounts/usbwallet/trezor/messages-common.proto b/accounts/usbwallet/trezor/messages-common.proto
new file mode 100644
index 0000000000..75a983b0a3
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-common.proto
@@ -0,0 +1,147 @@
+// This file originates from the SatoshiLabs Trezor `common` repository at:
+// https://github.com/trezor/trezor-common/blob/master/protob/messages-common.proto
+// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
+
+syntax = "proto2";
+package hw.trezor.messages.common;
+
+/**
+ * Response: Success of the previous request
+ * @end
+ */
+message Success {
+ optional string message = 1; // human readable description of action or request-specific payload
+}
+
+/**
+ * Response: Failure of the previous request
+ * @end
+ */
+message Failure {
+ optional FailureType code = 1; // computer-readable definition of the error state
+ optional string message = 2; // human-readable message of the error state
+ enum FailureType {
+ Failure_UnexpectedMessage = 1;
+ Failure_ButtonExpected = 2;
+ Failure_DataError = 3;
+ Failure_ActionCancelled = 4;
+ Failure_PinExpected = 5;
+ Failure_PinCancelled = 6;
+ Failure_PinInvalid = 7;
+ Failure_InvalidSignature = 8;
+ Failure_ProcessError = 9;
+ Failure_NotEnoughFunds = 10;
+ Failure_NotInitialized = 11;
+ Failure_PinMismatch = 12;
+ Failure_FirmwareError = 99;
+ }
+}
+
+/**
+ * Response: Device is waiting for HW button press.
+ * @auxstart
+ * @next ButtonAck
+ */
+message ButtonRequest {
+ optional ButtonRequestType code = 1;
+ optional string data = 2;
+ /**
+ * Type of button request
+ */
+ enum ButtonRequestType {
+ ButtonRequest_Other = 1;
+ ButtonRequest_FeeOverThreshold = 2;
+ ButtonRequest_ConfirmOutput = 3;
+ ButtonRequest_ResetDevice = 4;
+ ButtonRequest_ConfirmWord = 5;
+ ButtonRequest_WipeDevice = 6;
+ ButtonRequest_ProtectCall = 7;
+ ButtonRequest_SignTx = 8;
+ ButtonRequest_FirmwareCheck = 9;
+ ButtonRequest_Address = 10;
+ ButtonRequest_PublicKey = 11;
+ ButtonRequest_MnemonicWordCount = 12;
+ ButtonRequest_MnemonicInput = 13;
+ ButtonRequest_PassphraseType = 14;
+ ButtonRequest_UnknownDerivationPath = 15;
+ }
+}
+
+/**
+ * Request: Computer agrees to wait for HW button press
+ * @auxend
+ */
+message ButtonAck {
+}
+
+/**
+ * Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
+ * @auxstart
+ * @next PinMatrixAck
+ */
+message PinMatrixRequest {
+ optional PinMatrixRequestType type = 1;
+ /**
+ * Type of PIN request
+ */
+ enum PinMatrixRequestType {
+ PinMatrixRequestType_Current = 1;
+ PinMatrixRequestType_NewFirst = 2;
+ PinMatrixRequestType_NewSecond = 3;
+ }
+}
+
+/**
+ * Request: Computer responds with encoded PIN
+ * @auxend
+ */
+message PinMatrixAck {
+ required string pin = 1; // matrix encoded PIN entered by user
+}
+
+/**
+ * Response: Device awaits encryption passphrase
+ * @auxstart
+ * @next PassphraseAck
+ */
+message PassphraseRequest {
+ optional bool on_device = 1; // passphrase is being entered on the device
+}
+
+/**
+ * Request: Send passphrase back
+ * @next PassphraseStateRequest
+ */
+message PassphraseAck {
+ optional string passphrase = 1;
+ optional bytes state = 2; // expected device state
+}
+
+/**
+ * Response: Device awaits passphrase state
+ * @next PassphraseStateAck
+ */
+message PassphraseStateRequest {
+ optional bytes state = 1; // actual device state
+}
+
+/**
+ * Request: Send passphrase state back
+ * @auxend
+ */
+message PassphraseStateAck {
+}
+
+/**
+ * Structure representing BIP32 (hierarchical deterministic) node
+ * Used for imports of private key into the device and exporting public key out of device
+ * @embed
+ */
+message HDNodeType {
+ required uint32 depth = 1;
+ required uint32 fingerprint = 2;
+ required uint32 child_num = 3;
+ required bytes chain_code = 4;
+ optional bytes private_key = 5;
+ optional bytes public_key = 6;
+}
diff --git a/accounts/usbwallet/trezor/messages-ethereum.pb.go b/accounts/usbwallet/trezor/messages-ethereum.pb.go
new file mode 100644
index 0000000000..5d664f5ba4
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-ethereum.pb.go
@@ -0,0 +1,698 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: messages-ethereum.proto
+
+package trezor
+
+import (
+ fmt "fmt"
+ math "math"
+
+ proto "github.com/golang/protobuf/proto"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+//*
+// Request: Ask device for public key corresponding to address_n path
+// @start
+// @next EthereumPublicKey
+// @next Failure
+type EthereumGetPublicKey struct {
+ AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
+ ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumGetPublicKey) Reset() { *m = EthereumGetPublicKey{} }
+func (m *EthereumGetPublicKey) String() string { return proto.CompactTextString(m) }
+func (*EthereumGetPublicKey) ProtoMessage() {}
+func (*EthereumGetPublicKey) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{0}
+}
+
+func (m *EthereumGetPublicKey) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumGetPublicKey.Unmarshal(m, b)
+}
+func (m *EthereumGetPublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumGetPublicKey.Marshal(b, m, deterministic)
+}
+func (m *EthereumGetPublicKey) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumGetPublicKey.Merge(m, src)
+}
+func (m *EthereumGetPublicKey) XXX_Size() int {
+ return xxx_messageInfo_EthereumGetPublicKey.Size(m)
+}
+func (m *EthereumGetPublicKey) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumGetPublicKey.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumGetPublicKey proto.InternalMessageInfo
+
+func (m *EthereumGetPublicKey) GetAddressN() []uint32 {
+ if m != nil {
+ return m.AddressN
+ }
+ return nil
+}
+
+func (m *EthereumGetPublicKey) GetShowDisplay() bool {
+ if m != nil && m.ShowDisplay != nil {
+ return *m.ShowDisplay
+ }
+ return false
+}
+
+//*
+// Response: Contains public key derived from device private seed
+// @end
+type EthereumPublicKey struct {
+ Node *HDNodeType `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"`
+ Xpub *string `protobuf:"bytes,2,opt,name=xpub" json:"xpub,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumPublicKey) Reset() { *m = EthereumPublicKey{} }
+func (m *EthereumPublicKey) String() string { return proto.CompactTextString(m) }
+func (*EthereumPublicKey) ProtoMessage() {}
+func (*EthereumPublicKey) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{1}
+}
+
+func (m *EthereumPublicKey) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumPublicKey.Unmarshal(m, b)
+}
+func (m *EthereumPublicKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumPublicKey.Marshal(b, m, deterministic)
+}
+func (m *EthereumPublicKey) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumPublicKey.Merge(m, src)
+}
+func (m *EthereumPublicKey) XXX_Size() int {
+ return xxx_messageInfo_EthereumPublicKey.Size(m)
+}
+func (m *EthereumPublicKey) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumPublicKey.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumPublicKey proto.InternalMessageInfo
+
+func (m *EthereumPublicKey) GetNode() *HDNodeType {
+ if m != nil {
+ return m.Node
+ }
+ return nil
+}
+
+func (m *EthereumPublicKey) GetXpub() string {
+ if m != nil && m.Xpub != nil {
+ return *m.Xpub
+ }
+ return ""
+}
+
+//*
+// Request: Ask device for Ethereum address corresponding to address_n path
+// @start
+// @next EthereumAddress
+// @next Failure
+type EthereumGetAddress struct {
+ AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
+ ShowDisplay *bool `protobuf:"varint,2,opt,name=show_display,json=showDisplay" json:"show_display,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumGetAddress) Reset() { *m = EthereumGetAddress{} }
+func (m *EthereumGetAddress) String() string { return proto.CompactTextString(m) }
+func (*EthereumGetAddress) ProtoMessage() {}
+func (*EthereumGetAddress) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{2}
+}
+
+func (m *EthereumGetAddress) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumGetAddress.Unmarshal(m, b)
+}
+func (m *EthereumGetAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumGetAddress.Marshal(b, m, deterministic)
+}
+func (m *EthereumGetAddress) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumGetAddress.Merge(m, src)
+}
+func (m *EthereumGetAddress) XXX_Size() int {
+ return xxx_messageInfo_EthereumGetAddress.Size(m)
+}
+func (m *EthereumGetAddress) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumGetAddress.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumGetAddress proto.InternalMessageInfo
+
+func (m *EthereumGetAddress) GetAddressN() []uint32 {
+ if m != nil {
+ return m.AddressN
+ }
+ return nil
+}
+
+func (m *EthereumGetAddress) GetShowDisplay() bool {
+ if m != nil && m.ShowDisplay != nil {
+ return *m.ShowDisplay
+ }
+ return false
+}
+
+//*
+// Response: Contains an Ethereum address derived from device private seed
+// @end
+type EthereumAddress struct {
+ AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
+ AddressHex *string `protobuf:"bytes,2,opt,name=addressHex" json:"addressHex,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumAddress) Reset() { *m = EthereumAddress{} }
+func (m *EthereumAddress) String() string { return proto.CompactTextString(m) }
+func (*EthereumAddress) ProtoMessage() {}
+func (*EthereumAddress) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{3}
+}
+
+func (m *EthereumAddress) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumAddress.Unmarshal(m, b)
+}
+func (m *EthereumAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumAddress.Marshal(b, m, deterministic)
+}
+func (m *EthereumAddress) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumAddress.Merge(m, src)
+}
+func (m *EthereumAddress) XXX_Size() int {
+ return xxx_messageInfo_EthereumAddress.Size(m)
+}
+func (m *EthereumAddress) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumAddress.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumAddress proto.InternalMessageInfo
+
+func (m *EthereumAddress) GetAddressBin() []byte {
+ if m != nil {
+ return m.AddressBin
+ }
+ return nil
+}
+
+func (m *EthereumAddress) GetAddressHex() string {
+ if m != nil && m.AddressHex != nil {
+ return *m.AddressHex
+ }
+ return ""
+}
+
+//*
+// Request: Ask device to sign transaction
+// All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
+// Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
+// @start
+// @next EthereumTxRequest
+// @next Failure
+type EthereumSignTx struct {
+ AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
+ Nonce []byte `protobuf:"bytes,2,opt,name=nonce" json:"nonce,omitempty"`
+ GasPrice []byte `protobuf:"bytes,3,opt,name=gas_price,json=gasPrice" json:"gas_price,omitempty"`
+ GasLimit []byte `protobuf:"bytes,4,opt,name=gas_limit,json=gasLimit" json:"gas_limit,omitempty"`
+ ToBin []byte `protobuf:"bytes,5,opt,name=toBin" json:"toBin,omitempty"`
+ ToHex *string `protobuf:"bytes,11,opt,name=toHex" json:"toHex,omitempty"`
+ Value []byte `protobuf:"bytes,6,opt,name=value" json:"value,omitempty"`
+ DataInitialChunk []byte `protobuf:"bytes,7,opt,name=data_initial_chunk,json=dataInitialChunk" json:"data_initial_chunk,omitempty"`
+ DataLength *uint32 `protobuf:"varint,8,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
+ ChainId *uint32 `protobuf:"varint,9,opt,name=chain_id,json=chainId" json:"chain_id,omitempty"`
+ TxType *uint32 `protobuf:"varint,10,opt,name=tx_type,json=txType" json:"tx_type,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumSignTx) Reset() { *m = EthereumSignTx{} }
+func (m *EthereumSignTx) String() string { return proto.CompactTextString(m) }
+func (*EthereumSignTx) ProtoMessage() {}
+func (*EthereumSignTx) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{4}
+}
+
+func (m *EthereumSignTx) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumSignTx.Unmarshal(m, b)
+}
+func (m *EthereumSignTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumSignTx.Marshal(b, m, deterministic)
+}
+func (m *EthereumSignTx) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumSignTx.Merge(m, src)
+}
+func (m *EthereumSignTx) XXX_Size() int {
+ return xxx_messageInfo_EthereumSignTx.Size(m)
+}
+func (m *EthereumSignTx) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumSignTx.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumSignTx proto.InternalMessageInfo
+
+func (m *EthereumSignTx) GetAddressN() []uint32 {
+ if m != nil {
+ return m.AddressN
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetNonce() []byte {
+ if m != nil {
+ return m.Nonce
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetGasPrice() []byte {
+ if m != nil {
+ return m.GasPrice
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetGasLimit() []byte {
+ if m != nil {
+ return m.GasLimit
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetToBin() []byte {
+ if m != nil {
+ return m.ToBin
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetToHex() string {
+ if m != nil && m.ToHex != nil {
+ return *m.ToHex
+ }
+ return ""
+}
+
+func (m *EthereumSignTx) GetValue() []byte {
+ if m != nil {
+ return m.Value
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetDataInitialChunk() []byte {
+ if m != nil {
+ return m.DataInitialChunk
+ }
+ return nil
+}
+
+func (m *EthereumSignTx) GetDataLength() uint32 {
+ if m != nil && m.DataLength != nil {
+ return *m.DataLength
+ }
+ return 0
+}
+
+func (m *EthereumSignTx) GetChainId() uint32 {
+ if m != nil && m.ChainId != nil {
+ return *m.ChainId
+ }
+ return 0
+}
+
+func (m *EthereumSignTx) GetTxType() uint32 {
+ if m != nil && m.TxType != nil {
+ return *m.TxType
+ }
+ return 0
+}
+
+//*
+// Response: Device asks for more data from transaction payload, or returns the signature.
+// If data_length is set, device awaits that many more bytes of payload.
+// Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
+// @end
+// @next EthereumTxAck
+type EthereumTxRequest struct {
+ DataLength *uint32 `protobuf:"varint,1,opt,name=data_length,json=dataLength" json:"data_length,omitempty"`
+ SignatureV *uint32 `protobuf:"varint,2,opt,name=signature_v,json=signatureV" json:"signature_v,omitempty"`
+ SignatureR []byte `protobuf:"bytes,3,opt,name=signature_r,json=signatureR" json:"signature_r,omitempty"`
+ SignatureS []byte `protobuf:"bytes,4,opt,name=signature_s,json=signatureS" json:"signature_s,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumTxRequest) Reset() { *m = EthereumTxRequest{} }
+func (m *EthereumTxRequest) String() string { return proto.CompactTextString(m) }
+func (*EthereumTxRequest) ProtoMessage() {}
+func (*EthereumTxRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{5}
+}
+
+func (m *EthereumTxRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumTxRequest.Unmarshal(m, b)
+}
+func (m *EthereumTxRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumTxRequest.Marshal(b, m, deterministic)
+}
+func (m *EthereumTxRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumTxRequest.Merge(m, src)
+}
+func (m *EthereumTxRequest) XXX_Size() int {
+ return xxx_messageInfo_EthereumTxRequest.Size(m)
+}
+func (m *EthereumTxRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumTxRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumTxRequest proto.InternalMessageInfo
+
+func (m *EthereumTxRequest) GetDataLength() uint32 {
+ if m != nil && m.DataLength != nil {
+ return *m.DataLength
+ }
+ return 0
+}
+
+func (m *EthereumTxRequest) GetSignatureV() uint32 {
+ if m != nil && m.SignatureV != nil {
+ return *m.SignatureV
+ }
+ return 0
+}
+
+func (m *EthereumTxRequest) GetSignatureR() []byte {
+ if m != nil {
+ return m.SignatureR
+ }
+ return nil
+}
+
+func (m *EthereumTxRequest) GetSignatureS() []byte {
+ if m != nil {
+ return m.SignatureS
+ }
+ return nil
+}
+
+//*
+// Request: Transaction payload data.
+// @next EthereumTxRequest
+type EthereumTxAck struct {
+ DataChunk []byte `protobuf:"bytes,1,opt,name=data_chunk,json=dataChunk" json:"data_chunk,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumTxAck) Reset() { *m = EthereumTxAck{} }
+func (m *EthereumTxAck) String() string { return proto.CompactTextString(m) }
+func (*EthereumTxAck) ProtoMessage() {}
+func (*EthereumTxAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{6}
+}
+
+func (m *EthereumTxAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumTxAck.Unmarshal(m, b)
+}
+func (m *EthereumTxAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumTxAck.Marshal(b, m, deterministic)
+}
+func (m *EthereumTxAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumTxAck.Merge(m, src)
+}
+func (m *EthereumTxAck) XXX_Size() int {
+ return xxx_messageInfo_EthereumTxAck.Size(m)
+}
+func (m *EthereumTxAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumTxAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumTxAck proto.InternalMessageInfo
+
+func (m *EthereumTxAck) GetDataChunk() []byte {
+ if m != nil {
+ return m.DataChunk
+ }
+ return nil
+}
+
+//*
+// Request: Ask device to sign message
+// @start
+// @next EthereumMessageSignature
+// @next Failure
+type EthereumSignMessage struct {
+ AddressN []uint32 `protobuf:"varint,1,rep,name=address_n,json=addressN" json:"address_n,omitempty"`
+ Message []byte `protobuf:"bytes,2,opt,name=message" json:"message,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumSignMessage) Reset() { *m = EthereumSignMessage{} }
+func (m *EthereumSignMessage) String() string { return proto.CompactTextString(m) }
+func (*EthereumSignMessage) ProtoMessage() {}
+func (*EthereumSignMessage) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{7}
+}
+
+func (m *EthereumSignMessage) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumSignMessage.Unmarshal(m, b)
+}
+func (m *EthereumSignMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumSignMessage.Marshal(b, m, deterministic)
+}
+func (m *EthereumSignMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumSignMessage.Merge(m, src)
+}
+func (m *EthereumSignMessage) XXX_Size() int {
+ return xxx_messageInfo_EthereumSignMessage.Size(m)
+}
+func (m *EthereumSignMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumSignMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumSignMessage proto.InternalMessageInfo
+
+func (m *EthereumSignMessage) GetAddressN() []uint32 {
+ if m != nil {
+ return m.AddressN
+ }
+ return nil
+}
+
+func (m *EthereumSignMessage) GetMessage() []byte {
+ if m != nil {
+ return m.Message
+ }
+ return nil
+}
+
+//*
+// Response: Signed message
+// @end
+type EthereumMessageSignature struct {
+ AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
+ Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
+ AddressHex *string `protobuf:"bytes,3,opt,name=addressHex" json:"addressHex,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumMessageSignature) Reset() { *m = EthereumMessageSignature{} }
+func (m *EthereumMessageSignature) String() string { return proto.CompactTextString(m) }
+func (*EthereumMessageSignature) ProtoMessage() {}
+func (*EthereumMessageSignature) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{8}
+}
+
+func (m *EthereumMessageSignature) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumMessageSignature.Unmarshal(m, b)
+}
+func (m *EthereumMessageSignature) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumMessageSignature.Marshal(b, m, deterministic)
+}
+func (m *EthereumMessageSignature) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumMessageSignature.Merge(m, src)
+}
+func (m *EthereumMessageSignature) XXX_Size() int {
+ return xxx_messageInfo_EthereumMessageSignature.Size(m)
+}
+func (m *EthereumMessageSignature) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumMessageSignature.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumMessageSignature proto.InternalMessageInfo
+
+func (m *EthereumMessageSignature) GetAddressBin() []byte {
+ if m != nil {
+ return m.AddressBin
+ }
+ return nil
+}
+
+func (m *EthereumMessageSignature) GetSignature() []byte {
+ if m != nil {
+ return m.Signature
+ }
+ return nil
+}
+
+func (m *EthereumMessageSignature) GetAddressHex() string {
+ if m != nil && m.AddressHex != nil {
+ return *m.AddressHex
+ }
+ return ""
+}
+
+//*
+// Request: Ask device to verify message
+// @start
+// @next Success
+// @next Failure
+type EthereumVerifyMessage struct {
+ AddressBin []byte `protobuf:"bytes,1,opt,name=addressBin" json:"addressBin,omitempty"`
+ Signature []byte `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
+ Message []byte `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"`
+ AddressHex *string `protobuf:"bytes,4,opt,name=addressHex" json:"addressHex,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EthereumVerifyMessage) Reset() { *m = EthereumVerifyMessage{} }
+func (m *EthereumVerifyMessage) String() string { return proto.CompactTextString(m) }
+func (*EthereumVerifyMessage) ProtoMessage() {}
+func (*EthereumVerifyMessage) Descriptor() ([]byte, []int) {
+ return fileDescriptor_cb33f46ba915f15c, []int{9}
+}
+
+func (m *EthereumVerifyMessage) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EthereumVerifyMessage.Unmarshal(m, b)
+}
+func (m *EthereumVerifyMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EthereumVerifyMessage.Marshal(b, m, deterministic)
+}
+func (m *EthereumVerifyMessage) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EthereumVerifyMessage.Merge(m, src)
+}
+func (m *EthereumVerifyMessage) XXX_Size() int {
+ return xxx_messageInfo_EthereumVerifyMessage.Size(m)
+}
+func (m *EthereumVerifyMessage) XXX_DiscardUnknown() {
+ xxx_messageInfo_EthereumVerifyMessage.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EthereumVerifyMessage proto.InternalMessageInfo
+
+func (m *EthereumVerifyMessage) GetAddressBin() []byte {
+ if m != nil {
+ return m.AddressBin
+ }
+ return nil
+}
+
+func (m *EthereumVerifyMessage) GetSignature() []byte {
+ if m != nil {
+ return m.Signature
+ }
+ return nil
+}
+
+func (m *EthereumVerifyMessage) GetMessage() []byte {
+ if m != nil {
+ return m.Message
+ }
+ return nil
+}
+
+func (m *EthereumVerifyMessage) GetAddressHex() string {
+ if m != nil && m.AddressHex != nil {
+ return *m.AddressHex
+ }
+ return ""
+}
+
+func init() {
+ proto.RegisterType((*EthereumGetPublicKey)(nil), "hw.trezor.messages.ethereum.EthereumGetPublicKey")
+ proto.RegisterType((*EthereumPublicKey)(nil), "hw.trezor.messages.ethereum.EthereumPublicKey")
+ proto.RegisterType((*EthereumGetAddress)(nil), "hw.trezor.messages.ethereum.EthereumGetAddress")
+ proto.RegisterType((*EthereumAddress)(nil), "hw.trezor.messages.ethereum.EthereumAddress")
+ proto.RegisterType((*EthereumSignTx)(nil), "hw.trezor.messages.ethereum.EthereumSignTx")
+ proto.RegisterType((*EthereumTxRequest)(nil), "hw.trezor.messages.ethereum.EthereumTxRequest")
+ proto.RegisterType((*EthereumTxAck)(nil), "hw.trezor.messages.ethereum.EthereumTxAck")
+ proto.RegisterType((*EthereumSignMessage)(nil), "hw.trezor.messages.ethereum.EthereumSignMessage")
+ proto.RegisterType((*EthereumMessageSignature)(nil), "hw.trezor.messages.ethereum.EthereumMessageSignature")
+ proto.RegisterType((*EthereumVerifyMessage)(nil), "hw.trezor.messages.ethereum.EthereumVerifyMessage")
+}
+
+func init() { proto.RegisterFile("messages-ethereum.proto", fileDescriptor_cb33f46ba915f15c) }
+
+var fileDescriptor_cb33f46ba915f15c = []byte{
+ // 593 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
+ 0x10, 0x95, 0x9b, 0xb4, 0x49, 0x26, 0x0d, 0x1f, 0xa6, 0x55, 0x17, 0x0a, 0x34, 0x18, 0x21, 0xe5,
+ 0x00, 0x3e, 0x70, 0x43, 0xe2, 0xd2, 0x52, 0x44, 0x2b, 0x4a, 0x55, 0xdc, 0xa8, 0x57, 0x6b, 0x63,
+ 0x6f, 0xe3, 0x55, 0x9d, 0xdd, 0xe0, 0x5d, 0xb7, 0x0e, 0x7f, 0x82, 0x23, 0xff, 0x87, 0x5f, 0x86,
+ 0xf6, 0x2b, 0x71, 0x52, 0x54, 0x0e, 0xbd, 0x65, 0xde, 0xbc, 0x7d, 0xf3, 0x66, 0xf4, 0x62, 0xd8,
+ 0x99, 0x10, 0x21, 0xf0, 0x98, 0x88, 0x77, 0x44, 0x66, 0xa4, 0x20, 0xe5, 0x24, 0x9c, 0x16, 0x5c,
+ 0x72, 0x7f, 0x37, 0xbb, 0x09, 0x65, 0x41, 0x7e, 0xf2, 0x22, 0x74, 0x94, 0xd0, 0x51, 0x9e, 0x6d,
+ 0xcf, 0x5f, 0x25, 0x7c, 0x32, 0xe1, 0xcc, 0xbc, 0x09, 0x2e, 0x60, 0xeb, 0xb3, 0xa5, 0x7c, 0x21,
+ 0xf2, 0xac, 0x1c, 0xe5, 0x34, 0xf9, 0x4a, 0x66, 0x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 0x2b, 0x83, 0x0a, 0x90, 0x53, 0xb3, 0x4a, 0xe7, 0xce, 0xda, 0x7f, 0x83, 0xfb, 0x1c, 0x3a, 0xf3,
+ 0x3d, 0xac, 0xee, 0x02, 0x58, 0x89, 0x75, 0xe3, 0x56, 0xac, 0x7f, 0x79, 0xb0, 0xed, 0x46, 0x5f,
+ 0x90, 0x82, 0x5e, 0xce, 0xdc, 0x2a, 0xf7, 0x9b, 0x5b, 0xdb, 0xb5, 0xb1, 0xb4, 0xeb, 0x8a, 0xa3,
+ 0xe6, 0xaa, 0xa3, 0x83, 0x8f, 0xf0, 0x3a, 0xe1, 0x93, 0x50, 0x60, 0xc9, 0x45, 0x46, 0x73, 0x3c,
+ 0x12, 0xee, 0x03, 0x93, 0xd3, 0x91, 0xf9, 0xe2, 0x8d, 0xca, 0xcb, 0x83, 0xed, 0xa1, 0x06, 0xad,
+ 0x5b, 0xb7, 0xc2, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8a, 0xce, 0x81, 0xc8, 0x59, 0x05, 0x00,
+ 0x00,
+}
diff --git a/accounts/usbwallet/trezor/messages-ethereum.proto b/accounts/usbwallet/trezor/messages-ethereum.proto
new file mode 100644
index 0000000000..096bed2e4a
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-ethereum.proto
@@ -0,0 +1,131 @@
+// This file originates from the SatoshiLabs Trezor `common` repository at:
+// https://github.com/trezor/trezor-common/blob/master/protob/messages-ethereum.proto
+// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
+
+syntax = "proto2";
+package hw.trezor.messages.ethereum;
+
+// Sugar for easier handling in Java
+option java_package = "com.satoshilabs.trezor.lib.protobuf";
+option java_outer_classname = "TrezorMessageEthereum";
+
+import "messages-common.proto";
+
+
+/**
+ * Request: Ask device for public key corresponding to address_n path
+ * @start
+ * @next EthereumPublicKey
+ * @next Failure
+ */
+message EthereumGetPublicKey {
+ repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
+ optional bool show_display = 2; // optionally show on display before sending the result
+}
+
+/**
+ * Response: Contains public key derived from device private seed
+ * @end
+ */
+message EthereumPublicKey {
+ optional hw.trezor.messages.common.HDNodeType node = 1; // BIP32 public node
+ optional string xpub = 2; // serialized form of public node
+}
+
+/**
+ * Request: Ask device for Ethereum address corresponding to address_n path
+ * @start
+ * @next EthereumAddress
+ * @next Failure
+ */
+message EthereumGetAddress {
+ repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
+ optional bool show_display = 2; // optionally show on display before sending the result
+}
+
+/**
+ * Response: Contains an Ethereum address derived from device private seed
+ * @end
+ */
+message EthereumAddress {
+ optional bytes addressBin = 1; // Ethereum address as 20 bytes (legacy firmwares)
+ optional string addressHex = 2; // Ethereum address as hex string (newer firmwares)
+}
+
+/**
+ * Request: Ask device to sign transaction
+ * All fields are optional from the protocol's point of view. Each field defaults to value `0` if missing.
+ * Note: the first at most 1024 bytes of data MUST be transmitted as part of this message.
+ * @start
+ * @next EthereumTxRequest
+ * @next Failure
+ */
+message EthereumSignTx {
+ repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
+ optional bytes nonce = 2; // <=256 bit unsigned big endian
+ optional bytes gas_price = 3; // <=256 bit unsigned big endian (in wei)
+ optional bytes gas_limit = 4; // <=256 bit unsigned big endian
+ optional bytes toBin = 5; // recipient address (20 bytes, legacy firmware)
+ optional string toHex = 11; // recipient address (hex string, newer firmware)
+ optional bytes value = 6; // <=256 bit unsigned big endian (in wei)
+ optional bytes data_initial_chunk = 7; // The initial data chunk (<= 1024 bytes)
+ optional uint32 data_length = 8; // Length of transaction payload
+ optional uint32 chain_id = 9; // Chain Id for EIP 155
+ optional uint32 tx_type = 10; // (only for Wanchain)
+}
+
+/**
+ * Response: Device asks for more data from transaction payload, or returns the signature.
+ * If data_length is set, device awaits that many more bytes of payload.
+ * Otherwise, the signature_* fields contain the computed transaction signature. All three fields will be present.
+ * @end
+ * @next EthereumTxAck
+ */
+message EthereumTxRequest {
+ optional uint32 data_length = 1; // Number of bytes being requested (<= 1024)
+ optional uint32 signature_v = 2; // Computed signature (recovery parameter, limited to 27 or 28)
+ optional bytes signature_r = 3; // Computed signature R component (256 bit)
+ optional bytes signature_s = 4; // Computed signature S component (256 bit)
+}
+
+/**
+ * Request: Transaction payload data.
+ * @next EthereumTxRequest
+ */
+message EthereumTxAck {
+ optional bytes data_chunk = 1; // Bytes from transaction payload (<= 1024 bytes)
+}
+
+/**
+ * Request: Ask device to sign message
+ * @start
+ * @next EthereumMessageSignature
+ * @next Failure
+ */
+message EthereumSignMessage {
+ repeated uint32 address_n = 1; // BIP-32 path to derive the key from master node
+ optional bytes message = 2; // message to be signed
+}
+
+/**
+ * Response: Signed message
+ * @end
+ */
+message EthereumMessageSignature {
+ optional bytes addressBin = 1; // address used to sign the message (20 bytes, legacy firmware)
+ optional bytes signature = 2; // signature of the message
+ optional string addressHex = 3; // address used to sign the message (hex string, newer firmware)
+}
+
+/**
+ * Request: Ask device to verify message
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message EthereumVerifyMessage {
+ optional bytes addressBin = 1; // address to verify (20 bytes, legacy firmware)
+ optional bytes signature = 2; // signature to verify
+ optional bytes message = 3; // message to verify
+ optional string addressHex = 4; // address to verify (hex string, newer firmware)
+}
diff --git a/accounts/usbwallet/trezor/messages-management.pb.go b/accounts/usbwallet/trezor/messages-management.pb.go
new file mode 100644
index 0000000000..f5c872f1fb
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-management.pb.go
@@ -0,0 +1,1621 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: messages-management.proto
+
+package trezor
+
+import (
+ fmt "fmt"
+ math "math"
+
+ proto "github.com/golang/protobuf/proto"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+//*
+// Structure representing passphrase source
+type ApplySettings_PassphraseSourceType int32
+
+const (
+ ApplySettings_ASK ApplySettings_PassphraseSourceType = 0
+ ApplySettings_DEVICE ApplySettings_PassphraseSourceType = 1
+ ApplySettings_HOST ApplySettings_PassphraseSourceType = 2
+)
+
+var ApplySettings_PassphraseSourceType_name = map[int32]string{
+ 0: "ASK",
+ 1: "DEVICE",
+ 2: "HOST",
+}
+
+var ApplySettings_PassphraseSourceType_value = map[string]int32{
+ "ASK": 0,
+ "DEVICE": 1,
+ "HOST": 2,
+}
+
+func (x ApplySettings_PassphraseSourceType) Enum() *ApplySettings_PassphraseSourceType {
+ p := new(ApplySettings_PassphraseSourceType)
+ *p = x
+ return p
+}
+
+func (x ApplySettings_PassphraseSourceType) String() string {
+ return proto.EnumName(ApplySettings_PassphraseSourceType_name, int32(x))
+}
+
+func (x *ApplySettings_PassphraseSourceType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(ApplySettings_PassphraseSourceType_value, data, "ApplySettings_PassphraseSourceType")
+ if err != nil {
+ return err
+ }
+ *x = ApplySettings_PassphraseSourceType(value)
+ return nil
+}
+
+func (ApplySettings_PassphraseSourceType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{4, 0}
+}
+
+//*
+// Type of recovery procedure. These should be used as bitmask, e.g.,
+// `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
+// listing every method supported by the host computer.
+//
+// Note that ScrambledWords must be supported by every implementation
+// for backward compatibility; there is no way to not support it.
+type RecoveryDevice_RecoveryDeviceType int32
+
+const (
+ // use powers of two when extending this field
+ RecoveryDevice_RecoveryDeviceType_ScrambledWords RecoveryDevice_RecoveryDeviceType = 0
+ RecoveryDevice_RecoveryDeviceType_Matrix RecoveryDevice_RecoveryDeviceType = 1
+)
+
+var RecoveryDevice_RecoveryDeviceType_name = map[int32]string{
+ 0: "RecoveryDeviceType_ScrambledWords",
+ 1: "RecoveryDeviceType_Matrix",
+}
+
+var RecoveryDevice_RecoveryDeviceType_value = map[string]int32{
+ "RecoveryDeviceType_ScrambledWords": 0,
+ "RecoveryDeviceType_Matrix": 1,
+}
+
+func (x RecoveryDevice_RecoveryDeviceType) Enum() *RecoveryDevice_RecoveryDeviceType {
+ p := new(RecoveryDevice_RecoveryDeviceType)
+ *p = x
+ return p
+}
+
+func (x RecoveryDevice_RecoveryDeviceType) String() string {
+ return proto.EnumName(RecoveryDevice_RecoveryDeviceType_name, int32(x))
+}
+
+func (x *RecoveryDevice_RecoveryDeviceType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(RecoveryDevice_RecoveryDeviceType_value, data, "RecoveryDevice_RecoveryDeviceType")
+ if err != nil {
+ return err
+ }
+ *x = RecoveryDevice_RecoveryDeviceType(value)
+ return nil
+}
+
+func (RecoveryDevice_RecoveryDeviceType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{17, 0}
+}
+
+//*
+// Type of Recovery Word request
+type WordRequest_WordRequestType int32
+
+const (
+ WordRequest_WordRequestType_Plain WordRequest_WordRequestType = 0
+ WordRequest_WordRequestType_Matrix9 WordRequest_WordRequestType = 1
+ WordRequest_WordRequestType_Matrix6 WordRequest_WordRequestType = 2
+)
+
+var WordRequest_WordRequestType_name = map[int32]string{
+ 0: "WordRequestType_Plain",
+ 1: "WordRequestType_Matrix9",
+ 2: "WordRequestType_Matrix6",
+}
+
+var WordRequest_WordRequestType_value = map[string]int32{
+ "WordRequestType_Plain": 0,
+ "WordRequestType_Matrix9": 1,
+ "WordRequestType_Matrix6": 2,
+}
+
+func (x WordRequest_WordRequestType) Enum() *WordRequest_WordRequestType {
+ p := new(WordRequest_WordRequestType)
+ *p = x
+ return p
+}
+
+func (x WordRequest_WordRequestType) String() string {
+ return proto.EnumName(WordRequest_WordRequestType_name, int32(x))
+}
+
+func (x *WordRequest_WordRequestType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(WordRequest_WordRequestType_value, data, "WordRequest_WordRequestType")
+ if err != nil {
+ return err
+ }
+ *x = WordRequest_WordRequestType(value)
+ return nil
+}
+
+func (WordRequest_WordRequestType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{18, 0}
+}
+
+//*
+// Request: Reset device to default state and ask for device details
+// @start
+// @next Features
+type Initialize struct {
+ State []byte `protobuf:"bytes,1,opt,name=state" json:"state,omitempty"`
+ SkipPassphrase *bool `protobuf:"varint,2,opt,name=skip_passphrase,json=skipPassphrase" json:"skip_passphrase,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Initialize) Reset() { *m = Initialize{} }
+func (m *Initialize) String() string { return proto.CompactTextString(m) }
+func (*Initialize) ProtoMessage() {}
+func (*Initialize) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{0}
+}
+
+func (m *Initialize) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Initialize.Unmarshal(m, b)
+}
+func (m *Initialize) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Initialize.Marshal(b, m, deterministic)
+}
+func (m *Initialize) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Initialize.Merge(m, src)
+}
+func (m *Initialize) XXX_Size() int {
+ return xxx_messageInfo_Initialize.Size(m)
+}
+func (m *Initialize) XXX_DiscardUnknown() {
+ xxx_messageInfo_Initialize.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Initialize proto.InternalMessageInfo
+
+func (m *Initialize) GetState() []byte {
+ if m != nil {
+ return m.State
+ }
+ return nil
+}
+
+func (m *Initialize) GetSkipPassphrase() bool {
+ if m != nil && m.SkipPassphrase != nil {
+ return *m.SkipPassphrase
+ }
+ return false
+}
+
+//*
+// Request: Ask for device details (no device reset)
+// @start
+// @next Features
+type GetFeatures struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *GetFeatures) Reset() { *m = GetFeatures{} }
+func (m *GetFeatures) String() string { return proto.CompactTextString(m) }
+func (*GetFeatures) ProtoMessage() {}
+func (*GetFeatures) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{1}
+}
+
+func (m *GetFeatures) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_GetFeatures.Unmarshal(m, b)
+}
+func (m *GetFeatures) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_GetFeatures.Marshal(b, m, deterministic)
+}
+func (m *GetFeatures) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_GetFeatures.Merge(m, src)
+}
+func (m *GetFeatures) XXX_Size() int {
+ return xxx_messageInfo_GetFeatures.Size(m)
+}
+func (m *GetFeatures) XXX_DiscardUnknown() {
+ xxx_messageInfo_GetFeatures.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GetFeatures proto.InternalMessageInfo
+
+//*
+// Response: Reports various information about the device
+// @end
+type Features struct {
+ Vendor *string `protobuf:"bytes,1,opt,name=vendor" json:"vendor,omitempty"`
+ MajorVersion *uint32 `protobuf:"varint,2,opt,name=major_version,json=majorVersion" json:"major_version,omitempty"`
+ MinorVersion *uint32 `protobuf:"varint,3,opt,name=minor_version,json=minorVersion" json:"minor_version,omitempty"`
+ PatchVersion *uint32 `protobuf:"varint,4,opt,name=patch_version,json=patchVersion" json:"patch_version,omitempty"`
+ BootloaderMode *bool `protobuf:"varint,5,opt,name=bootloader_mode,json=bootloaderMode" json:"bootloader_mode,omitempty"`
+ DeviceId *string `protobuf:"bytes,6,opt,name=device_id,json=deviceId" json:"device_id,omitempty"`
+ PinProtection *bool `protobuf:"varint,7,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
+ PassphraseProtection *bool `protobuf:"varint,8,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
+ Language *string `protobuf:"bytes,9,opt,name=language" json:"language,omitempty"`
+ Label *string `protobuf:"bytes,10,opt,name=label" json:"label,omitempty"`
+ Initialized *bool `protobuf:"varint,12,opt,name=initialized" json:"initialized,omitempty"`
+ Revision []byte `protobuf:"bytes,13,opt,name=revision" json:"revision,omitempty"`
+ BootloaderHash []byte `protobuf:"bytes,14,opt,name=bootloader_hash,json=bootloaderHash" json:"bootloader_hash,omitempty"`
+ Imported *bool `protobuf:"varint,15,opt,name=imported" json:"imported,omitempty"`
+ PinCached *bool `protobuf:"varint,16,opt,name=pin_cached,json=pinCached" json:"pin_cached,omitempty"`
+ PassphraseCached *bool `protobuf:"varint,17,opt,name=passphrase_cached,json=passphraseCached" json:"passphrase_cached,omitempty"`
+ FirmwarePresent *bool `protobuf:"varint,18,opt,name=firmware_present,json=firmwarePresent" json:"firmware_present,omitempty"`
+ NeedsBackup *bool `protobuf:"varint,19,opt,name=needs_backup,json=needsBackup" json:"needs_backup,omitempty"`
+ Flags *uint32 `protobuf:"varint,20,opt,name=flags" json:"flags,omitempty"`
+ Model *string `protobuf:"bytes,21,opt,name=model" json:"model,omitempty"`
+ FwMajor *uint32 `protobuf:"varint,22,opt,name=fw_major,json=fwMajor" json:"fw_major,omitempty"`
+ FwMinor *uint32 `protobuf:"varint,23,opt,name=fw_minor,json=fwMinor" json:"fw_minor,omitempty"`
+ FwPatch *uint32 `protobuf:"varint,24,opt,name=fw_patch,json=fwPatch" json:"fw_patch,omitempty"`
+ FwVendor *string `protobuf:"bytes,25,opt,name=fw_vendor,json=fwVendor" json:"fw_vendor,omitempty"`
+ FwVendorKeys []byte `protobuf:"bytes,26,opt,name=fw_vendor_keys,json=fwVendorKeys" json:"fw_vendor_keys,omitempty"`
+ UnfinishedBackup *bool `protobuf:"varint,27,opt,name=unfinished_backup,json=unfinishedBackup" json:"unfinished_backup,omitempty"`
+ NoBackup *bool `protobuf:"varint,28,opt,name=no_backup,json=noBackup" json:"no_backup,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Features) Reset() { *m = Features{} }
+func (m *Features) String() string { return proto.CompactTextString(m) }
+func (*Features) ProtoMessage() {}
+func (*Features) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{2}
+}
+
+func (m *Features) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Features.Unmarshal(m, b)
+}
+func (m *Features) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Features.Marshal(b, m, deterministic)
+}
+func (m *Features) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Features.Merge(m, src)
+}
+func (m *Features) XXX_Size() int {
+ return xxx_messageInfo_Features.Size(m)
+}
+func (m *Features) XXX_DiscardUnknown() {
+ xxx_messageInfo_Features.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Features proto.InternalMessageInfo
+
+func (m *Features) GetVendor() string {
+ if m != nil && m.Vendor != nil {
+ return *m.Vendor
+ }
+ return ""
+}
+
+func (m *Features) GetMajorVersion() uint32 {
+ if m != nil && m.MajorVersion != nil {
+ return *m.MajorVersion
+ }
+ return 0
+}
+
+func (m *Features) GetMinorVersion() uint32 {
+ if m != nil && m.MinorVersion != nil {
+ return *m.MinorVersion
+ }
+ return 0
+}
+
+func (m *Features) GetPatchVersion() uint32 {
+ if m != nil && m.PatchVersion != nil {
+ return *m.PatchVersion
+ }
+ return 0
+}
+
+func (m *Features) GetBootloaderMode() bool {
+ if m != nil && m.BootloaderMode != nil {
+ return *m.BootloaderMode
+ }
+ return false
+}
+
+func (m *Features) GetDeviceId() string {
+ if m != nil && m.DeviceId != nil {
+ return *m.DeviceId
+ }
+ return ""
+}
+
+func (m *Features) GetPinProtection() bool {
+ if m != nil && m.PinProtection != nil {
+ return *m.PinProtection
+ }
+ return false
+}
+
+func (m *Features) GetPassphraseProtection() bool {
+ if m != nil && m.PassphraseProtection != nil {
+ return *m.PassphraseProtection
+ }
+ return false
+}
+
+func (m *Features) GetLanguage() string {
+ if m != nil && m.Language != nil {
+ return *m.Language
+ }
+ return ""
+}
+
+func (m *Features) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
+ }
+ return ""
+}
+
+func (m *Features) GetInitialized() bool {
+ if m != nil && m.Initialized != nil {
+ return *m.Initialized
+ }
+ return false
+}
+
+func (m *Features) GetRevision() []byte {
+ if m != nil {
+ return m.Revision
+ }
+ return nil
+}
+
+func (m *Features) GetBootloaderHash() []byte {
+ if m != nil {
+ return m.BootloaderHash
+ }
+ return nil
+}
+
+func (m *Features) GetImported() bool {
+ if m != nil && m.Imported != nil {
+ return *m.Imported
+ }
+ return false
+}
+
+func (m *Features) GetPinCached() bool {
+ if m != nil && m.PinCached != nil {
+ return *m.PinCached
+ }
+ return false
+}
+
+func (m *Features) GetPassphraseCached() bool {
+ if m != nil && m.PassphraseCached != nil {
+ return *m.PassphraseCached
+ }
+ return false
+}
+
+func (m *Features) GetFirmwarePresent() bool {
+ if m != nil && m.FirmwarePresent != nil {
+ return *m.FirmwarePresent
+ }
+ return false
+}
+
+func (m *Features) GetNeedsBackup() bool {
+ if m != nil && m.NeedsBackup != nil {
+ return *m.NeedsBackup
+ }
+ return false
+}
+
+func (m *Features) GetFlags() uint32 {
+ if m != nil && m.Flags != nil {
+ return *m.Flags
+ }
+ return 0
+}
+
+func (m *Features) GetModel() string {
+ if m != nil && m.Model != nil {
+ return *m.Model
+ }
+ return ""
+}
+
+func (m *Features) GetFwMajor() uint32 {
+ if m != nil && m.FwMajor != nil {
+ return *m.FwMajor
+ }
+ return 0
+}
+
+func (m *Features) GetFwMinor() uint32 {
+ if m != nil && m.FwMinor != nil {
+ return *m.FwMinor
+ }
+ return 0
+}
+
+func (m *Features) GetFwPatch() uint32 {
+ if m != nil && m.FwPatch != nil {
+ return *m.FwPatch
+ }
+ return 0
+}
+
+func (m *Features) GetFwVendor() string {
+ if m != nil && m.FwVendor != nil {
+ return *m.FwVendor
+ }
+ return ""
+}
+
+func (m *Features) GetFwVendorKeys() []byte {
+ if m != nil {
+ return m.FwVendorKeys
+ }
+ return nil
+}
+
+func (m *Features) GetUnfinishedBackup() bool {
+ if m != nil && m.UnfinishedBackup != nil {
+ return *m.UnfinishedBackup
+ }
+ return false
+}
+
+func (m *Features) GetNoBackup() bool {
+ if m != nil && m.NoBackup != nil {
+ return *m.NoBackup
+ }
+ return false
+}
+
+//*
+// Request: clear session (removes cached PIN, passphrase, etc).
+// @start
+// @next Success
+type ClearSession struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ClearSession) Reset() { *m = ClearSession{} }
+func (m *ClearSession) String() string { return proto.CompactTextString(m) }
+func (*ClearSession) ProtoMessage() {}
+func (*ClearSession) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{3}
+}
+
+func (m *ClearSession) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ClearSession.Unmarshal(m, b)
+}
+func (m *ClearSession) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ClearSession.Marshal(b, m, deterministic)
+}
+func (m *ClearSession) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ClearSession.Merge(m, src)
+}
+func (m *ClearSession) XXX_Size() int {
+ return xxx_messageInfo_ClearSession.Size(m)
+}
+func (m *ClearSession) XXX_DiscardUnknown() {
+ xxx_messageInfo_ClearSession.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ClearSession proto.InternalMessageInfo
+
+//*
+// Request: change language and/or label of the device
+// @start
+// @next Success
+// @next Failure
+type ApplySettings struct {
+ Language *string `protobuf:"bytes,1,opt,name=language" json:"language,omitempty"`
+ Label *string `protobuf:"bytes,2,opt,name=label" json:"label,omitempty"`
+ UsePassphrase *bool `protobuf:"varint,3,opt,name=use_passphrase,json=usePassphrase" json:"use_passphrase,omitempty"`
+ Homescreen []byte `protobuf:"bytes,4,opt,name=homescreen" json:"homescreen,omitempty"`
+ PassphraseSource *ApplySettings_PassphraseSourceType `protobuf:"varint,5,opt,name=passphrase_source,json=passphraseSource,enum=hw.trezor.messages.management.ApplySettings_PassphraseSourceType" json:"passphrase_source,omitempty"`
+ AutoLockDelayMs *uint32 `protobuf:"varint,6,opt,name=auto_lock_delay_ms,json=autoLockDelayMs" json:"auto_lock_delay_ms,omitempty"`
+ DisplayRotation *uint32 `protobuf:"varint,7,opt,name=display_rotation,json=displayRotation" json:"display_rotation,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ApplySettings) Reset() { *m = ApplySettings{} }
+func (m *ApplySettings) String() string { return proto.CompactTextString(m) }
+func (*ApplySettings) ProtoMessage() {}
+func (*ApplySettings) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{4}
+}
+
+func (m *ApplySettings) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ApplySettings.Unmarshal(m, b)
+}
+func (m *ApplySettings) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ApplySettings.Marshal(b, m, deterministic)
+}
+func (m *ApplySettings) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ApplySettings.Merge(m, src)
+}
+func (m *ApplySettings) XXX_Size() int {
+ return xxx_messageInfo_ApplySettings.Size(m)
+}
+func (m *ApplySettings) XXX_DiscardUnknown() {
+ xxx_messageInfo_ApplySettings.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApplySettings proto.InternalMessageInfo
+
+func (m *ApplySettings) GetLanguage() string {
+ if m != nil && m.Language != nil {
+ return *m.Language
+ }
+ return ""
+}
+
+func (m *ApplySettings) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
+ }
+ return ""
+}
+
+func (m *ApplySettings) GetUsePassphrase() bool {
+ if m != nil && m.UsePassphrase != nil {
+ return *m.UsePassphrase
+ }
+ return false
+}
+
+func (m *ApplySettings) GetHomescreen() []byte {
+ if m != nil {
+ return m.Homescreen
+ }
+ return nil
+}
+
+func (m *ApplySettings) GetPassphraseSource() ApplySettings_PassphraseSourceType {
+ if m != nil && m.PassphraseSource != nil {
+ return *m.PassphraseSource
+ }
+ return ApplySettings_ASK
+}
+
+func (m *ApplySettings) GetAutoLockDelayMs() uint32 {
+ if m != nil && m.AutoLockDelayMs != nil {
+ return *m.AutoLockDelayMs
+ }
+ return 0
+}
+
+func (m *ApplySettings) GetDisplayRotation() uint32 {
+ if m != nil && m.DisplayRotation != nil {
+ return *m.DisplayRotation
+ }
+ return 0
+}
+
+//*
+// Request: set flags of the device
+// @start
+// @next Success
+// @next Failure
+type ApplyFlags struct {
+ Flags *uint32 `protobuf:"varint,1,opt,name=flags" json:"flags,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ApplyFlags) Reset() { *m = ApplyFlags{} }
+func (m *ApplyFlags) String() string { return proto.CompactTextString(m) }
+func (*ApplyFlags) ProtoMessage() {}
+func (*ApplyFlags) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{5}
+}
+
+func (m *ApplyFlags) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ApplyFlags.Unmarshal(m, b)
+}
+func (m *ApplyFlags) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ApplyFlags.Marshal(b, m, deterministic)
+}
+func (m *ApplyFlags) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ApplyFlags.Merge(m, src)
+}
+func (m *ApplyFlags) XXX_Size() int {
+ return xxx_messageInfo_ApplyFlags.Size(m)
+}
+func (m *ApplyFlags) XXX_DiscardUnknown() {
+ xxx_messageInfo_ApplyFlags.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ApplyFlags proto.InternalMessageInfo
+
+func (m *ApplyFlags) GetFlags() uint32 {
+ if m != nil && m.Flags != nil {
+ return *m.Flags
+ }
+ return 0
+}
+
+//*
+// Request: Starts workflow for setting/changing/removing the PIN
+// @start
+// @next Success
+// @next Failure
+type ChangePin struct {
+ Remove *bool `protobuf:"varint,1,opt,name=remove" json:"remove,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ChangePin) Reset() { *m = ChangePin{} }
+func (m *ChangePin) String() string { return proto.CompactTextString(m) }
+func (*ChangePin) ProtoMessage() {}
+func (*ChangePin) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{6}
+}
+
+func (m *ChangePin) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ChangePin.Unmarshal(m, b)
+}
+func (m *ChangePin) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ChangePin.Marshal(b, m, deterministic)
+}
+func (m *ChangePin) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ChangePin.Merge(m, src)
+}
+func (m *ChangePin) XXX_Size() int {
+ return xxx_messageInfo_ChangePin.Size(m)
+}
+func (m *ChangePin) XXX_DiscardUnknown() {
+ xxx_messageInfo_ChangePin.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ChangePin proto.InternalMessageInfo
+
+func (m *ChangePin) GetRemove() bool {
+ if m != nil && m.Remove != nil {
+ return *m.Remove
+ }
+ return false
+}
+
+//*
+// Request: Test if the device is alive, device sends back the message in Success response
+// @start
+// @next Success
+type Ping struct {
+ Message *string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
+ ButtonProtection *bool `protobuf:"varint,2,opt,name=button_protection,json=buttonProtection" json:"button_protection,omitempty"`
+ PinProtection *bool `protobuf:"varint,3,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
+ PassphraseProtection *bool `protobuf:"varint,4,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Ping) Reset() { *m = Ping{} }
+func (m *Ping) String() string { return proto.CompactTextString(m) }
+func (*Ping) ProtoMessage() {}
+func (*Ping) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{7}
+}
+
+func (m *Ping) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Ping.Unmarshal(m, b)
+}
+func (m *Ping) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Ping.Marshal(b, m, deterministic)
+}
+func (m *Ping) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Ping.Merge(m, src)
+}
+func (m *Ping) XXX_Size() int {
+ return xxx_messageInfo_Ping.Size(m)
+}
+func (m *Ping) XXX_DiscardUnknown() {
+ xxx_messageInfo_Ping.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Ping proto.InternalMessageInfo
+
+func (m *Ping) GetMessage() string {
+ if m != nil && m.Message != nil {
+ return *m.Message
+ }
+ return ""
+}
+
+func (m *Ping) GetButtonProtection() bool {
+ if m != nil && m.ButtonProtection != nil {
+ return *m.ButtonProtection
+ }
+ return false
+}
+
+func (m *Ping) GetPinProtection() bool {
+ if m != nil && m.PinProtection != nil {
+ return *m.PinProtection
+ }
+ return false
+}
+
+func (m *Ping) GetPassphraseProtection() bool {
+ if m != nil && m.PassphraseProtection != nil {
+ return *m.PassphraseProtection
+ }
+ return false
+}
+
+//*
+// Request: Abort last operation that required user interaction
+// @start
+// @next Failure
+type Cancel struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Cancel) Reset() { *m = Cancel{} }
+func (m *Cancel) String() string { return proto.CompactTextString(m) }
+func (*Cancel) ProtoMessage() {}
+func (*Cancel) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{8}
+}
+
+func (m *Cancel) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Cancel.Unmarshal(m, b)
+}
+func (m *Cancel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Cancel.Marshal(b, m, deterministic)
+}
+func (m *Cancel) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Cancel.Merge(m, src)
+}
+func (m *Cancel) XXX_Size() int {
+ return xxx_messageInfo_Cancel.Size(m)
+}
+func (m *Cancel) XXX_DiscardUnknown() {
+ xxx_messageInfo_Cancel.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Cancel proto.InternalMessageInfo
+
+//*
+// Request: Request a sample of random data generated by hardware RNG. May be used for testing.
+// @start
+// @next Entropy
+// @next Failure
+type GetEntropy struct {
+ Size *uint32 `protobuf:"varint,1,req,name=size" json:"size,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *GetEntropy) Reset() { *m = GetEntropy{} }
+func (m *GetEntropy) String() string { return proto.CompactTextString(m) }
+func (*GetEntropy) ProtoMessage() {}
+func (*GetEntropy) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{9}
+}
+
+func (m *GetEntropy) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_GetEntropy.Unmarshal(m, b)
+}
+func (m *GetEntropy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_GetEntropy.Marshal(b, m, deterministic)
+}
+func (m *GetEntropy) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_GetEntropy.Merge(m, src)
+}
+func (m *GetEntropy) XXX_Size() int {
+ return xxx_messageInfo_GetEntropy.Size(m)
+}
+func (m *GetEntropy) XXX_DiscardUnknown() {
+ xxx_messageInfo_GetEntropy.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_GetEntropy proto.InternalMessageInfo
+
+func (m *GetEntropy) GetSize() uint32 {
+ if m != nil && m.Size != nil {
+ return *m.Size
+ }
+ return 0
+}
+
+//*
+// Response: Reply with random data generated by internal RNG
+// @end
+type Entropy struct {
+ Entropy []byte `protobuf:"bytes,1,req,name=entropy" json:"entropy,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *Entropy) Reset() { *m = Entropy{} }
+func (m *Entropy) String() string { return proto.CompactTextString(m) }
+func (*Entropy) ProtoMessage() {}
+func (*Entropy) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{10}
+}
+
+func (m *Entropy) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_Entropy.Unmarshal(m, b)
+}
+func (m *Entropy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_Entropy.Marshal(b, m, deterministic)
+}
+func (m *Entropy) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_Entropy.Merge(m, src)
+}
+func (m *Entropy) XXX_Size() int {
+ return xxx_messageInfo_Entropy.Size(m)
+}
+func (m *Entropy) XXX_DiscardUnknown() {
+ xxx_messageInfo_Entropy.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_Entropy proto.InternalMessageInfo
+
+func (m *Entropy) GetEntropy() []byte {
+ if m != nil {
+ return m.Entropy
+ }
+ return nil
+}
+
+//*
+// Request: Request device to wipe all sensitive data and settings
+// @start
+// @next Success
+// @next Failure
+type WipeDevice struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *WipeDevice) Reset() { *m = WipeDevice{} }
+func (m *WipeDevice) String() string { return proto.CompactTextString(m) }
+func (*WipeDevice) ProtoMessage() {}
+func (*WipeDevice) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{11}
+}
+
+func (m *WipeDevice) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_WipeDevice.Unmarshal(m, b)
+}
+func (m *WipeDevice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_WipeDevice.Marshal(b, m, deterministic)
+}
+func (m *WipeDevice) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_WipeDevice.Merge(m, src)
+}
+func (m *WipeDevice) XXX_Size() int {
+ return xxx_messageInfo_WipeDevice.Size(m)
+}
+func (m *WipeDevice) XXX_DiscardUnknown() {
+ xxx_messageInfo_WipeDevice.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_WipeDevice proto.InternalMessageInfo
+
+//*
+// Request: Load seed and related internal settings from the computer
+// @start
+// @next Success
+// @next Failure
+type LoadDevice struct {
+ Mnemonic *string `protobuf:"bytes,1,opt,name=mnemonic" json:"mnemonic,omitempty"`
+ Node *HDNodeType `protobuf:"bytes,2,opt,name=node" json:"node,omitempty"`
+ Pin *string `protobuf:"bytes,3,opt,name=pin" json:"pin,omitempty"`
+ PassphraseProtection *bool `protobuf:"varint,4,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
+ Language *string `protobuf:"bytes,5,opt,name=language,def=english" json:"language,omitempty"`
+ Label *string `protobuf:"bytes,6,opt,name=label" json:"label,omitempty"`
+ SkipChecksum *bool `protobuf:"varint,7,opt,name=skip_checksum,json=skipChecksum" json:"skip_checksum,omitempty"`
+ U2FCounter *uint32 `protobuf:"varint,8,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *LoadDevice) Reset() { *m = LoadDevice{} }
+func (m *LoadDevice) String() string { return proto.CompactTextString(m) }
+func (*LoadDevice) ProtoMessage() {}
+func (*LoadDevice) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{12}
+}
+
+func (m *LoadDevice) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_LoadDevice.Unmarshal(m, b)
+}
+func (m *LoadDevice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_LoadDevice.Marshal(b, m, deterministic)
+}
+func (m *LoadDevice) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_LoadDevice.Merge(m, src)
+}
+func (m *LoadDevice) XXX_Size() int {
+ return xxx_messageInfo_LoadDevice.Size(m)
+}
+func (m *LoadDevice) XXX_DiscardUnknown() {
+ xxx_messageInfo_LoadDevice.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_LoadDevice proto.InternalMessageInfo
+
+const Default_LoadDevice_Language string = "english"
+
+func (m *LoadDevice) GetMnemonic() string {
+ if m != nil && m.Mnemonic != nil {
+ return *m.Mnemonic
+ }
+ return ""
+}
+
+func (m *LoadDevice) GetNode() *HDNodeType {
+ if m != nil {
+ return m.Node
+ }
+ return nil
+}
+
+func (m *LoadDevice) GetPin() string {
+ if m != nil && m.Pin != nil {
+ return *m.Pin
+ }
+ return ""
+}
+
+func (m *LoadDevice) GetPassphraseProtection() bool {
+ if m != nil && m.PassphraseProtection != nil {
+ return *m.PassphraseProtection
+ }
+ return false
+}
+
+func (m *LoadDevice) GetLanguage() string {
+ if m != nil && m.Language != nil {
+ return *m.Language
+ }
+ return Default_LoadDevice_Language
+}
+
+func (m *LoadDevice) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
+ }
+ return ""
+}
+
+func (m *LoadDevice) GetSkipChecksum() bool {
+ if m != nil && m.SkipChecksum != nil {
+ return *m.SkipChecksum
+ }
+ return false
+}
+
+func (m *LoadDevice) GetU2FCounter() uint32 {
+ if m != nil && m.U2FCounter != nil {
+ return *m.U2FCounter
+ }
+ return 0
+}
+
+//*
+// Request: Ask device to do initialization involving user interaction
+// @start
+// @next EntropyRequest
+// @next Failure
+type ResetDevice struct {
+ DisplayRandom *bool `protobuf:"varint,1,opt,name=display_random,json=displayRandom" json:"display_random,omitempty"`
+ Strength *uint32 `protobuf:"varint,2,opt,name=strength,def=256" json:"strength,omitempty"`
+ PassphraseProtection *bool `protobuf:"varint,3,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
+ PinProtection *bool `protobuf:"varint,4,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
+ Language *string `protobuf:"bytes,5,opt,name=language,def=english" json:"language,omitempty"`
+ Label *string `protobuf:"bytes,6,opt,name=label" json:"label,omitempty"`
+ U2FCounter *uint32 `protobuf:"varint,7,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
+ SkipBackup *bool `protobuf:"varint,8,opt,name=skip_backup,json=skipBackup" json:"skip_backup,omitempty"`
+ NoBackup *bool `protobuf:"varint,9,opt,name=no_backup,json=noBackup" json:"no_backup,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *ResetDevice) Reset() { *m = ResetDevice{} }
+func (m *ResetDevice) String() string { return proto.CompactTextString(m) }
+func (*ResetDevice) ProtoMessage() {}
+func (*ResetDevice) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{13}
+}
+
+func (m *ResetDevice) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_ResetDevice.Unmarshal(m, b)
+}
+func (m *ResetDevice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_ResetDevice.Marshal(b, m, deterministic)
+}
+func (m *ResetDevice) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_ResetDevice.Merge(m, src)
+}
+func (m *ResetDevice) XXX_Size() int {
+ return xxx_messageInfo_ResetDevice.Size(m)
+}
+func (m *ResetDevice) XXX_DiscardUnknown() {
+ xxx_messageInfo_ResetDevice.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_ResetDevice proto.InternalMessageInfo
+
+const Default_ResetDevice_Strength uint32 = 256
+const Default_ResetDevice_Language string = "english"
+
+func (m *ResetDevice) GetDisplayRandom() bool {
+ if m != nil && m.DisplayRandom != nil {
+ return *m.DisplayRandom
+ }
+ return false
+}
+
+func (m *ResetDevice) GetStrength() uint32 {
+ if m != nil && m.Strength != nil {
+ return *m.Strength
+ }
+ return Default_ResetDevice_Strength
+}
+
+func (m *ResetDevice) GetPassphraseProtection() bool {
+ if m != nil && m.PassphraseProtection != nil {
+ return *m.PassphraseProtection
+ }
+ return false
+}
+
+func (m *ResetDevice) GetPinProtection() bool {
+ if m != nil && m.PinProtection != nil {
+ return *m.PinProtection
+ }
+ return false
+}
+
+func (m *ResetDevice) GetLanguage() string {
+ if m != nil && m.Language != nil {
+ return *m.Language
+ }
+ return Default_ResetDevice_Language
+}
+
+func (m *ResetDevice) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
+ }
+ return ""
+}
+
+func (m *ResetDevice) GetU2FCounter() uint32 {
+ if m != nil && m.U2FCounter != nil {
+ return *m.U2FCounter
+ }
+ return 0
+}
+
+func (m *ResetDevice) GetSkipBackup() bool {
+ if m != nil && m.SkipBackup != nil {
+ return *m.SkipBackup
+ }
+ return false
+}
+
+func (m *ResetDevice) GetNoBackup() bool {
+ if m != nil && m.NoBackup != nil {
+ return *m.NoBackup
+ }
+ return false
+}
+
+//*
+// Request: Perform backup of the device seed if not backed up using ResetDevice
+// @start
+// @next Success
+type BackupDevice struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *BackupDevice) Reset() { *m = BackupDevice{} }
+func (m *BackupDevice) String() string { return proto.CompactTextString(m) }
+func (*BackupDevice) ProtoMessage() {}
+func (*BackupDevice) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{14}
+}
+
+func (m *BackupDevice) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_BackupDevice.Unmarshal(m, b)
+}
+func (m *BackupDevice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_BackupDevice.Marshal(b, m, deterministic)
+}
+func (m *BackupDevice) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_BackupDevice.Merge(m, src)
+}
+func (m *BackupDevice) XXX_Size() int {
+ return xxx_messageInfo_BackupDevice.Size(m)
+}
+func (m *BackupDevice) XXX_DiscardUnknown() {
+ xxx_messageInfo_BackupDevice.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_BackupDevice proto.InternalMessageInfo
+
+//*
+// Response: Ask for additional entropy from host computer
+// @next EntropyAck
+type EntropyRequest struct {
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EntropyRequest) Reset() { *m = EntropyRequest{} }
+func (m *EntropyRequest) String() string { return proto.CompactTextString(m) }
+func (*EntropyRequest) ProtoMessage() {}
+func (*EntropyRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{15}
+}
+
+func (m *EntropyRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EntropyRequest.Unmarshal(m, b)
+}
+func (m *EntropyRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EntropyRequest.Marshal(b, m, deterministic)
+}
+func (m *EntropyRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EntropyRequest.Merge(m, src)
+}
+func (m *EntropyRequest) XXX_Size() int {
+ return xxx_messageInfo_EntropyRequest.Size(m)
+}
+func (m *EntropyRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_EntropyRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EntropyRequest proto.InternalMessageInfo
+
+//*
+// Request: Provide additional entropy for seed generation function
+// @next Success
+type EntropyAck struct {
+ Entropy []byte `protobuf:"bytes,1,opt,name=entropy" json:"entropy,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *EntropyAck) Reset() { *m = EntropyAck{} }
+func (m *EntropyAck) String() string { return proto.CompactTextString(m) }
+func (*EntropyAck) ProtoMessage() {}
+func (*EntropyAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{16}
+}
+
+func (m *EntropyAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_EntropyAck.Unmarshal(m, b)
+}
+func (m *EntropyAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_EntropyAck.Marshal(b, m, deterministic)
+}
+func (m *EntropyAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_EntropyAck.Merge(m, src)
+}
+func (m *EntropyAck) XXX_Size() int {
+ return xxx_messageInfo_EntropyAck.Size(m)
+}
+func (m *EntropyAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_EntropyAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_EntropyAck proto.InternalMessageInfo
+
+func (m *EntropyAck) GetEntropy() []byte {
+ if m != nil {
+ return m.Entropy
+ }
+ return nil
+}
+
+//*
+// Request: Start recovery workflow asking user for specific words of mnemonic
+// Used to recovery device safely even on untrusted computer.
+// @start
+// @next WordRequest
+type RecoveryDevice struct {
+ WordCount *uint32 `protobuf:"varint,1,opt,name=word_count,json=wordCount" json:"word_count,omitempty"`
+ PassphraseProtection *bool `protobuf:"varint,2,opt,name=passphrase_protection,json=passphraseProtection" json:"passphrase_protection,omitempty"`
+ PinProtection *bool `protobuf:"varint,3,opt,name=pin_protection,json=pinProtection" json:"pin_protection,omitempty"`
+ Language *string `protobuf:"bytes,4,opt,name=language,def=english" json:"language,omitempty"`
+ Label *string `protobuf:"bytes,5,opt,name=label" json:"label,omitempty"`
+ EnforceWordlist *bool `protobuf:"varint,6,opt,name=enforce_wordlist,json=enforceWordlist" json:"enforce_wordlist,omitempty"`
+ // 7 reserved for unused recovery method
+ Type *RecoveryDevice_RecoveryDeviceType `protobuf:"varint,8,opt,name=type,enum=hw.trezor.messages.management.RecoveryDevice_RecoveryDeviceType" json:"type,omitempty"`
+ U2FCounter *uint32 `protobuf:"varint,9,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
+ DryRun *bool `protobuf:"varint,10,opt,name=dry_run,json=dryRun" json:"dry_run,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *RecoveryDevice) Reset() { *m = RecoveryDevice{} }
+func (m *RecoveryDevice) String() string { return proto.CompactTextString(m) }
+func (*RecoveryDevice) ProtoMessage() {}
+func (*RecoveryDevice) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{17}
+}
+
+func (m *RecoveryDevice) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_RecoveryDevice.Unmarshal(m, b)
+}
+func (m *RecoveryDevice) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_RecoveryDevice.Marshal(b, m, deterministic)
+}
+func (m *RecoveryDevice) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_RecoveryDevice.Merge(m, src)
+}
+func (m *RecoveryDevice) XXX_Size() int {
+ return xxx_messageInfo_RecoveryDevice.Size(m)
+}
+func (m *RecoveryDevice) XXX_DiscardUnknown() {
+ xxx_messageInfo_RecoveryDevice.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_RecoveryDevice proto.InternalMessageInfo
+
+const Default_RecoveryDevice_Language string = "english"
+
+func (m *RecoveryDevice) GetWordCount() uint32 {
+ if m != nil && m.WordCount != nil {
+ return *m.WordCount
+ }
+ return 0
+}
+
+func (m *RecoveryDevice) GetPassphraseProtection() bool {
+ if m != nil && m.PassphraseProtection != nil {
+ return *m.PassphraseProtection
+ }
+ return false
+}
+
+func (m *RecoveryDevice) GetPinProtection() bool {
+ if m != nil && m.PinProtection != nil {
+ return *m.PinProtection
+ }
+ return false
+}
+
+func (m *RecoveryDevice) GetLanguage() string {
+ if m != nil && m.Language != nil {
+ return *m.Language
+ }
+ return Default_RecoveryDevice_Language
+}
+
+func (m *RecoveryDevice) GetLabel() string {
+ if m != nil && m.Label != nil {
+ return *m.Label
+ }
+ return ""
+}
+
+func (m *RecoveryDevice) GetEnforceWordlist() bool {
+ if m != nil && m.EnforceWordlist != nil {
+ return *m.EnforceWordlist
+ }
+ return false
+}
+
+func (m *RecoveryDevice) GetType() RecoveryDevice_RecoveryDeviceType {
+ if m != nil && m.Type != nil {
+ return *m.Type
+ }
+ return RecoveryDevice_RecoveryDeviceType_ScrambledWords
+}
+
+func (m *RecoveryDevice) GetU2FCounter() uint32 {
+ if m != nil && m.U2FCounter != nil {
+ return *m.U2FCounter
+ }
+ return 0
+}
+
+func (m *RecoveryDevice) GetDryRun() bool {
+ if m != nil && m.DryRun != nil {
+ return *m.DryRun
+ }
+ return false
+}
+
+//*
+// Response: Device is waiting for user to enter word of the mnemonic
+// Its position is shown only on device's internal display.
+// @next WordAck
+type WordRequest struct {
+ Type *WordRequest_WordRequestType `protobuf:"varint,1,opt,name=type,enum=hw.trezor.messages.management.WordRequest_WordRequestType" json:"type,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *WordRequest) Reset() { *m = WordRequest{} }
+func (m *WordRequest) String() string { return proto.CompactTextString(m) }
+func (*WordRequest) ProtoMessage() {}
+func (*WordRequest) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{18}
+}
+
+func (m *WordRequest) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_WordRequest.Unmarshal(m, b)
+}
+func (m *WordRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_WordRequest.Marshal(b, m, deterministic)
+}
+func (m *WordRequest) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_WordRequest.Merge(m, src)
+}
+func (m *WordRequest) XXX_Size() int {
+ return xxx_messageInfo_WordRequest.Size(m)
+}
+func (m *WordRequest) XXX_DiscardUnknown() {
+ xxx_messageInfo_WordRequest.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_WordRequest proto.InternalMessageInfo
+
+func (m *WordRequest) GetType() WordRequest_WordRequestType {
+ if m != nil && m.Type != nil {
+ return *m.Type
+ }
+ return WordRequest_WordRequestType_Plain
+}
+
+//*
+// Request: Computer replies with word from the mnemonic
+// @next WordRequest
+// @next Success
+// @next Failure
+type WordAck struct {
+ Word *string `protobuf:"bytes,1,req,name=word" json:"word,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *WordAck) Reset() { *m = WordAck{} }
+func (m *WordAck) String() string { return proto.CompactTextString(m) }
+func (*WordAck) ProtoMessage() {}
+func (*WordAck) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{19}
+}
+
+func (m *WordAck) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_WordAck.Unmarshal(m, b)
+}
+func (m *WordAck) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_WordAck.Marshal(b, m, deterministic)
+}
+func (m *WordAck) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_WordAck.Merge(m, src)
+}
+func (m *WordAck) XXX_Size() int {
+ return xxx_messageInfo_WordAck.Size(m)
+}
+func (m *WordAck) XXX_DiscardUnknown() {
+ xxx_messageInfo_WordAck.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_WordAck proto.InternalMessageInfo
+
+func (m *WordAck) GetWord() string {
+ if m != nil && m.Word != nil {
+ return *m.Word
+ }
+ return ""
+}
+
+//*
+// Request: Set U2F counter
+// @start
+// @next Success
+type SetU2FCounter struct {
+ U2FCounter *uint32 `protobuf:"varint,1,opt,name=u2f_counter,json=u2fCounter" json:"u2f_counter,omitempty"`
+ XXX_NoUnkeyedLiteral struct{} `json:"-"`
+ XXX_unrecognized []byte `json:"-"`
+ XXX_sizecache int32 `json:"-"`
+}
+
+func (m *SetU2FCounter) Reset() { *m = SetU2FCounter{} }
+func (m *SetU2FCounter) String() string { return proto.CompactTextString(m) }
+func (*SetU2FCounter) ProtoMessage() {}
+func (*SetU2FCounter) Descriptor() ([]byte, []int) {
+ return fileDescriptor_0c720c20d27aa029, []int{20}
+}
+
+func (m *SetU2FCounter) XXX_Unmarshal(b []byte) error {
+ return xxx_messageInfo_SetU2FCounter.Unmarshal(m, b)
+}
+func (m *SetU2FCounter) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
+ return xxx_messageInfo_SetU2FCounter.Marshal(b, m, deterministic)
+}
+func (m *SetU2FCounter) XXX_Merge(src proto.Message) {
+ xxx_messageInfo_SetU2FCounter.Merge(m, src)
+}
+func (m *SetU2FCounter) XXX_Size() int {
+ return xxx_messageInfo_SetU2FCounter.Size(m)
+}
+func (m *SetU2FCounter) XXX_DiscardUnknown() {
+ xxx_messageInfo_SetU2FCounter.DiscardUnknown(m)
+}
+
+var xxx_messageInfo_SetU2FCounter proto.InternalMessageInfo
+
+func (m *SetU2FCounter) GetU2FCounter() uint32 {
+ if m != nil && m.U2FCounter != nil {
+ return *m.U2FCounter
+ }
+ return 0
+}
+
+func init() {
+ proto.RegisterEnum("hw.trezor.messages.management.ApplySettings_PassphraseSourceType", ApplySettings_PassphraseSourceType_name, ApplySettings_PassphraseSourceType_value)
+ proto.RegisterEnum("hw.trezor.messages.management.RecoveryDevice_RecoveryDeviceType", RecoveryDevice_RecoveryDeviceType_name, RecoveryDevice_RecoveryDeviceType_value)
+ proto.RegisterEnum("hw.trezor.messages.management.WordRequest_WordRequestType", WordRequest_WordRequestType_name, WordRequest_WordRequestType_value)
+ proto.RegisterType((*Initialize)(nil), "hw.trezor.messages.management.Initialize")
+ proto.RegisterType((*GetFeatures)(nil), "hw.trezor.messages.management.GetFeatures")
+ proto.RegisterType((*Features)(nil), "hw.trezor.messages.management.Features")
+ proto.RegisterType((*ClearSession)(nil), "hw.trezor.messages.management.ClearSession")
+ proto.RegisterType((*ApplySettings)(nil), "hw.trezor.messages.management.ApplySettings")
+ proto.RegisterType((*ApplyFlags)(nil), "hw.trezor.messages.management.ApplyFlags")
+ proto.RegisterType((*ChangePin)(nil), "hw.trezor.messages.management.ChangePin")
+ proto.RegisterType((*Ping)(nil), "hw.trezor.messages.management.Ping")
+ proto.RegisterType((*Cancel)(nil), "hw.trezor.messages.management.Cancel")
+ proto.RegisterType((*GetEntropy)(nil), "hw.trezor.messages.management.GetEntropy")
+ proto.RegisterType((*Entropy)(nil), "hw.trezor.messages.management.Entropy")
+ proto.RegisterType((*WipeDevice)(nil), "hw.trezor.messages.management.WipeDevice")
+ proto.RegisterType((*LoadDevice)(nil), "hw.trezor.messages.management.LoadDevice")
+ proto.RegisterType((*ResetDevice)(nil), "hw.trezor.messages.management.ResetDevice")
+ proto.RegisterType((*BackupDevice)(nil), "hw.trezor.messages.management.BackupDevice")
+ proto.RegisterType((*EntropyRequest)(nil), "hw.trezor.messages.management.EntropyRequest")
+ proto.RegisterType((*EntropyAck)(nil), "hw.trezor.messages.management.EntropyAck")
+ proto.RegisterType((*RecoveryDevice)(nil), "hw.trezor.messages.management.RecoveryDevice")
+ proto.RegisterType((*WordRequest)(nil), "hw.trezor.messages.management.WordRequest")
+ proto.RegisterType((*WordAck)(nil), "hw.trezor.messages.management.WordAck")
+ proto.RegisterType((*SetU2FCounter)(nil), "hw.trezor.messages.management.SetU2FCounter")
+}
+
+func init() { proto.RegisterFile("messages-management.proto", fileDescriptor_0c720c20d27aa029) }
+
+var fileDescriptor_0c720c20d27aa029 = []byte{
+ // 1393 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0xdd, 0x6e, 0xdb, 0xc8,
+ 0x15, 0x8e, 0x7e, 0x62, 0x49, 0xc7, 0xfa, 0xcb, 0xd4, 0x8e, 0xe9, 0xb8, 0x6e, 0x1c, 0xba, 0x6e,
+ 0x12, 0x04, 0x15, 0x0a, 0x17, 0x09, 0x90, 0x5c, 0x14, 0x75, 0xec, 0xfc, 0x21, 0x71, 0x6a, 0xd0,
+ 0x6e, 0x02, 0xf4, 0x86, 0x18, 0x91, 0x47, 0xd2, 0xd4, 0xe4, 0x0c, 0xcb, 0x19, 0xda, 0x55, 0x5e,
+ 0x60, 0x6f, 0xf6, 0x45, 0x16, 0xfb, 0x1c, 0x7b, 0xb5, 0xcf, 0xb0, 0xef, 0xb2, 0x98, 0x19, 0x52,
+ 0xa2, 0x65, 0x3b, 0x46, 0x76, 0xef, 0xe6, 0x7c, 0xe7, 0xe3, 0x68, 0xce, 0x77, 0xbe, 0x39, 0x63,
+ 0xc3, 0x7a, 0x8c, 0x52, 0xd2, 0x31, 0xca, 0xbf, 0xc6, 0x94, 0xd3, 0x31, 0xc6, 0xc8, 0xd5, 0x20,
+ 0x49, 0x85, 0x12, 0x64, 0x73, 0x72, 0x3e, 0x50, 0x29, 0x7e, 0x11, 0xe9, 0xa0, 0x20, 0x0d, 0xe6,
+ 0xa4, 0x7b, 0xab, 0xb3, 0x2f, 0x03, 0x11, 0xc7, 0x82, 0xdb, 0xaf, 0xdc, 0xf7, 0x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d, 0x00,
+ 0x00,
+}
diff --git a/accounts/usbwallet/trezor/messages-management.proto b/accounts/usbwallet/trezor/messages-management.proto
new file mode 100644
index 0000000000..0ab825a1bc
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages-management.proto
@@ -0,0 +1,289 @@
+// This file originates from the SatoshiLabs Trezor `common` repository at:
+// https://github.com/trezor/trezor-common/blob/master/protob/messages-management.proto
+// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
+
+syntax = "proto2";
+package hw.trezor.messages.management;
+
+// Sugar for easier handling in Java
+option java_package = "com.satoshilabs.trezor.lib.protobuf";
+option java_outer_classname = "TrezorMessageManagement";
+
+import "messages-common.proto";
+
+/**
+ * Request: Reset device to default state and ask for device details
+ * @start
+ * @next Features
+ */
+message Initialize {
+ optional bytes state = 1; // assumed device state, clear session if set and different
+ optional bool skip_passphrase = 2; // this session should always assume empty passphrase
+}
+
+/**
+ * Request: Ask for device details (no device reset)
+ * @start
+ * @next Features
+ */
+message GetFeatures {
+}
+
+/**
+ * Response: Reports various information about the device
+ * @end
+ */
+message Features {
+ optional string vendor = 1; // name of the manufacturer, e.g. "trezor.io"
+ optional uint32 major_version = 2; // major version of the firmware/bootloader, e.g. 1
+ optional uint32 minor_version = 3; // minor version of the firmware/bootloader, e.g. 0
+ optional uint32 patch_version = 4; // patch version of the firmware/bootloader, e.g. 0
+ optional bool bootloader_mode = 5; // is device in bootloader mode?
+ optional string device_id = 6; // device's unique identifier
+ optional bool pin_protection = 7; // is device protected by PIN?
+ optional bool passphrase_protection = 8; // is node/mnemonic encrypted using passphrase?
+ optional string language = 9; // device language
+ optional string label = 10; // device description label
+ optional bool initialized = 12; // does device contain seed?
+ optional bytes revision = 13; // SCM revision of firmware
+ optional bytes bootloader_hash = 14; // hash of the bootloader
+ optional bool imported = 15; // was storage imported from an external source?
+ optional bool pin_cached = 16; // is PIN already cached in session?
+ optional bool passphrase_cached = 17; // is passphrase already cached in session?
+ optional bool firmware_present = 18; // is valid firmware loaded?
+ optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
+ optional uint32 flags = 20; // device flags (equals to Storage.flags)
+ optional string model = 21; // device hardware model
+ optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
+ optional uint32 fw_minor = 23; // reported firmware version if in bootloader mode
+ optional uint32 fw_patch = 24; // reported firmware version if in bootloader mode
+ optional string fw_vendor = 25; // reported firmware vendor if in bootloader mode
+ optional bytes fw_vendor_keys = 26; // reported firmware vendor keys (their hash)
+ optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
+ optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
+}
+
+/**
+ * Request: clear session (removes cached PIN, passphrase, etc).
+ * @start
+ * @next Success
+ */
+message ClearSession {
+}
+
+/**
+ * Request: change language and/or label of the device
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message ApplySettings {
+ optional string language = 1;
+ optional string label = 2;
+ optional bool use_passphrase = 3;
+ optional bytes homescreen = 4;
+ optional PassphraseSourceType passphrase_source = 5;
+ optional uint32 auto_lock_delay_ms = 6;
+ optional uint32 display_rotation = 7; // in degrees from North
+ /**
+ * Structure representing passphrase source
+ */
+ enum PassphraseSourceType {
+ ASK = 0;
+ DEVICE = 1;
+ HOST = 2;
+ }
+}
+
+/**
+ * Request: set flags of the device
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message ApplyFlags {
+ optional uint32 flags = 1; // bitmask, can only set bits, not unset
+}
+
+/**
+ * Request: Starts workflow for setting/changing/removing the PIN
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message ChangePin {
+ optional bool remove = 1; // is PIN removal requested?
+}
+
+/**
+ * Request: Test if the device is alive, device sends back the message in Success response
+ * @start
+ * @next Success
+ */
+message Ping {
+ optional string message = 1; // message to send back in Success message
+ optional bool button_protection = 2; // ask for button press
+ optional bool pin_protection = 3; // ask for PIN if set in device
+ optional bool passphrase_protection = 4; // ask for passphrase if set in device
+}
+
+/**
+ * Request: Abort last operation that required user interaction
+ * @start
+ * @next Failure
+ */
+message Cancel {
+}
+
+/**
+ * Request: Request a sample of random data generated by hardware RNG. May be used for testing.
+ * @start
+ * @next Entropy
+ * @next Failure
+ */
+message GetEntropy {
+ required uint32 size = 1; // size of requested entropy
+}
+
+/**
+ * Response: Reply with random data generated by internal RNG
+ * @end
+ */
+message Entropy {
+ required bytes entropy = 1; // chunk of random generated bytes
+}
+
+/**
+ * Request: Request device to wipe all sensitive data and settings
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message WipeDevice {
+}
+
+/**
+ * Request: Load seed and related internal settings from the computer
+ * @start
+ * @next Success
+ * @next Failure
+ */
+message LoadDevice {
+ optional string mnemonic = 1; // seed encoded as BIP-39 mnemonic (12, 18 or 24 words)
+ optional hw.trezor.messages.common.HDNodeType node = 2; // BIP-32 node
+ optional string pin = 3; // set PIN protection
+ optional bool passphrase_protection = 4; // enable master node encryption using passphrase
+ optional string language = 5 [default='english']; // device language
+ optional string label = 6; // device label
+ optional bool skip_checksum = 7; // do not test mnemonic for valid BIP-39 checksum
+ optional uint32 u2f_counter = 8; // U2F counter
+}
+
+/**
+ * Request: Ask device to do initialization involving user interaction
+ * @start
+ * @next EntropyRequest
+ * @next Failure
+ */
+message ResetDevice {
+ optional bool display_random = 1; // display entropy generated by the device before asking for additional entropy
+ optional uint32 strength = 2 [default=256]; // strength of seed in bits
+ optional bool passphrase_protection = 3; // enable master node encryption using passphrase
+ optional bool pin_protection = 4; // enable PIN protection
+ optional string language = 5 [default='english']; // device language
+ optional string label = 6; // device label
+ optional uint32 u2f_counter = 7; // U2F counter
+ optional bool skip_backup = 8; // postpone seed backup to BackupDevice workflow
+ optional bool no_backup = 9; // indicate that no backup is going to be made
+}
+
+/**
+ * Request: Perform backup of the device seed if not backed up using ResetDevice
+ * @start
+ * @next Success
+ */
+message BackupDevice {
+}
+
+/**
+ * Response: Ask for additional entropy from host computer
+ * @next EntropyAck
+ */
+message EntropyRequest {
+}
+
+/**
+ * Request: Provide additional entropy for seed generation function
+ * @next Success
+ */
+message EntropyAck {
+ optional bytes entropy = 1; // 256 bits (32 bytes) of random data
+}
+
+/**
+ * Request: Start recovery workflow asking user for specific words of mnemonic
+ * Used to recovery device safely even on untrusted computer.
+ * @start
+ * @next WordRequest
+ */
+message RecoveryDevice {
+ optional uint32 word_count = 1; // number of words in BIP-39 mnemonic
+ optional bool passphrase_protection = 2; // enable master node encryption using passphrase
+ optional bool pin_protection = 3; // enable PIN protection
+ optional string language = 4 [default='english']; // device language
+ optional string label = 5; // device label
+ optional bool enforce_wordlist = 6; // enforce BIP-39 wordlist during the process
+ // 7 reserved for unused recovery method
+ optional RecoveryDeviceType type = 8; // supported recovery type
+ optional uint32 u2f_counter = 9; // U2F counter
+ optional bool dry_run = 10; // perform dry-run recovery workflow (for safe mnemonic validation)
+ /**
+ * Type of recovery procedure. These should be used as bitmask, e.g.,
+ * `RecoveryDeviceType_ScrambledWords | RecoveryDeviceType_Matrix`
+ * listing every method supported by the host computer.
+ *
+ * Note that ScrambledWords must be supported by every implementation
+ * for backward compatibility; there is no way to not support it.
+ */
+ enum RecoveryDeviceType {
+ // use powers of two when extending this field
+ RecoveryDeviceType_ScrambledWords = 0; // words in scrambled order
+ RecoveryDeviceType_Matrix = 1; // matrix recovery type
+ }
+}
+
+/**
+ * Response: Device is waiting for user to enter word of the mnemonic
+ * Its position is shown only on device's internal display.
+ * @next WordAck
+ */
+message WordRequest {
+ optional WordRequestType type = 1;
+ /**
+ * Type of Recovery Word request
+ */
+ enum WordRequestType {
+ WordRequestType_Plain = 0;
+ WordRequestType_Matrix9 = 1;
+ WordRequestType_Matrix6 = 2;
+ }
+}
+
+/**
+ * Request: Computer replies with word from the mnemonic
+ * @next WordRequest
+ * @next Success
+ * @next Failure
+ */
+message WordAck {
+ required string word = 1; // one word of mnemonic on asked position
+}
+
+/**
+ * Request: Set U2F counter
+ * @start
+ * @next Success
+ */
+message SetU2FCounter {
+ optional uint32 u2f_counter = 1; // counter
+}
diff --git a/accounts/usbwallet/trezor/messages.pb.go b/accounts/usbwallet/trezor/messages.pb.go
new file mode 100644
index 0000000000..6278bd8ee0
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages.pb.go
@@ -0,0 +1,889 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// source: messages.proto
+
+package trezor
+
+import (
+ fmt "fmt"
+ math "math"
+
+ proto "github.com/golang/protobuf/proto"
+ descriptor "github.com/golang/protobuf/protoc-gen-go/descriptor"
+)
+
+// Reference imports to suppress errors if they are not otherwise used.
+var _ = proto.Marshal
+var _ = fmt.Errorf
+var _ = math.Inf
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the proto package it is being compiled against.
+// A compilation error at this line likely means your copy of the
+// proto package needs to be updated.
+const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
+
+//*
+// Mapping between TREZOR wire identifier (uint) and a protobuf message
+type MessageType int32
+
+const (
+ // Management
+ MessageType_MessageType_Initialize MessageType = 0
+ MessageType_MessageType_Ping MessageType = 1
+ MessageType_MessageType_Success MessageType = 2
+ MessageType_MessageType_Failure MessageType = 3
+ MessageType_MessageType_ChangePin MessageType = 4
+ MessageType_MessageType_WipeDevice MessageType = 5
+ MessageType_MessageType_GetEntropy MessageType = 9
+ MessageType_MessageType_Entropy MessageType = 10
+ MessageType_MessageType_LoadDevice MessageType = 13
+ MessageType_MessageType_ResetDevice MessageType = 14
+ MessageType_MessageType_Features MessageType = 17
+ MessageType_MessageType_PinMatrixRequest MessageType = 18
+ MessageType_MessageType_PinMatrixAck MessageType = 19
+ MessageType_MessageType_Cancel MessageType = 20
+ MessageType_MessageType_ClearSession MessageType = 24
+ MessageType_MessageType_ApplySettings MessageType = 25
+ MessageType_MessageType_ButtonRequest MessageType = 26
+ MessageType_MessageType_ButtonAck MessageType = 27
+ MessageType_MessageType_ApplyFlags MessageType = 28
+ MessageType_MessageType_BackupDevice MessageType = 34
+ MessageType_MessageType_EntropyRequest MessageType = 35
+ MessageType_MessageType_EntropyAck MessageType = 36
+ MessageType_MessageType_PassphraseRequest MessageType = 41
+ MessageType_MessageType_PassphraseAck MessageType = 42
+ MessageType_MessageType_PassphraseStateRequest MessageType = 77
+ MessageType_MessageType_PassphraseStateAck MessageType = 78
+ MessageType_MessageType_RecoveryDevice MessageType = 45
+ MessageType_MessageType_WordRequest MessageType = 46
+ MessageType_MessageType_WordAck MessageType = 47
+ MessageType_MessageType_GetFeatures MessageType = 55
+ MessageType_MessageType_SetU2FCounter MessageType = 63
+ // Bootloader
+ MessageType_MessageType_FirmwareErase MessageType = 6
+ MessageType_MessageType_FirmwareUpload MessageType = 7
+ MessageType_MessageType_FirmwareRequest MessageType = 8
+ MessageType_MessageType_SelfTest MessageType = 32
+ // Bitcoin
+ MessageType_MessageType_GetPublicKey MessageType = 11
+ MessageType_MessageType_PublicKey MessageType = 12
+ MessageType_MessageType_SignTx MessageType = 15
+ MessageType_MessageType_TxRequest MessageType = 21
+ MessageType_MessageType_TxAck MessageType = 22
+ MessageType_MessageType_GetAddress MessageType = 29
+ MessageType_MessageType_Address MessageType = 30
+ MessageType_MessageType_SignMessage MessageType = 38
+ MessageType_MessageType_VerifyMessage MessageType = 39
+ MessageType_MessageType_MessageSignature MessageType = 40
+ // Crypto
+ MessageType_MessageType_CipherKeyValue MessageType = 23
+ MessageType_MessageType_CipheredKeyValue MessageType = 48
+ MessageType_MessageType_SignIdentity MessageType = 53
+ MessageType_MessageType_SignedIdentity MessageType = 54
+ MessageType_MessageType_GetECDHSessionKey MessageType = 61
+ MessageType_MessageType_ECDHSessionKey MessageType = 62
+ MessageType_MessageType_CosiCommit MessageType = 71
+ MessageType_MessageType_CosiCommitment MessageType = 72
+ MessageType_MessageType_CosiSign MessageType = 73
+ MessageType_MessageType_CosiSignature MessageType = 74
+ // Debug
+ MessageType_MessageType_DebugLinkDecision MessageType = 100
+ MessageType_MessageType_DebugLinkGetState MessageType = 101
+ MessageType_MessageType_DebugLinkState MessageType = 102
+ MessageType_MessageType_DebugLinkStop MessageType = 103
+ MessageType_MessageType_DebugLinkLog MessageType = 104
+ MessageType_MessageType_DebugLinkMemoryRead MessageType = 110
+ MessageType_MessageType_DebugLinkMemory MessageType = 111
+ MessageType_MessageType_DebugLinkMemoryWrite MessageType = 112
+ MessageType_MessageType_DebugLinkFlashErase MessageType = 113
+ // Ethereum
+ MessageType_MessageType_EthereumGetPublicKey MessageType = 450
+ MessageType_MessageType_EthereumPublicKey MessageType = 451
+ MessageType_MessageType_EthereumGetAddress MessageType = 56
+ MessageType_MessageType_EthereumAddress MessageType = 57
+ MessageType_MessageType_EthereumSignTx MessageType = 58
+ MessageType_MessageType_EthereumTxRequest MessageType = 59
+ MessageType_MessageType_EthereumTxAck MessageType = 60
+ MessageType_MessageType_EthereumSignMessage MessageType = 64
+ MessageType_MessageType_EthereumVerifyMessage MessageType = 65
+ MessageType_MessageType_EthereumMessageSignature MessageType = 66
+ // NEM
+ MessageType_MessageType_NEMGetAddress MessageType = 67
+ MessageType_MessageType_NEMAddress MessageType = 68
+ MessageType_MessageType_NEMSignTx MessageType = 69
+ MessageType_MessageType_NEMSignedTx MessageType = 70
+ MessageType_MessageType_NEMDecryptMessage MessageType = 75
+ MessageType_MessageType_NEMDecryptedMessage MessageType = 76
+ // Lisk
+ MessageType_MessageType_LiskGetAddress MessageType = 114
+ MessageType_MessageType_LiskAddress MessageType = 115
+ MessageType_MessageType_LiskSignTx MessageType = 116
+ MessageType_MessageType_LiskSignedTx MessageType = 117
+ MessageType_MessageType_LiskSignMessage MessageType = 118
+ MessageType_MessageType_LiskMessageSignature MessageType = 119
+ MessageType_MessageType_LiskVerifyMessage MessageType = 120
+ MessageType_MessageType_LiskGetPublicKey MessageType = 121
+ MessageType_MessageType_LiskPublicKey MessageType = 122
+ // Tezos
+ MessageType_MessageType_TezosGetAddress MessageType = 150
+ MessageType_MessageType_TezosAddress MessageType = 151
+ MessageType_MessageType_TezosSignTx MessageType = 152
+ MessageType_MessageType_TezosSignedTx MessageType = 153
+ MessageType_MessageType_TezosGetPublicKey MessageType = 154
+ MessageType_MessageType_TezosPublicKey MessageType = 155
+ // Stellar
+ MessageType_MessageType_StellarSignTx MessageType = 202
+ MessageType_MessageType_StellarTxOpRequest MessageType = 203
+ MessageType_MessageType_StellarGetAddress MessageType = 207
+ MessageType_MessageType_StellarAddress MessageType = 208
+ MessageType_MessageType_StellarCreateAccountOp MessageType = 210
+ MessageType_MessageType_StellarPaymentOp MessageType = 211
+ MessageType_MessageType_StellarPathPaymentOp MessageType = 212
+ MessageType_MessageType_StellarManageOfferOp MessageType = 213
+ MessageType_MessageType_StellarCreatePassiveOfferOp MessageType = 214
+ MessageType_MessageType_StellarSetOptionsOp MessageType = 215
+ MessageType_MessageType_StellarChangeTrustOp MessageType = 216
+ MessageType_MessageType_StellarAllowTrustOp MessageType = 217
+ MessageType_MessageType_StellarAccountMergeOp MessageType = 218
+ // omitted: StellarInflationOp is not a supported operation, would be 219
+ MessageType_MessageType_StellarManageDataOp MessageType = 220
+ MessageType_MessageType_StellarBumpSequenceOp MessageType = 221
+ MessageType_MessageType_StellarSignedTx MessageType = 230
+ // TRON
+ MessageType_MessageType_TronGetAddress MessageType = 250
+ MessageType_MessageType_TronAddress MessageType = 251
+ MessageType_MessageType_TronSignTx MessageType = 252
+ MessageType_MessageType_TronSignedTx MessageType = 253
+ // Cardano
+ // dropped Sign/VerifyMessage ids 300-302
+ MessageType_MessageType_CardanoSignTx MessageType = 303
+ MessageType_MessageType_CardanoTxRequest MessageType = 304
+ MessageType_MessageType_CardanoGetPublicKey MessageType = 305
+ MessageType_MessageType_CardanoPublicKey MessageType = 306
+ MessageType_MessageType_CardanoGetAddress MessageType = 307
+ MessageType_MessageType_CardanoAddress MessageType = 308
+ MessageType_MessageType_CardanoTxAck MessageType = 309
+ MessageType_MessageType_CardanoSignedTx MessageType = 310
+ // Ontology
+ MessageType_MessageType_OntologyGetAddress MessageType = 350
+ MessageType_MessageType_OntologyAddress MessageType = 351
+ MessageType_MessageType_OntologyGetPublicKey MessageType = 352
+ MessageType_MessageType_OntologyPublicKey MessageType = 353
+ MessageType_MessageType_OntologySignTransfer MessageType = 354
+ MessageType_MessageType_OntologySignedTransfer MessageType = 355
+ MessageType_MessageType_OntologySignWithdrawOng MessageType = 356
+ MessageType_MessageType_OntologySignedWithdrawOng MessageType = 357
+ MessageType_MessageType_OntologySignOntIdRegister MessageType = 358
+ MessageType_MessageType_OntologySignedOntIdRegister MessageType = 359
+ MessageType_MessageType_OntologySignOntIdAddAttributes MessageType = 360
+ MessageType_MessageType_OntologySignedOntIdAddAttributes MessageType = 361
+ // Ripple
+ MessageType_MessageType_RippleGetAddress MessageType = 400
+ MessageType_MessageType_RippleAddress MessageType = 401
+ MessageType_MessageType_RippleSignTx MessageType = 402
+ MessageType_MessageType_RippleSignedTx MessageType = 403
+ // Monero
+ MessageType_MessageType_MoneroTransactionInitRequest MessageType = 501
+ MessageType_MessageType_MoneroTransactionInitAck MessageType = 502
+ MessageType_MessageType_MoneroTransactionSetInputRequest MessageType = 503
+ MessageType_MessageType_MoneroTransactionSetInputAck MessageType = 504
+ MessageType_MessageType_MoneroTransactionInputsPermutationRequest MessageType = 505
+ MessageType_MessageType_MoneroTransactionInputsPermutationAck MessageType = 506
+ MessageType_MessageType_MoneroTransactionInputViniRequest MessageType = 507
+ MessageType_MessageType_MoneroTransactionInputViniAck MessageType = 508
+ MessageType_MessageType_MoneroTransactionAllInputsSetRequest MessageType = 509
+ MessageType_MessageType_MoneroTransactionAllInputsSetAck MessageType = 510
+ MessageType_MessageType_MoneroTransactionSetOutputRequest MessageType = 511
+ MessageType_MessageType_MoneroTransactionSetOutputAck MessageType = 512
+ MessageType_MessageType_MoneroTransactionAllOutSetRequest MessageType = 513
+ MessageType_MessageType_MoneroTransactionAllOutSetAck MessageType = 514
+ MessageType_MessageType_MoneroTransactionSignInputRequest MessageType = 515
+ MessageType_MessageType_MoneroTransactionSignInputAck MessageType = 516
+ MessageType_MessageType_MoneroTransactionFinalRequest MessageType = 517
+ MessageType_MessageType_MoneroTransactionFinalAck MessageType = 518
+ MessageType_MessageType_MoneroKeyImageExportInitRequest MessageType = 530
+ MessageType_MessageType_MoneroKeyImageExportInitAck MessageType = 531
+ MessageType_MessageType_MoneroKeyImageSyncStepRequest MessageType = 532
+ MessageType_MessageType_MoneroKeyImageSyncStepAck MessageType = 533
+ MessageType_MessageType_MoneroKeyImageSyncFinalRequest MessageType = 534
+ MessageType_MessageType_MoneroKeyImageSyncFinalAck MessageType = 535
+ MessageType_MessageType_MoneroGetAddress MessageType = 540
+ MessageType_MessageType_MoneroAddress MessageType = 541
+ MessageType_MessageType_MoneroGetWatchKey MessageType = 542
+ MessageType_MessageType_MoneroWatchKey MessageType = 543
+ MessageType_MessageType_DebugMoneroDiagRequest MessageType = 546
+ MessageType_MessageType_DebugMoneroDiagAck MessageType = 547
+ MessageType_MessageType_MoneroGetTxKeyRequest MessageType = 550
+ MessageType_MessageType_MoneroGetTxKeyAck MessageType = 551
+ MessageType_MessageType_MoneroLiveRefreshStartRequest MessageType = 552
+ MessageType_MessageType_MoneroLiveRefreshStartAck MessageType = 553
+ MessageType_MessageType_MoneroLiveRefreshStepRequest MessageType = 554
+ MessageType_MessageType_MoneroLiveRefreshStepAck MessageType = 555
+ MessageType_MessageType_MoneroLiveRefreshFinalRequest MessageType = 556
+ MessageType_MessageType_MoneroLiveRefreshFinalAck MessageType = 557
+ // EOS
+ MessageType_MessageType_EosGetPublicKey MessageType = 600
+ MessageType_MessageType_EosPublicKey MessageType = 601
+ MessageType_MessageType_EosSignTx MessageType = 602
+ MessageType_MessageType_EosTxActionRequest MessageType = 603
+ MessageType_MessageType_EosTxActionAck MessageType = 604
+ MessageType_MessageType_EosSignedTx MessageType = 605
+ // Binance
+ MessageType_MessageType_BinanceGetAddress MessageType = 700
+ MessageType_MessageType_BinanceAddress MessageType = 701
+ MessageType_MessageType_BinanceGetPublicKey MessageType = 702
+ MessageType_MessageType_BinancePublicKey MessageType = 703
+ MessageType_MessageType_BinanceSignTx MessageType = 704
+ MessageType_MessageType_BinanceTxRequest MessageType = 705
+ MessageType_MessageType_BinanceTransferMsg MessageType = 706
+ MessageType_MessageType_BinanceOrderMsg MessageType = 707
+ MessageType_MessageType_BinanceCancelMsg MessageType = 708
+ MessageType_MessageType_BinanceSignedTx MessageType = 709
+)
+
+var MessageType_name = map[int32]string{
+ 0: "MessageType_Initialize",
+ 1: "MessageType_Ping",
+ 2: "MessageType_Success",
+ 3: "MessageType_Failure",
+ 4: "MessageType_ChangePin",
+ 5: "MessageType_WipeDevice",
+ 9: "MessageType_GetEntropy",
+ 10: "MessageType_Entropy",
+ 13: "MessageType_LoadDevice",
+ 14: "MessageType_ResetDevice",
+ 17: "MessageType_Features",
+ 18: "MessageType_PinMatrixRequest",
+ 19: "MessageType_PinMatrixAck",
+ 20: "MessageType_Cancel",
+ 24: "MessageType_ClearSession",
+ 25: "MessageType_ApplySettings",
+ 26: "MessageType_ButtonRequest",
+ 27: "MessageType_ButtonAck",
+ 28: "MessageType_ApplyFlags",
+ 34: "MessageType_BackupDevice",
+ 35: "MessageType_EntropyRequest",
+ 36: "MessageType_EntropyAck",
+ 41: "MessageType_PassphraseRequest",
+ 42: "MessageType_PassphraseAck",
+ 77: "MessageType_PassphraseStateRequest",
+ 78: "MessageType_PassphraseStateAck",
+ 45: "MessageType_RecoveryDevice",
+ 46: "MessageType_WordRequest",
+ 47: "MessageType_WordAck",
+ 55: "MessageType_GetFeatures",
+ 63: "MessageType_SetU2FCounter",
+ 6: "MessageType_FirmwareErase",
+ 7: "MessageType_FirmwareUpload",
+ 8: "MessageType_FirmwareRequest",
+ 32: "MessageType_SelfTest",
+ 11: "MessageType_GetPublicKey",
+ 12: "MessageType_PublicKey",
+ 15: "MessageType_SignTx",
+ 21: "MessageType_TxRequest",
+ 22: "MessageType_TxAck",
+ 29: "MessageType_GetAddress",
+ 30: "MessageType_Address",
+ 38: "MessageType_SignMessage",
+ 39: "MessageType_VerifyMessage",
+ 40: "MessageType_MessageSignature",
+ 23: "MessageType_CipherKeyValue",
+ 48: "MessageType_CipheredKeyValue",
+ 53: "MessageType_SignIdentity",
+ 54: "MessageType_SignedIdentity",
+ 61: "MessageType_GetECDHSessionKey",
+ 62: "MessageType_ECDHSessionKey",
+ 71: "MessageType_CosiCommit",
+ 72: "MessageType_CosiCommitment",
+ 73: "MessageType_CosiSign",
+ 74: "MessageType_CosiSignature",
+ 100: "MessageType_DebugLinkDecision",
+ 101: "MessageType_DebugLinkGetState",
+ 102: "MessageType_DebugLinkState",
+ 103: "MessageType_DebugLinkStop",
+ 104: "MessageType_DebugLinkLog",
+ 110: "MessageType_DebugLinkMemoryRead",
+ 111: "MessageType_DebugLinkMemory",
+ 112: "MessageType_DebugLinkMemoryWrite",
+ 113: "MessageType_DebugLinkFlashErase",
+ 450: "MessageType_EthereumGetPublicKey",
+ 451: "MessageType_EthereumPublicKey",
+ 56: "MessageType_EthereumGetAddress",
+ 57: "MessageType_EthereumAddress",
+ 58: "MessageType_EthereumSignTx",
+ 59: "MessageType_EthereumTxRequest",
+ 60: "MessageType_EthereumTxAck",
+ 64: "MessageType_EthereumSignMessage",
+ 65: "MessageType_EthereumVerifyMessage",
+ 66: "MessageType_EthereumMessageSignature",
+ 67: "MessageType_NEMGetAddress",
+ 68: "MessageType_NEMAddress",
+ 69: "MessageType_NEMSignTx",
+ 70: "MessageType_NEMSignedTx",
+ 75: "MessageType_NEMDecryptMessage",
+ 76: "MessageType_NEMDecryptedMessage",
+ 114: "MessageType_LiskGetAddress",
+ 115: "MessageType_LiskAddress",
+ 116: "MessageType_LiskSignTx",
+ 117: "MessageType_LiskSignedTx",
+ 118: "MessageType_LiskSignMessage",
+ 119: "MessageType_LiskMessageSignature",
+ 120: "MessageType_LiskVerifyMessage",
+ 121: "MessageType_LiskGetPublicKey",
+ 122: "MessageType_LiskPublicKey",
+ 150: "MessageType_TezosGetAddress",
+ 151: "MessageType_TezosAddress",
+ 152: "MessageType_TezosSignTx",
+ 153: "MessageType_TezosSignedTx",
+ 154: "MessageType_TezosGetPublicKey",
+ 155: "MessageType_TezosPublicKey",
+ 202: "MessageType_StellarSignTx",
+ 203: "MessageType_StellarTxOpRequest",
+ 207: "MessageType_StellarGetAddress",
+ 208: "MessageType_StellarAddress",
+ 210: "MessageType_StellarCreateAccountOp",
+ 211: "MessageType_StellarPaymentOp",
+ 212: "MessageType_StellarPathPaymentOp",
+ 213: "MessageType_StellarManageOfferOp",
+ 214: "MessageType_StellarCreatePassiveOfferOp",
+ 215: "MessageType_StellarSetOptionsOp",
+ 216: "MessageType_StellarChangeTrustOp",
+ 217: "MessageType_StellarAllowTrustOp",
+ 218: "MessageType_StellarAccountMergeOp",
+ 220: "MessageType_StellarManageDataOp",
+ 221: "MessageType_StellarBumpSequenceOp",
+ 230: "MessageType_StellarSignedTx",
+ 250: "MessageType_TronGetAddress",
+ 251: "MessageType_TronAddress",
+ 252: "MessageType_TronSignTx",
+ 253: "MessageType_TronSignedTx",
+ 303: "MessageType_CardanoSignTx",
+ 304: "MessageType_CardanoTxRequest",
+ 305: "MessageType_CardanoGetPublicKey",
+ 306: "MessageType_CardanoPublicKey",
+ 307: "MessageType_CardanoGetAddress",
+ 308: "MessageType_CardanoAddress",
+ 309: "MessageType_CardanoTxAck",
+ 310: "MessageType_CardanoSignedTx",
+ 350: "MessageType_OntologyGetAddress",
+ 351: "MessageType_OntologyAddress",
+ 352: "MessageType_OntologyGetPublicKey",
+ 353: "MessageType_OntologyPublicKey",
+ 354: "MessageType_OntologySignTransfer",
+ 355: "MessageType_OntologySignedTransfer",
+ 356: "MessageType_OntologySignWithdrawOng",
+ 357: "MessageType_OntologySignedWithdrawOng",
+ 358: "MessageType_OntologySignOntIdRegister",
+ 359: "MessageType_OntologySignedOntIdRegister",
+ 360: "MessageType_OntologySignOntIdAddAttributes",
+ 361: "MessageType_OntologySignedOntIdAddAttributes",
+ 400: "MessageType_RippleGetAddress",
+ 401: "MessageType_RippleAddress",
+ 402: "MessageType_RippleSignTx",
+ 403: "MessageType_RippleSignedTx",
+ 501: "MessageType_MoneroTransactionInitRequest",
+ 502: "MessageType_MoneroTransactionInitAck",
+ 503: "MessageType_MoneroTransactionSetInputRequest",
+ 504: "MessageType_MoneroTransactionSetInputAck",
+ 505: "MessageType_MoneroTransactionInputsPermutationRequest",
+ 506: "MessageType_MoneroTransactionInputsPermutationAck",
+ 507: "MessageType_MoneroTransactionInputViniRequest",
+ 508: "MessageType_MoneroTransactionInputViniAck",
+ 509: "MessageType_MoneroTransactionAllInputsSetRequest",
+ 510: "MessageType_MoneroTransactionAllInputsSetAck",
+ 511: "MessageType_MoneroTransactionSetOutputRequest",
+ 512: "MessageType_MoneroTransactionSetOutputAck",
+ 513: "MessageType_MoneroTransactionAllOutSetRequest",
+ 514: "MessageType_MoneroTransactionAllOutSetAck",
+ 515: "MessageType_MoneroTransactionSignInputRequest",
+ 516: "MessageType_MoneroTransactionSignInputAck",
+ 517: "MessageType_MoneroTransactionFinalRequest",
+ 518: "MessageType_MoneroTransactionFinalAck",
+ 530: "MessageType_MoneroKeyImageExportInitRequest",
+ 531: "MessageType_MoneroKeyImageExportInitAck",
+ 532: "MessageType_MoneroKeyImageSyncStepRequest",
+ 533: "MessageType_MoneroKeyImageSyncStepAck",
+ 534: "MessageType_MoneroKeyImageSyncFinalRequest",
+ 535: "MessageType_MoneroKeyImageSyncFinalAck",
+ 540: "MessageType_MoneroGetAddress",
+ 541: "MessageType_MoneroAddress",
+ 542: "MessageType_MoneroGetWatchKey",
+ 543: "MessageType_MoneroWatchKey",
+ 546: "MessageType_DebugMoneroDiagRequest",
+ 547: "MessageType_DebugMoneroDiagAck",
+ 550: "MessageType_MoneroGetTxKeyRequest",
+ 551: "MessageType_MoneroGetTxKeyAck",
+ 552: "MessageType_MoneroLiveRefreshStartRequest",
+ 553: "MessageType_MoneroLiveRefreshStartAck",
+ 554: "MessageType_MoneroLiveRefreshStepRequest",
+ 555: "MessageType_MoneroLiveRefreshStepAck",
+ 556: "MessageType_MoneroLiveRefreshFinalRequest",
+ 557: "MessageType_MoneroLiveRefreshFinalAck",
+ 600: "MessageType_EosGetPublicKey",
+ 601: "MessageType_EosPublicKey",
+ 602: "MessageType_EosSignTx",
+ 603: "MessageType_EosTxActionRequest",
+ 604: "MessageType_EosTxActionAck",
+ 605: "MessageType_EosSignedTx",
+ 700: "MessageType_BinanceGetAddress",
+ 701: "MessageType_BinanceAddress",
+ 702: "MessageType_BinanceGetPublicKey",
+ 703: "MessageType_BinancePublicKey",
+ 704: "MessageType_BinanceSignTx",
+ 705: "MessageType_BinanceTxRequest",
+ 706: "MessageType_BinanceTransferMsg",
+ 707: "MessageType_BinanceOrderMsg",
+ 708: "MessageType_BinanceCancelMsg",
+ 709: "MessageType_BinanceSignedTx",
+}
+
+var MessageType_value = map[string]int32{
+ "MessageType_Initialize": 0,
+ "MessageType_Ping": 1,
+ "MessageType_Success": 2,
+ "MessageType_Failure": 3,
+ "MessageType_ChangePin": 4,
+ "MessageType_WipeDevice": 5,
+ "MessageType_GetEntropy": 9,
+ "MessageType_Entropy": 10,
+ "MessageType_LoadDevice": 13,
+ "MessageType_ResetDevice": 14,
+ "MessageType_Features": 17,
+ "MessageType_PinMatrixRequest": 18,
+ "MessageType_PinMatrixAck": 19,
+ "MessageType_Cancel": 20,
+ "MessageType_ClearSession": 24,
+ "MessageType_ApplySettings": 25,
+ "MessageType_ButtonRequest": 26,
+ "MessageType_ButtonAck": 27,
+ "MessageType_ApplyFlags": 28,
+ "MessageType_BackupDevice": 34,
+ "MessageType_EntropyRequest": 35,
+ "MessageType_EntropyAck": 36,
+ "MessageType_PassphraseRequest": 41,
+ "MessageType_PassphraseAck": 42,
+ "MessageType_PassphraseStateRequest": 77,
+ "MessageType_PassphraseStateAck": 78,
+ "MessageType_RecoveryDevice": 45,
+ "MessageType_WordRequest": 46,
+ "MessageType_WordAck": 47,
+ "MessageType_GetFeatures": 55,
+ "MessageType_SetU2FCounter": 63,
+ "MessageType_FirmwareErase": 6,
+ "MessageType_FirmwareUpload": 7,
+ "MessageType_FirmwareRequest": 8,
+ "MessageType_SelfTest": 32,
+ "MessageType_GetPublicKey": 11,
+ "MessageType_PublicKey": 12,
+ "MessageType_SignTx": 15,
+ "MessageType_TxRequest": 21,
+ "MessageType_TxAck": 22,
+ "MessageType_GetAddress": 29,
+ "MessageType_Address": 30,
+ "MessageType_SignMessage": 38,
+ "MessageType_VerifyMessage": 39,
+ "MessageType_MessageSignature": 40,
+ "MessageType_CipherKeyValue": 23,
+ "MessageType_CipheredKeyValue": 48,
+ "MessageType_SignIdentity": 53,
+ "MessageType_SignedIdentity": 54,
+ "MessageType_GetECDHSessionKey": 61,
+ "MessageType_ECDHSessionKey": 62,
+ "MessageType_CosiCommit": 71,
+ "MessageType_CosiCommitment": 72,
+ "MessageType_CosiSign": 73,
+ "MessageType_CosiSignature": 74,
+ "MessageType_DebugLinkDecision": 100,
+ "MessageType_DebugLinkGetState": 101,
+ "MessageType_DebugLinkState": 102,
+ "MessageType_DebugLinkStop": 103,
+ "MessageType_DebugLinkLog": 104,
+ "MessageType_DebugLinkMemoryRead": 110,
+ "MessageType_DebugLinkMemory": 111,
+ "MessageType_DebugLinkMemoryWrite": 112,
+ "MessageType_DebugLinkFlashErase": 113,
+ "MessageType_EthereumGetPublicKey": 450,
+ "MessageType_EthereumPublicKey": 451,
+ "MessageType_EthereumGetAddress": 56,
+ "MessageType_EthereumAddress": 57,
+ "MessageType_EthereumSignTx": 58,
+ "MessageType_EthereumTxRequest": 59,
+ "MessageType_EthereumTxAck": 60,
+ "MessageType_EthereumSignMessage": 64,
+ "MessageType_EthereumVerifyMessage": 65,
+ "MessageType_EthereumMessageSignature": 66,
+ "MessageType_NEMGetAddress": 67,
+ "MessageType_NEMAddress": 68,
+ "MessageType_NEMSignTx": 69,
+ "MessageType_NEMSignedTx": 70,
+ "MessageType_NEMDecryptMessage": 75,
+ "MessageType_NEMDecryptedMessage": 76,
+ "MessageType_LiskGetAddress": 114,
+ "MessageType_LiskAddress": 115,
+ "MessageType_LiskSignTx": 116,
+ "MessageType_LiskSignedTx": 117,
+ "MessageType_LiskSignMessage": 118,
+ "MessageType_LiskMessageSignature": 119,
+ "MessageType_LiskVerifyMessage": 120,
+ "MessageType_LiskGetPublicKey": 121,
+ "MessageType_LiskPublicKey": 122,
+ "MessageType_TezosGetAddress": 150,
+ "MessageType_TezosAddress": 151,
+ "MessageType_TezosSignTx": 152,
+ "MessageType_TezosSignedTx": 153,
+ "MessageType_TezosGetPublicKey": 154,
+ "MessageType_TezosPublicKey": 155,
+ "MessageType_StellarSignTx": 202,
+ "MessageType_StellarTxOpRequest": 203,
+ "MessageType_StellarGetAddress": 207,
+ "MessageType_StellarAddress": 208,
+ "MessageType_StellarCreateAccountOp": 210,
+ "MessageType_StellarPaymentOp": 211,
+ "MessageType_StellarPathPaymentOp": 212,
+ "MessageType_StellarManageOfferOp": 213,
+ "MessageType_StellarCreatePassiveOfferOp": 214,
+ "MessageType_StellarSetOptionsOp": 215,
+ "MessageType_StellarChangeTrustOp": 216,
+ "MessageType_StellarAllowTrustOp": 217,
+ "MessageType_StellarAccountMergeOp": 218,
+ "MessageType_StellarManageDataOp": 220,
+ "MessageType_StellarBumpSequenceOp": 221,
+ "MessageType_StellarSignedTx": 230,
+ "MessageType_TronGetAddress": 250,
+ "MessageType_TronAddress": 251,
+ "MessageType_TronSignTx": 252,
+ "MessageType_TronSignedTx": 253,
+ "MessageType_CardanoSignTx": 303,
+ "MessageType_CardanoTxRequest": 304,
+ "MessageType_CardanoGetPublicKey": 305,
+ "MessageType_CardanoPublicKey": 306,
+ "MessageType_CardanoGetAddress": 307,
+ "MessageType_CardanoAddress": 308,
+ "MessageType_CardanoTxAck": 309,
+ "MessageType_CardanoSignedTx": 310,
+ "MessageType_OntologyGetAddress": 350,
+ "MessageType_OntologyAddress": 351,
+ "MessageType_OntologyGetPublicKey": 352,
+ "MessageType_OntologyPublicKey": 353,
+ "MessageType_OntologySignTransfer": 354,
+ "MessageType_OntologySignedTransfer": 355,
+ "MessageType_OntologySignWithdrawOng": 356,
+ "MessageType_OntologySignedWithdrawOng": 357,
+ "MessageType_OntologySignOntIdRegister": 358,
+ "MessageType_OntologySignedOntIdRegister": 359,
+ "MessageType_OntologySignOntIdAddAttributes": 360,
+ "MessageType_OntologySignedOntIdAddAttributes": 361,
+ "MessageType_RippleGetAddress": 400,
+ "MessageType_RippleAddress": 401,
+ "MessageType_RippleSignTx": 402,
+ "MessageType_RippleSignedTx": 403,
+ "MessageType_MoneroTransactionInitRequest": 501,
+ "MessageType_MoneroTransactionInitAck": 502,
+ "MessageType_MoneroTransactionSetInputRequest": 503,
+ "MessageType_MoneroTransactionSetInputAck": 504,
+ "MessageType_MoneroTransactionInputsPermutationRequest": 505,
+ "MessageType_MoneroTransactionInputsPermutationAck": 506,
+ "MessageType_MoneroTransactionInputViniRequest": 507,
+ "MessageType_MoneroTransactionInputViniAck": 508,
+ "MessageType_MoneroTransactionAllInputsSetRequest": 509,
+ "MessageType_MoneroTransactionAllInputsSetAck": 510,
+ "MessageType_MoneroTransactionSetOutputRequest": 511,
+ "MessageType_MoneroTransactionSetOutputAck": 512,
+ "MessageType_MoneroTransactionAllOutSetRequest": 513,
+ "MessageType_MoneroTransactionAllOutSetAck": 514,
+ "MessageType_MoneroTransactionSignInputRequest": 515,
+ "MessageType_MoneroTransactionSignInputAck": 516,
+ "MessageType_MoneroTransactionFinalRequest": 517,
+ "MessageType_MoneroTransactionFinalAck": 518,
+ "MessageType_MoneroKeyImageExportInitRequest": 530,
+ "MessageType_MoneroKeyImageExportInitAck": 531,
+ "MessageType_MoneroKeyImageSyncStepRequest": 532,
+ "MessageType_MoneroKeyImageSyncStepAck": 533,
+ "MessageType_MoneroKeyImageSyncFinalRequest": 534,
+ "MessageType_MoneroKeyImageSyncFinalAck": 535,
+ "MessageType_MoneroGetAddress": 540,
+ "MessageType_MoneroAddress": 541,
+ "MessageType_MoneroGetWatchKey": 542,
+ "MessageType_MoneroWatchKey": 543,
+ "MessageType_DebugMoneroDiagRequest": 546,
+ "MessageType_DebugMoneroDiagAck": 547,
+ "MessageType_MoneroGetTxKeyRequest": 550,
+ "MessageType_MoneroGetTxKeyAck": 551,
+ "MessageType_MoneroLiveRefreshStartRequest": 552,
+ "MessageType_MoneroLiveRefreshStartAck": 553,
+ "MessageType_MoneroLiveRefreshStepRequest": 554,
+ "MessageType_MoneroLiveRefreshStepAck": 555,
+ "MessageType_MoneroLiveRefreshFinalRequest": 556,
+ "MessageType_MoneroLiveRefreshFinalAck": 557,
+ "MessageType_EosGetPublicKey": 600,
+ "MessageType_EosPublicKey": 601,
+ "MessageType_EosSignTx": 602,
+ "MessageType_EosTxActionRequest": 603,
+ "MessageType_EosTxActionAck": 604,
+ "MessageType_EosSignedTx": 605,
+ "MessageType_BinanceGetAddress": 700,
+ "MessageType_BinanceAddress": 701,
+ "MessageType_BinanceGetPublicKey": 702,
+ "MessageType_BinancePublicKey": 703,
+ "MessageType_BinanceSignTx": 704,
+ "MessageType_BinanceTxRequest": 705,
+ "MessageType_BinanceTransferMsg": 706,
+ "MessageType_BinanceOrderMsg": 707,
+ "MessageType_BinanceCancelMsg": 708,
+ "MessageType_BinanceSignedTx": 709,
+}
+
+func (x MessageType) Enum() *MessageType {
+ p := new(MessageType)
+ *p = x
+ return p
+}
+
+func (x MessageType) String() string {
+ return proto.EnumName(MessageType_name, int32(x))
+}
+
+func (x *MessageType) UnmarshalJSON(data []byte) error {
+ value, err := proto.UnmarshalJSONEnum(MessageType_value, data, "MessageType")
+ if err != nil {
+ return err
+ }
+ *x = MessageType(value)
+ return nil
+}
+
+func (MessageType) EnumDescriptor() ([]byte, []int) {
+ return fileDescriptor_4dc296cbfe5ffcd5, []int{0}
+}
+
+var E_WireIn = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50002,
+ Name: "hw.trezor.messages.wire_in",
+ Tag: "varint,50002,opt,name=wire_in",
+ Filename: "messages.proto",
+}
+
+var E_WireOut = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50003,
+ Name: "hw.trezor.messages.wire_out",
+ Tag: "varint,50003,opt,name=wire_out",
+ Filename: "messages.proto",
+}
+
+var E_WireDebugIn = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50004,
+ Name: "hw.trezor.messages.wire_debug_in",
+ Tag: "varint,50004,opt,name=wire_debug_in",
+ Filename: "messages.proto",
+}
+
+var E_WireDebugOut = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50005,
+ Name: "hw.trezor.messages.wire_debug_out",
+ Tag: "varint,50005,opt,name=wire_debug_out",
+ Filename: "messages.proto",
+}
+
+var E_WireTiny = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50006,
+ Name: "hw.trezor.messages.wire_tiny",
+ Tag: "varint,50006,opt,name=wire_tiny",
+ Filename: "messages.proto",
+}
+
+var E_WireBootloader = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50007,
+ Name: "hw.trezor.messages.wire_bootloader",
+ Tag: "varint,50007,opt,name=wire_bootloader",
+ Filename: "messages.proto",
+}
+
+var E_WireNoFsm = &proto.ExtensionDesc{
+ ExtendedType: (*descriptor.EnumValueOptions)(nil),
+ ExtensionType: (*bool)(nil),
+ Field: 50008,
+ Name: "hw.trezor.messages.wire_no_fsm",
+ Tag: "varint,50008,opt,name=wire_no_fsm",
+ Filename: "messages.proto",
+}
+
+func init() {
+ proto.RegisterEnum("hw.trezor.messages.MessageType", MessageType_name, MessageType_value)
+ proto.RegisterExtension(E_WireIn)
+ proto.RegisterExtension(E_WireOut)
+ proto.RegisterExtension(E_WireDebugIn)
+ proto.RegisterExtension(E_WireDebugOut)
+ proto.RegisterExtension(E_WireTiny)
+ proto.RegisterExtension(E_WireBootloader)
+ proto.RegisterExtension(E_WireNoFsm)
+}
+
+func init() { proto.RegisterFile("messages.proto", fileDescriptor_4dc296cbfe5ffcd5) }
+
+var fileDescriptor_4dc296cbfe5ffcd5 = []byte{
+ // 2430 bytes of a gzipped FileDescriptorProto
+ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x9a, 0xd9, 0x73, 0x1c, 0xc5,
+ 0x1d, 0xc7, 0xb3, 0xab, 0x11, 0x88, 0xf6, 0x41, 0x23, 0xb0, 0x2d, 0xaf, 0x2f, 0xf9, 0xc0, 0x96,
+ 0x2f, 0xd9, 0x10, 0x0c, 0x44, 0x38, 0x60, 0x69, 0xb5, 0x12, 0x8a, 0xb5, 0x5a, 0x97, 0x76, 0xb1,
+ 0x1f, 0x5d, 0xa3, 0x9d, 0xd6, 0x6e, 0x97, 0x67, 0x67, 0x86, 0x9e, 0x1e, 0x49, 0xeb, 0xa7, 0x9c,
+ 0x3c, 0x13, 0x48, 0xc0, 0xb9, 0xa9, 0xa4, 0x2a, 0x21, 0x57, 0x85, 0x1c, 0x4e, 0x25, 0x55, 0x39,
+ 0x08, 0x24, 0x2f, 0xc9, 0x43, 0x52, 0x9c, 0x86, 0x40, 0xee, 0x90, 0xe4, 0x0f, 0xc8, 0xc5, 0x91,
+ 0xa4, 0x7a, 0xa6, 0xbb, 0xe7, 0xd8, 0xdf, 0xae, 0x36, 0x6f, 0x58, 0xf3, 0xf9, 0x7d, 0x7f, 0x47,
+ 0xff, 0xfa, 0x37, 0xdd, 0xb3, 0xa0, 0xcd, 0x2d, 0xe2, 0xfb, 0x66, 0x83, 0xf8, 0xe3, 0x1e, 0x73,
+ 0xb9, 0x3b, 0x3c, 0xdc, 0x5c, 0x1d, 0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+ 0x14, 0x5a, 0xbb, 0x01, 0xef, 0xc7, 0xfc, 0x79, 0x69, 0x1e, 0xba, 0xac, 0x04, 0x7c, 0x62, 0x16,
+ 0x6d, 0x0a, 0xed, 0x2d, 0x31, 0xad, 0xfa, 0x8c, 0xe1, 0x05, 0x29, 0xb2, 0x41, 0x58, 0x86, 0x63,
+ 0x6e, 0xce, 0x99, 0x98, 0x43, 0x9b, 0x13, 0x42, 0x7d, 0x86, 0xf3, 0xa2, 0x54, 0xda, 0xa8, 0x95,
+ 0x44, 0x4c, 0x67, 0xd0, 0x0d, 0xa1, 0x14, 0xa7, 0x4e, 0xbb, 0x1f, 0x95, 0x97, 0xa4, 0x4a, 0x58,
+ 0x89, 0x1a, 0x75, 0xda, 0x13, 0xf3, 0xe8, 0xc6, 0x50, 0x61, 0xc9, 0x75, 0xb9, 0xed, 0x9a, 0x16,
+ 0x61, 0xfd, 0xe8, 0xbc, 0x2c, 0x75, 0xc2, 0x44, 0xa6, 0xb4, 0xe9, 0x44, 0x11, 0x85, 0x99, 0x5e,
+ 0x74, 0xdc, 0x8b, 0xcb, 0x7e, 0xab, 0x1f, 0xa5, 0x6b, 0x52, 0x29, 0xcc, 0x63, 0xc1, 0x9d, 0xf1,
+ 0x5b, 0x53, 0x77, 0xa0, 0xfd, 0x75, 0xb7, 0x35, 0xee, 0x9b, 0xdc, 0xf5, 0x9b, 0xd4, 0x36, 0x97,
+ 0x7c, 0xf5, 0xff, 0x79, 0xd8, 0x74, 0x49, 0x4b, 0x4d, 0x6d, 0xaa, 0x85, 0x7f, 0x94, 0x9d, 0xf3,
+ 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x69, 0x67, 0x5d, 0x1f, 0x22, 0x00, 0x00,
+}
diff --git a/accounts/usbwallet/trezor/messages.proto b/accounts/usbwallet/trezor/messages.proto
new file mode 100644
index 0000000000..3e0482e344
--- /dev/null
+++ b/accounts/usbwallet/trezor/messages.proto
@@ -0,0 +1,264 @@
+// This file originates from the SatoshiLabs Trezor `common` repository at:
+// https://github.com/trezor/trezor-common/blob/master/protob/messages.proto
+// dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
+
+syntax = "proto2";
+package hw.trezor.messages;
+
+/**
+ * Messages for TREZOR communication
+ */
+
+// Sugar for easier handling in Java
+option java_package = "com.satoshilabs.trezor.lib.protobuf";
+option java_outer_classname = "TrezorMessage";
+
+import "google/protobuf/descriptor.proto";
+
+/**
+ * Options for specifying message direction and type of wire (normal/debug)
+ */
+extend google.protobuf.EnumValueOptions {
+ optional bool wire_in = 50002; // message can be transmitted via wire from PC to TREZOR
+ optional bool wire_out = 50003; // message can be transmitted via wire from TREZOR to PC
+ optional bool wire_debug_in = 50004; // message can be transmitted via debug wire from PC to TREZOR
+ optional bool wire_debug_out = 50005; // message can be transmitted via debug wire from TREZOR to PC
+ optional bool wire_tiny = 50006; // message is handled by TREZOR when the USB stack is in tiny mode
+ optional bool wire_bootloader = 50007; // message is only handled by TREZOR Bootloader
+ optional bool wire_no_fsm = 50008; // message is not handled by TREZOR unless the USB stack is in tiny mode
+}
+
+/**
+ * Mapping between TREZOR wire identifier (uint) and a protobuf message
+ */
+enum MessageType {
+
+ // Management
+ MessageType_Initialize = 0 [(wire_in) = true, (wire_tiny) = true];
+ MessageType_Ping = 1 [(wire_in) = true];
+ MessageType_Success = 2 [(wire_out) = true];
+ MessageType_Failure = 3 [(wire_out) = true];
+ MessageType_ChangePin = 4 [(wire_in) = true];
+ MessageType_WipeDevice = 5 [(wire_in) = true];
+ MessageType_GetEntropy = 9 [(wire_in) = true];
+ MessageType_Entropy = 10 [(wire_out) = true];
+ MessageType_LoadDevice = 13 [(wire_in) = true];
+ MessageType_ResetDevice = 14 [(wire_in) = true];
+ MessageType_Features = 17 [(wire_out) = true];
+ MessageType_PinMatrixRequest = 18 [(wire_out) = true];
+ MessageType_PinMatrixAck = 19 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
+ MessageType_Cancel = 20 [(wire_in) = true, (wire_tiny) = true];
+ MessageType_ClearSession = 24 [(wire_in) = true];
+ MessageType_ApplySettings = 25 [(wire_in) = true];
+ MessageType_ButtonRequest = 26 [(wire_out) = true];
+ MessageType_ButtonAck = 27 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
+ MessageType_ApplyFlags = 28 [(wire_in) = true];
+ MessageType_BackupDevice = 34 [(wire_in) = true];
+ MessageType_EntropyRequest = 35 [(wire_out) = true];
+ MessageType_EntropyAck = 36 [(wire_in) = true];
+ MessageType_PassphraseRequest = 41 [(wire_out) = true];
+ MessageType_PassphraseAck = 42 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
+ MessageType_PassphraseStateRequest = 77 [(wire_out) = true];
+ MessageType_PassphraseStateAck = 78 [(wire_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
+ MessageType_RecoveryDevice = 45 [(wire_in) = true];
+ MessageType_WordRequest = 46 [(wire_out) = true];
+ MessageType_WordAck = 47 [(wire_in) = true];
+ MessageType_GetFeatures = 55 [(wire_in) = true];
+ MessageType_SetU2FCounter = 63 [(wire_in) = true];
+
+ // Bootloader
+ MessageType_FirmwareErase = 6 [(wire_in) = true, (wire_bootloader) = true];
+ MessageType_FirmwareUpload = 7 [(wire_in) = true, (wire_bootloader) = true];
+ MessageType_FirmwareRequest = 8 [(wire_out) = true, (wire_bootloader) = true];
+ MessageType_SelfTest = 32 [(wire_in) = true, (wire_bootloader) = true];
+
+ // Bitcoin
+ MessageType_GetPublicKey = 11 [(wire_in) = true];
+ MessageType_PublicKey = 12 [(wire_out) = true];
+ MessageType_SignTx = 15 [(wire_in) = true];
+ MessageType_TxRequest = 21 [(wire_out) = true];
+ MessageType_TxAck = 22 [(wire_in) = true];
+ MessageType_GetAddress = 29 [(wire_in) = true];
+ MessageType_Address = 30 [(wire_out) = true];
+ MessageType_SignMessage = 38 [(wire_in) = true];
+ MessageType_VerifyMessage = 39 [(wire_in) = true];
+ MessageType_MessageSignature = 40 [(wire_out) = true];
+
+ // Crypto
+ MessageType_CipherKeyValue = 23 [(wire_in) = true];
+ MessageType_CipheredKeyValue = 48 [(wire_out) = true];
+ MessageType_SignIdentity = 53 [(wire_in) = true];
+ MessageType_SignedIdentity = 54 [(wire_out) = true];
+ MessageType_GetECDHSessionKey = 61 [(wire_in) = true];
+ MessageType_ECDHSessionKey = 62 [(wire_out) = true];
+ MessageType_CosiCommit = 71 [(wire_in) = true];
+ MessageType_CosiCommitment = 72 [(wire_out) = true];
+ MessageType_CosiSign = 73 [(wire_in) = true];
+ MessageType_CosiSignature = 74 [(wire_out) = true];
+
+ // Debug
+ MessageType_DebugLinkDecision = 100 [(wire_debug_in) = true, (wire_tiny) = true, (wire_no_fsm) = true];
+ MessageType_DebugLinkGetState = 101 [(wire_debug_in) = true, (wire_tiny) = true];
+ MessageType_DebugLinkState = 102 [(wire_debug_out) = true];
+ MessageType_DebugLinkStop = 103 [(wire_debug_in) = true];
+ MessageType_DebugLinkLog = 104 [(wire_debug_out) = true];
+ MessageType_DebugLinkMemoryRead = 110 [(wire_debug_in) = true];
+ MessageType_DebugLinkMemory = 111 [(wire_debug_out) = true];
+ MessageType_DebugLinkMemoryWrite = 112 [(wire_debug_in) = true];
+ MessageType_DebugLinkFlashErase = 113 [(wire_debug_in) = true];
+
+ // Ethereum
+ MessageType_EthereumGetPublicKey = 450 [(wire_in) = true];
+ MessageType_EthereumPublicKey = 451 [(wire_out) = true];
+ MessageType_EthereumGetAddress = 56 [(wire_in) = true];
+ MessageType_EthereumAddress = 57 [(wire_out) = true];
+ MessageType_EthereumSignTx = 58 [(wire_in) = true];
+ MessageType_EthereumTxRequest = 59 [(wire_out) = true];
+ MessageType_EthereumTxAck = 60 [(wire_in) = true];
+ MessageType_EthereumSignMessage = 64 [(wire_in) = true];
+ MessageType_EthereumVerifyMessage = 65 [(wire_in) = true];
+ MessageType_EthereumMessageSignature = 66 [(wire_out) = true];
+
+ // NEM
+ MessageType_NEMGetAddress = 67 [(wire_in) = true];
+ MessageType_NEMAddress = 68 [(wire_out) = true];
+ MessageType_NEMSignTx = 69 [(wire_in) = true];
+ MessageType_NEMSignedTx = 70 [(wire_out) = true];
+ MessageType_NEMDecryptMessage = 75 [(wire_in) = true];
+ MessageType_NEMDecryptedMessage = 76 [(wire_out) = true];
+
+ // Lisk
+ MessageType_LiskGetAddress = 114 [(wire_in) = true];
+ MessageType_LiskAddress = 115 [(wire_out) = true];
+ MessageType_LiskSignTx = 116 [(wire_in) = true];
+ MessageType_LiskSignedTx = 117 [(wire_out) = true];
+ MessageType_LiskSignMessage = 118 [(wire_in) = true];
+ MessageType_LiskMessageSignature = 119 [(wire_out) = true];
+ MessageType_LiskVerifyMessage = 120 [(wire_in) = true];
+ MessageType_LiskGetPublicKey = 121 [(wire_in) = true];
+ MessageType_LiskPublicKey = 122 [(wire_out) = true];
+
+ // Tezos
+ MessageType_TezosGetAddress = 150 [(wire_in) = true];
+ MessageType_TezosAddress = 151 [(wire_out) = true];
+ MessageType_TezosSignTx = 152 [(wire_in) = true];
+ MessageType_TezosSignedTx = 153 [(wire_out) = true];
+ MessageType_TezosGetPublicKey = 154 [(wire_in) = true];
+ MessageType_TezosPublicKey = 155 [(wire_out) = true];
+
+ // Stellar
+ MessageType_StellarSignTx = 202 [(wire_in) = true];
+ MessageType_StellarTxOpRequest = 203 [(wire_out) = true];
+ MessageType_StellarGetAddress = 207 [(wire_in) = true];
+ MessageType_StellarAddress = 208 [(wire_out) = true];
+ MessageType_StellarCreateAccountOp = 210 [(wire_in) = true];
+ MessageType_StellarPaymentOp = 211 [(wire_in) = true];
+ MessageType_StellarPathPaymentOp = 212 [(wire_in) = true];
+ MessageType_StellarManageOfferOp = 213 [(wire_in) = true];
+ MessageType_StellarCreatePassiveOfferOp = 214 [(wire_in) = true];
+ MessageType_StellarSetOptionsOp = 215 [(wire_in) = true];
+ MessageType_StellarChangeTrustOp = 216 [(wire_in) = true];
+ MessageType_StellarAllowTrustOp = 217 [(wire_in) = true];
+ MessageType_StellarAccountMergeOp = 218 [(wire_in) = true];
+ // omitted: StellarInflationOp is not a supported operation, would be 219
+ MessageType_StellarManageDataOp = 220 [(wire_in) = true];
+ MessageType_StellarBumpSequenceOp = 221 [(wire_in) = true];
+ MessageType_StellarSignedTx = 230 [(wire_out) = true];
+
+ // TRON
+ MessageType_TronGetAddress = 250 [(wire_in) = true];
+ MessageType_TronAddress = 251 [(wire_out) = true];
+ MessageType_TronSignTx = 252 [(wire_in) = true];
+ MessageType_TronSignedTx = 253 [(wire_out) = true];
+
+ // Cardano
+ // dropped Sign/VerifyMessage ids 300-302
+ MessageType_CardanoSignTx = 303 [(wire_in) = true];
+ MessageType_CardanoTxRequest = 304 [(wire_out) = true];
+ MessageType_CardanoGetPublicKey = 305 [(wire_in) = true];
+ MessageType_CardanoPublicKey = 306 [(wire_out) = true];
+ MessageType_CardanoGetAddress = 307 [(wire_in) = true];
+ MessageType_CardanoAddress = 308 [(wire_out) = true];
+ MessageType_CardanoTxAck = 309 [(wire_in) = true];
+ MessageType_CardanoSignedTx = 310 [(wire_out) = true];
+
+ // Ontology
+ MessageType_OntologyGetAddress = 350 [(wire_in) = true];
+ MessageType_OntologyAddress = 351 [(wire_out) = true];
+ MessageType_OntologyGetPublicKey = 352 [(wire_in) = true];
+ MessageType_OntologyPublicKey = 353 [(wire_out) = true];
+ MessageType_OntologySignTransfer = 354 [(wire_in) = true];
+ MessageType_OntologySignedTransfer = 355 [(wire_out) = true];
+ MessageType_OntologySignWithdrawOng = 356 [(wire_in) = true];
+ MessageType_OntologySignedWithdrawOng = 357 [(wire_out) = true];
+ MessageType_OntologySignOntIdRegister = 358 [(wire_in) = true];
+ MessageType_OntologySignedOntIdRegister = 359 [(wire_out) = true];
+ MessageType_OntologySignOntIdAddAttributes = 360 [(wire_in) = true];
+ MessageType_OntologySignedOntIdAddAttributes = 361 [(wire_out) = true];
+
+ // Ripple
+ MessageType_RippleGetAddress = 400 [(wire_in) = true];
+ MessageType_RippleAddress = 401 [(wire_out) = true];
+ MessageType_RippleSignTx = 402 [(wire_in) = true];
+ MessageType_RippleSignedTx = 403 [(wire_in) = true];
+
+ // Monero
+ MessageType_MoneroTransactionInitRequest = 501 [(wire_out) = true];
+ MessageType_MoneroTransactionInitAck = 502 [(wire_out) = true];
+ MessageType_MoneroTransactionSetInputRequest = 503 [(wire_out) = true];
+ MessageType_MoneroTransactionSetInputAck = 504 [(wire_out) = true];
+ MessageType_MoneroTransactionInputsPermutationRequest = 505 [(wire_out) = true];
+ MessageType_MoneroTransactionInputsPermutationAck = 506 [(wire_out) = true];
+ MessageType_MoneroTransactionInputViniRequest = 507 [(wire_out) = true];
+ MessageType_MoneroTransactionInputViniAck = 508 [(wire_out) = true];
+ MessageType_MoneroTransactionAllInputsSetRequest = 509 [(wire_out) = true];
+ MessageType_MoneroTransactionAllInputsSetAck = 510 [(wire_out) = true];
+ MessageType_MoneroTransactionSetOutputRequest = 511 [(wire_out) = true];
+ MessageType_MoneroTransactionSetOutputAck = 512 [(wire_out) = true];
+ MessageType_MoneroTransactionAllOutSetRequest = 513 [(wire_out) = true];
+ MessageType_MoneroTransactionAllOutSetAck = 514 [(wire_out) = true];
+ MessageType_MoneroTransactionSignInputRequest = 515 [(wire_out) = true];
+ MessageType_MoneroTransactionSignInputAck = 516 [(wire_out) = true];
+ MessageType_MoneroTransactionFinalRequest = 517 [(wire_out) = true];
+ MessageType_MoneroTransactionFinalAck = 518 [(wire_out) = true];
+ MessageType_MoneroKeyImageExportInitRequest = 530 [(wire_out) = true];
+ MessageType_MoneroKeyImageExportInitAck = 531 [(wire_out) = true];
+ MessageType_MoneroKeyImageSyncStepRequest = 532 [(wire_out) = true];
+ MessageType_MoneroKeyImageSyncStepAck = 533 [(wire_out) = true];
+ MessageType_MoneroKeyImageSyncFinalRequest = 534 [(wire_out) = true];
+ MessageType_MoneroKeyImageSyncFinalAck = 535 [(wire_out) = true];
+ MessageType_MoneroGetAddress = 540 [(wire_in) = true];
+ MessageType_MoneroAddress = 541 [(wire_out) = true];
+ MessageType_MoneroGetWatchKey = 542 [(wire_in) = true];
+ MessageType_MoneroWatchKey = 543 [(wire_out) = true];
+ MessageType_DebugMoneroDiagRequest = 546 [(wire_in) = true];
+ MessageType_DebugMoneroDiagAck = 547 [(wire_out) = true];
+ MessageType_MoneroGetTxKeyRequest = 550 [(wire_in) = true];
+ MessageType_MoneroGetTxKeyAck = 551 [(wire_out) = true];
+ MessageType_MoneroLiveRefreshStartRequest = 552 [(wire_in) = true];
+ MessageType_MoneroLiveRefreshStartAck = 553 [(wire_out) = true];
+ MessageType_MoneroLiveRefreshStepRequest = 554 [(wire_in) = true];
+ MessageType_MoneroLiveRefreshStepAck = 555 [(wire_out) = true];
+ MessageType_MoneroLiveRefreshFinalRequest = 556 [(wire_in) = true];
+ MessageType_MoneroLiveRefreshFinalAck = 557 [(wire_out) = true];
+
+ // EOS
+ MessageType_EosGetPublicKey = 600 [(wire_in) = true];
+ MessageType_EosPublicKey = 601 [(wire_out) = true];
+ MessageType_EosSignTx = 602 [(wire_in) = true];
+ MessageType_EosTxActionRequest = 603 [(wire_out) = true];
+ MessageType_EosTxActionAck = 604 [(wire_in) = true];
+ MessageType_EosSignedTx = 605 [(wire_out) = true];
+
+ // Binance
+ MessageType_BinanceGetAddress = 700 [(wire_in) = true];
+ MessageType_BinanceAddress = 701 [(wire_out) = true];
+ MessageType_BinanceGetPublicKey = 702 [(wire_in) = true];
+ MessageType_BinancePublicKey = 703 [(wire_out) = true];
+ MessageType_BinanceSignTx = 704 [(wire_in) = true];
+ MessageType_BinanceTxRequest = 705 [(wire_out) = true];
+ MessageType_BinanceTransferMsg = 706 [(wire_in) = true];
+ MessageType_BinanceOrderMsg = 707 [(wire_in) = true];
+ MessageType_BinanceCancelMsg = 708 [(wire_in) = true];
+ MessageType_BinanceSignedTx = 709 [(wire_out) = true];
+}
diff --git a/accounts/usbwallet/trezor/trezor.go b/accounts/usbwallet/trezor/trezor.go
new file mode 100644
index 0000000000..7e756e609b
--- /dev/null
+++ b/accounts/usbwallet/trezor/trezor.go
@@ -0,0 +1,70 @@
+// Copyright 2017 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 .
+
+// This file contains the implementation for interacting with the Trezor hardware
+// wallets. The wire protocol spec can be found on the SatoshiLabs website:
+// https://wiki.trezor.io/Developers_guide-Message_Workflows
+
+// !!! STAHP !!!
+//
+// Before you touch the protocol files, you need to be aware of a breaking change
+// that occurred between firmware versions 1.7.3->1.8.0 (Model One) and 2.0.10->
+// 2.1.0 (Model T). The Ethereum address representation was changed from the 20
+// byte binary blob to a 42 byte hex string. The upstream protocol buffer files
+// only support the new format, so blindly pulling in a new spec will break old
+// devices!
+//
+// The Trezor devs had the foresight to add the string version as a new message
+// code instead of replacing the binary one. This means that the proto file can
+// actually define both the old and the new versions as optional. Please ensure
+// that you add back the old addresses everywhere (to avoid name clash. use the
+// addressBin and addressHex names).
+//
+// If in doubt, reach out to @karalabe.
+
+// To regenerate the protocol files in this package:
+// - Download the latest protoc https://github.com/protocolbuffers/protobuf/releases
+// - Build with the usual `./configure && make` and ensure it's on your $PATH
+// - Delete all the .proto and .pb.go files, pull in fresh ones from Trezor
+// - Grab the latest Go plugin `go get -u github.com/golang/protobuf/protoc-gen-go`
+// - Vendor in the latest Go plugin `govendor fetch github.com/golang/protobuf/...`
+
+//go:generate protoc -I/usr/local/include:. --go_out=import_path=trezor:. messages.proto messages-common.proto messages-management.proto messages-ethereum.proto
+
+// Package trezor contains the wire protocol.
+package trezor
+
+import (
+ "reflect"
+
+ "github.com/golang/protobuf/proto"
+)
+
+// Type returns the protocol buffer type number of a specific message. If the
+// message is nil, this method panics!
+func Type(msg proto.Message) uint16 {
+ return uint16(MessageType_value["MessageType_"+reflect.TypeOf(msg).Elem().Name()])
+}
+
+// Name returns the friendly message type name of a specific protocol buffer
+// type number.
+func Name(kind uint16) string {
+ name := MessageType_name[int32(kind)]
+ if len(name) < 12 {
+ return name
+ }
+ return name[12:]
+}
diff --git a/accounts/usbwallet/wallet.go b/accounts/usbwallet/wallet.go
index ff292057c1..93dfb760b0 100644
--- a/accounts/usbwallet/wallet.go
+++ b/accounts/usbwallet/wallet.go
@@ -20,19 +20,18 @@ package usbwallet
import (
"context"
"fmt"
- "github.com/PlatONnetwork/PlatON-Go/crypto"
+ ethereum "github.com/PlatONnetwork/PlatON-Go"
"io"
"math/big"
"sync"
"time"
- "github.com/karalabe/hid"
-
- ethereum "github.com/PlatONnetwork/PlatON-Go"
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/core/types"
+ "github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/log"
+ "github.com/karalabe/usb"
)
// Maximum time between wallet health checks to detect USB unplugs.
@@ -68,6 +67,8 @@ type driver interface {
// SignTx sends the transaction to the USB device and waits for the user to confirm
// or deny the transaction.
SignTx(path accounts.DerivationPath, tx *types.Transaction, chainID *big.Int) (common.Address, *types.Transaction, error)
+
+ SignTypedMessage(path accounts.DerivationPath, messageHash []byte, domainHash []byte) ([]byte, error)
}
// wallet represents the common functionality shared by all USB hardware
@@ -78,8 +79,8 @@ type wallet struct {
driver driver // Hardware implementation of the low level device operations
url *accounts.URL // Textual URL uniquely identifying this wallet
- info hid.DeviceInfo // Known USB device infos about the wallet
- device *hid.Device // USB device advertising itself as a hardware wallet
+ info usb.DeviceInfo // Known USB device infos about the wallet
+ device usb.Device // USB device advertising itself as a hardware wallet
accounts []accounts.Account // List of derive accounts pinned on the hardware wallet
paths map[common.Address]accounts.DerivationPath // Known derivation paths for signing operations
@@ -275,9 +276,7 @@ func (w *wallet) close() error {
w.device = nil
w.accounts, w.paths = nil, nil
- w.driver.Close()
-
- return nil
+ return w.driver.Close()
}
// Accounts implements accounts.Wallet, returning the list of accounts pinned to
@@ -371,18 +370,22 @@ func (w *wallet) selfDerive() {
w.log.Warn("USB wallet nonce retrieval failed", "err", err)
break
}
- // If the next account is empty, stop self-derivation, but add for the last base path
+ // We've just self-derived a new account, start tracking it locally
+ // unless the account was empty.
+ path := make(accounts.DerivationPath, len(nextPaths[i]))
+ copy(path[:], nextPaths[i][:])
if balance.Sign() == 0 && nonce == 0 {
empty = true
+ // If it indeed was empty, make a log output for it anyway. In the case
+ // of legacy-ledger, the first account on the legacy-path will
+ // be shown to the user, even if we don't actively track it
if i < len(nextAddrs)-1 {
+ w.log.Info("Skipping trakcking first account on legacy path, use personal.deriveAccount(,, false) to track",
+ "path", path, "address", nextAddrs[i])
break
}
}
- // We've just self-derived a new account, start tracking it locally
- path := make(accounts.DerivationPath, len(nextPaths[i]))
- copy(path[:], nextPaths[i][:])
paths = append(paths, path)
-
account := accounts.Account{
Address: nextAddrs[i],
URL: accounts.URL{Scheme: w.url.Scheme, Path: fmt.Sprintf("%s/%s", w.url.Path, path)},
@@ -492,8 +495,8 @@ func (w *wallet) Derive(path accounts.DerivationPath, pin bool) (accounts.Accoun
// to discover non zero accounts and automatically add them to list of tracked
// accounts.
//
-// Note, self derivaton will increment the last component of the specified path
-// opposed to decending into a child path to allow discovering accounts starting
+// Note, self derivation will increment the last component of the specified path
+// opposed to descending into a child path to allow discovering accounts starting
// from non zero components.
//
// Some hardware wallets switched derivation paths through their evolution, so
@@ -515,12 +518,67 @@ func (w *wallet) SelfDerive(bases []accounts.DerivationPath, chain ethereum.Chai
w.deriveChain = chain
}
-// SignHash implements accounts.Wallet, however signing arbitrary data is not
+// signHash implements accounts.Wallet, however signing arbitrary data is not
// supported for hardware wallets, so this method will always return an error.
-func (w *wallet) SignHash(account accounts.Account, hash []byte) ([]byte, error) {
+func (w *wallet) signHash(account accounts.Account, hash []byte) ([]byte, error) {
return nil, accounts.ErrNotSupported
}
+// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed
+func (w *wallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
+
+ // Unless we are doing 712 signing, simply dispatch to signHash
+ if !(mimeType == accounts.MimetypeTypedData && len(data) == 66 && data[0] == 0x19 && data[1] == 0x01) {
+ return w.signHash(account, crypto.Keccak256(data))
+ }
+
+ // dispatch to 712 signing if the mimetype is TypedData and the format matches
+ w.stateLock.RLock() // Comms have own mutex, this is for the state fields
+ defer w.stateLock.RUnlock()
+
+ // If the wallet is closed, abort
+ if w.device == nil {
+ return nil, accounts.ErrWalletClosed
+ }
+ // Make sure the requested account is contained within
+ path, ok := w.paths[account.Address]
+ if !ok {
+ return nil, accounts.ErrUnknownAccount
+ }
+ // All infos gathered and metadata checks out, request signing
+ <-w.commsLock
+ defer func() { w.commsLock <- struct{}{} }()
+
+ // Ensure the device isn't screwed with while user confirmation is pending
+ // TODO(karalabe): remove if hotplug lands on Windows
+ w.hub.commsLock.Lock()
+ w.hub.commsPend++
+ w.hub.commsLock.Unlock()
+
+ defer func() {
+ w.hub.commsLock.Lock()
+ w.hub.commsPend--
+ w.hub.commsLock.Unlock()
+ }()
+ // Sign the transaction
+ signature, err := w.driver.SignTypedMessage(path, data[2:34], data[34:66])
+ if err != nil {
+ return nil, err
+ }
+ return signature, nil
+}
+
+// SignDataWithPassphrase implements accounts.Wallet, attempting to sign the given
+// data with the given account using passphrase as extra authentication.
+// Since USB wallets don't rely on passphrases, these are silently ignored.
+func (w *wallet) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
+ return w.SignData(account, mimeType, data)
+}
+
+func (w *wallet) SignText(account accounts.Account, text []byte) ([]byte, error) {
+ return w.signHash(account, accounts.TextHash(text))
+}
+
// SignTx implements accounts.Wallet. It sends the transaction over to the Ledger
// wallet to request a confirmation from the user. It returns either the signed
// transaction or a failure if the user denied the transaction.
@@ -562,23 +620,16 @@ func (w *wallet) SignTx(account accounts.Account, tx *types.Transaction, chainID
return nil, err
}
if sender != account.Address {
- return nil, fmt.Errorf("signer mismatch: expected %s, got %s", account.Address, sender)
+ return nil, fmt.Errorf("signer mismatch: expected %s, got %s", account.Address.Hex(), sender.Hex())
}
return signed, nil
}
-// SignDataWithPassphrase implements accounts.Wallet, attempting to sign the given
-// data with the given account using passphrase as extra authentication.
-// Since USB wallets don't rely on passphrases, these are silently ignored.
-func (w *wallet) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
- return w.SignData(account, mimeType, data)
-}
-
// SignHashWithPassphrase implements accounts.Wallet, however signing arbitrary
// data is not supported for Ledger wallets, so this method will always return
// an error.
-func (w *wallet) SignHashWithPassphrase(account accounts.Account, passphrase string, hash []byte) ([]byte, error) {
- return w.SignHash(account, hash)
+func (w *wallet) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
+ return w.SignText(account, accounts.TextHash(text))
}
// SignTxWithPassphrase implements accounts.Wallet, attempting to sign the given
@@ -587,14 +638,3 @@ func (w *wallet) SignHashWithPassphrase(account accounts.Account, passphrase str
func (w *wallet) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
return w.SignTx(account, tx, chainID)
}
-
-// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed
-func (w *wallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
- return w.signHash(account, crypto.Keccak256(data))
-}
-
-// signHash implements accounts.Wallet, however signing arbitrary data is not
-// supported for hardware wallets, so this method will always return an error.
-func (w *wallet) signHash(account accounts.Account, hash []byte) ([]byte, error) {
- return nil, accounts.ErrNotSupported
-}
diff --git a/build/checksums.txt b/build/checksums.txt
index 7b21faef20..f97e30770f 100644
--- a/build/checksums.txt
+++ b/build/checksums.txt
@@ -1,56 +1,38 @@
# This file contains sha256 checksums of optional build dependencies.
-7688063d55656105898f323d90a79a39c378d86fe89ae192eb3b7fc46347c95a go1.16.src.tar.gz
-6000a9522975d116bf76044967d7e69e04e982e9625330d9a539a8b45395f9a8 go1.16.darwin-amd64.tar.gz
-ea435a1ac6d497b03e367fdfb74b33e961d813883468080f6e239b3b03bea6aa go1.16.linux-386.tar.gz
-013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2 go1.16.linux-amd64.tar.gz
-3770f7eb22d05e25fbee8fb53c2a4e897da043eb83c69b9a14f8d98562cd8098 go1.16.linux-arm64.tar.gz
-d1d9404b1dbd77afa2bdc70934e10fbfcf7d785c372efc29462bb7d83d0a32fd go1.16.linux-armv6l.tar.gz
-481492a17d42193d471b93b7a06da3555331bd833b76336afc87be820c48933f go1.16.windows-386.zip
-5cc88fa506b3d5c453c54c3ea218fc8dd05d7362ae1de15bb67986b72089ce93 go1.16.windows-amd64.zip
-d7d6c70b05a7c2f68b48aab5ab8cb5116b8444c9ddad131673b152e7cff7c726 go1.16.freebsd-386.tar.gz
-40b03216f6945fb6883a50604fc7f409a83f62171607229a9c598e701e684f8a go1.16.freebsd-amd64.tar.gz
-27a1aaa988e930b7932ce459c8a63ad5b3333b3a06b016d87ff289f2a11aacd6 go1.16.linux-ppc64le.tar.gz
-be4c9e4e2cf058efc4e3eb013a760cb989ddc4362f111950c990d1c63b27ccbe go1.16.linux-s390x.tar.gz
+efd43e0f1402e083b73a03d444b7b6576bb4c539ac46208b63a916b69aca4088 go1.18.1.src.tar.gz
+3703e9a0db1000f18c0c7b524f3d378aac71219b4715a6a4c5683eb639f41a4d go1.18.1.darwin-amd64.tar.gz
+6d5641a06edba8cd6d425fb0adad06bad80e2afe0fa91b4aa0e5aed1bc78f58e go1.18.1.darwin-arm64.tar.gz
+b9a9063d4265d8ccc046c9b314194d6eadc47e56d0d637db81e98e68aad45035 go1.18.1.freebsd-386.tar.gz
+2bc1c138d645e37dbbc63517dd1cf1bf33fc4cb95f442a6384df0418b5134e9f go1.18.1.freebsd-amd64.tar.gz
+9a8df5dde9058f08ac01ecfaae42534610db398e487138788c01da26a0d41ff9 go1.18.1.linux-386.tar.gz
+b3b815f47ababac13810fc6021eb73d65478e0b2db4b09d348eefad9581a2334 go1.18.1.linux-amd64.tar.gz
+56a91851c97fb4697077abbca38860f735c32b38993ff79b088dac46e4735633 go1.18.1.linux-arm64.tar.gz
+9edc01c8e7db64e9ceeffc8258359e027812886ceca3444e83c4eb96ddb068ee go1.18.1.linux-armv6l.tar.gz
+33db623d1eecf362fe365107c12efc90eff0b9609e0b3345e258388019cb552a go1.18.1.linux-ppc64le.tar.gz
+5d9301324148ed4dbfaa0800da43a843ffd65c834ee73fcf087255697c925f74 go1.18.1.linux-s390x.tar.gz
+49ae65551acbfaa57b52fbefa0350b2072512ae3103b8cf1a919a02626dbc743 go1.18.1.windows-386.zip
+c30bc3f1f7314a953fe208bd9cd5e24bd9403392a6c556ced3677f9f70f71fe1 go1.18.1.windows-amd64.zip
+2c4a8265030eac37f906634f5c13c22c3d0ea725f2488e1bca005c6b981653d7 go1.18.1.windows-arm64.zip
-03c181fc1bb29ea3e73cbb23399c43b081063833a7cf7554b94e5a98308df53e golangci-lint-1.45.2-linux-riscv64.deb
-08a50bbbf451ede6d5354179eb3e14a5634e156dfa92cb9a2606f855a637e35b golangci-lint-1.45.2-linux-ppc64le.rpm
-0d12f6ec1296b5a70e392aa88cd2295cceef266165eb7028e675f455515dd1c9 golangci-lint-1.45.2-linux-armv7.deb
-10f2846e2e50e4ea8ae426ee62dcd2227b23adddd8e991aa3c065927ac948735 golangci-lint-1.45.2-linux-ppc64le.deb
-1463049b744871168095e3e8f687247d6040eeb895955b869889ea151e0603ab golangci-lint-1.45.2-linux-arm64.tar.gz
-15720f9c4c6f9324af695f081dc189adc7751b255759e78d7b2df1d7e9192533 golangci-lint-1.45.2-linux-amd64.deb
-166d922e4d3cfe3d47786c590154a9c8ea689dff0aa92b73d2f5fc74fc570c29 golangci-lint-1.45.2-linux-arm64.rpm
-1a3754c69f7cc19ab89cbdcc2550da4cf9abb3120383c6b3bd440c1ec22da2e6 golangci-lint-1.45.2-freebsd-386.tar.gz
-1dec0aa46d4f0d241863b573f70129bdf1de9c595cf51172a840a588a4cd9fc5 golangci-lint-1.45.2-windows-amd64.zip
-3198453806517c1ad988229f5e758ef850e671203f46d6905509df5bdf4dc24b golangci-lint-1.45.2-freebsd-armv7.tar.gz
-46a3cd1749d7b98adc2dc01510ddbe21abe42689c8a53fb0e81662713629f215 golangci-lint-1.45.2-linux-386.deb
-4e28bfb593d464b9e160f2acd5b71993836a183270bf8299b78ad31f7a168c0d golangci-lint-1.45.2-linux-arm64.deb
-5157a58c8f9ab85c33af2e46f0d7c57a3b1e8953b81d61130e292e09f545cfab golangci-lint-1.45.2-linux-mips64le.tar.gz
-518cd027644129fbf8ec4f02bd6f9ad7278aae826f92b63c80d4d0819ddde49a golangci-lint-1.45.2-linux-armv6.rpm
-595ad6c6dade4c064351bc309f411703e457f8ffbb7a1806b3d8ee713333427f golangci-lint-1.45.2-linux-amd64.tar.gz
-6994d6c80f0730751090986184a3481b4be2e6b6e84416238a2b857910045a4f golangci-lint-1.45.2-windows-arm64.zip
-6c81652fc340118811b487f713c441fc6f527800bf5fd11b8929d08124efa015 golangci-lint-1.45.2-linux-armv7.tar.gz
-726cb045559b7518bafdd3459de70a0647c087eb1b4634627a4b2e95b1258580 golangci-lint-1.45.2-freebsd-amd64.tar.gz
-77df3774cdfda49b956d4a0e676da9a9b883f496ee37293c530770fef6b1d24e golangci-lint-1.45.2-linux-mips64.deb
-7a9840f279a7d5d405bb434e101c2290964b3729630ac2add29280b962b7b9a5 golangci-lint-1.45.2-windows-armv6.zip
-7d4bf9a5d80ec467aaaf66e78dbdcab567bbc6ba8151334c714eee58766aae32 golangci-lint-1.45.2-windows-armv7.zip
-7e5f8821d39bb11d273b0841b34355f56bd5a45a2d5179f0d09e614e0efc0482 golangci-lint-1.45.2-linux-s390x.rpm
-828de1bde796b23d8656b17a8885fbd879ef612795d62d1e4618126b419728b5 golangci-lint-1.45.2-linux-mips64.rpm
-879a52107a797678a03c175cc7cf441411a14a01f66dc87f70bdfa304a4129a6 golangci-lint-1.45.2-windows-386.zip
-87b6c7e3a3769f7d9abeb3bb82119b3c91e3c975300f6834fdeef8b2e37c98ff golangci-lint-1.45.2-linux-amd64.rpm
-8b605c6d686c8af53ecc4ef39544541eeb1644d34cc10f9ffc5087808210c4ff golangci-lint-1.45.2-linux-s390x.deb
-9427dbf51d0ac6f73a0f992838bd40c817470cc5bf6c8e2e2bea6fac46d7af6e golangci-lint-1.45.2-linux-ppc64le.tar.gz
-995e509e895ca6a64ffc7395ac884d5961bdec98423cb896b17f345a9b4a19cf golangci-lint-1.45.2-darwin-amd64.tar.gz
-a3f36278f2ea5516341e9071a2df6e65df272be80230b5406a12b72c6d425bee golangci-lint-1.45.2-linux-armv7.rpm
-a5e12c50c23e87ac1deffc872f92ae85427b1198604969399805ae47cfe43f08 golangci-lint-1.45.2-linux-riscv64.tar.gz
-aa8fa1be0729dbc2fbc4e01e82027097613eee74bd686ebef20f860b01fff8b3 golangci-lint-1.45.2-freebsd-armv6.tar.gz
-c2b9669decc1b638cf2ee9060571af4e255f6dfcbb225c293e3a7ee4bb2c7217 golangci-lint-1.45.2-darwin-arm64.tar.gz
-dfa8bdaf0387aec1cd5c1aa8857f67b2bbdfc2e42efce540c8fb9bbe3e8af302 golangci-lint-1.45.2-linux-armv6.tar.gz
-eb8b8539dd017eee5c131ea9b875893ab2cebeeca41e8c6624907fb02224d643 golangci-lint-1.45.2-linux-386.rpm
-ed6c7e17a857f30d715c5302fa250d95936936b277024bffea201187a257d7a7 golangci-lint-1.45.2-linux-armv6.deb
-ef4d0154ace4001f01b288baeb118176242efb4fd163e178763e3213b77ef30b golangci-lint-1.45.2-linux-mips64le.deb
-ef7002a2229f5ff5ba201a715fcf877664ea88decbe58e69d163293913024955 golangci-lint-1.45.2-linux-s390x.tar.gz
-f13ecbd09228632e6bbe91a8324bd675c406eed22eb6d2c1e8192eed9ec4f914 golangci-lint-1.45.2-linux-386.tar.gz
-f4cd9cfb09252f51699407277512263cae8409b665dd764f55a34738d0e89edc golangci-lint-1.45.2-linux-riscv64.rpm
-fb1945dc59d37c9d14bf0a4aea11ea8651fa0e1d582ea80c4c44d0a536c08893 golangci-lint-1.45.2-linux-mips64.tar.gz
-fe542c22738010f453c735a3c410decfd3784d1bd394b395c298ee298fc4c606 golangci-lint-1.45.2-linux-mips64le.rpm
+658078aaaf7608693f37c4cf1380b2af418ab8b2d23fdb33e7e2d4339328590e golangci-lint-1.46.2-darwin-amd64.tar.gz
+81f9b4afd62ec5e612ef8bc3b1d612a88b56ff289874831845cdad394427385f golangci-lint-1.46.2-darwin-arm64.tar.gz
+943486e703e62ec55ecd90caeb22bcd39f8cc3962a93eec18c06b7bae12cb46f golangci-lint-1.46.2-freebsd-386.tar.gz
+a75dd9ba7e08e8315c411697171db5375c0f6a1ece9e6fbeb9e9a4386822e17d golangci-lint-1.46.2-freebsd-amd64.tar.gz
+83eedca1af72e8be055a1235177eb1b33524fbf08bec5730df2e6c3efade2b23 golangci-lint-1.46.2-freebsd-armv6.tar.gz
+513d276c490de6f82baa01f9346d8d78b385f2ae97608f42f05d1f0f1314cd54 golangci-lint-1.46.2-freebsd-armv7.tar.gz
+461a60016d516c69d406dc3e2d4957b722dbe684b7085dfac4802d0f84409e27 golangci-lint-1.46.2-linux-386.tar.gz
+242cd4f2d6ac0556e315192e8555784d13da5d1874e51304711570769c4f2b9b golangci-lint-1.46.2-linux-amd64.tar.gz
+ff5448ada2b3982581984d64b0dec614dba0a3ea4cab2d6a343c77927fc89f7e golangci-lint-1.46.2-linux-arm64.tar.gz
+177f5210ef04aee282bfbc6ec519d36af5fb7d2b2c8d3f4ea5e59fdba71b0a27 golangci-lint-1.46.2-linux-armv6.tar.gz
+10dd512a36ee978a1009edbca3ba3af410f0fda8df4d85f0e4793a24213870cc golangci-lint-1.46.2-linux-armv7.tar.gz
+67779fa517c688c9db1090c3c456117d95c6b92979c623fe8cce8fb84251f21e golangci-lint-1.46.2-linux-mips64.tar.gz
+c085f0f57bdccbb2c902a41b72ce210a3dfff16ca856789374745ab52004b6ee golangci-lint-1.46.2-linux-mips64le.tar.gz
+abecef6421499248e58ed75d2938bc12b4b1f98b057f25060680b77bb51a881e golangci-lint-1.46.2-linux-ppc64le.tar.gz
+134843a8f5c5c182c11979ea75f5866945d54757b2a04f3e5e04a0cf4fbf3a39 golangci-lint-1.46.2-linux-riscv64.tar.gz
+9fe21a9476567aafe7a2e1a926b9641a39f920d4c0ea8eda9d968bc6136337f9 golangci-lint-1.46.2-linux-s390x.tar.gz
+b48a421ec12a43f8fc8f977b9cf7d4a1ea1c4b97f803a238de7d3ce4ab23a84b golangci-lint-1.46.2-windows-386.zip
+604acc1378a566abb0eac799362f3a37b7fcb5fa2268aeb2d5d954c829367301 golangci-lint-1.46.2-windows-amd64.zip
+927def10db073da9687594072e6a3d9c891f67fa897105a2cfd715e018e7386c golangci-lint-1.46.2-windows-arm64.zip
+729b76ed1d8b4e2612e38772b211503cb940e00a137bbaace1aa066f7c943737 golangci-lint-1.46.2-windows-armv6.zip
+ea27c86d91e0b245ecbcfbf6cdb4ac0522d4bc6dca56bba02ea1bc77ad2917ac golangci-lint-1.46.2-windows-armv7.zip
diff --git a/build/ci.go b/build/ci.go
index b5fd374c64..a815c56916 100644
--- a/build/ci.go
+++ b/build/ci.go
@@ -260,6 +260,7 @@ func doInstall(cmdline []string) {
}
// Seems we are cross compiling, work around forbidden GOBIN
goinstall := goToolArch(*arch, *cc, "install", buildFlags(env)...)
+
goinstall.Args = append(goinstall.Args, "-trimpath")
goinstall.Args = append(goinstall.Args, "-v")
goinstall.Args = append(goinstall.Args, []string{"-buildmode", "archive"}...)
@@ -278,6 +279,8 @@ func doInstall(cmdline []string) {
gobuild.Args = append(gobuild.Args, "-v")
gobuild.Args = append(gobuild.Args, []string{"-o", executablePath(cmd.Name())}...)
gobuild.Args = append(gobuild.Args, "."+string(filepath.Separator)+filepath.Join("cmd", cmd.Name()))
+ // Disable CLI markdown doc generation in release builds.
+ gobuild.Args = append(gobuild.Args, "-tags", "urfave_cli_no_docs")
build.MustRun(gobuild)
break
}
@@ -388,7 +391,7 @@ func doLint(cmdline []string) {
// downloadLinter downloads and unpacks golangci-lint.
func downloadLinter(cachedir string) string {
- const version = "1.45.2"
+ const version = "1.46.2"
csdb := build.MustLoadChecksums("build/checksums.txt")
arch := runtime.GOARCH
diff --git a/build/deb/ethereum/completions/bash/platon b/build/deb/ethereum/completions/bash/platon
new file mode 100644
index 0000000000..dd881ce0a6
--- /dev/null
+++ b/build/deb/ethereum/completions/bash/platon
@@ -0,0 +1,16 @@
+_geth_bash_autocomplete() {
+ if [[ "${COMP_WORDS[0]}" != "source" ]]; then
+ local cur opts base
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ if [[ "$cur" == "-"* ]]; then
+ opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} ${cur} --generate-bash-completion )
+ else
+ opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
+ fi
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ return 0
+ fi
+}
+
+complete -o bashdefault -o default -o nospace -F _geth_bash_autocomplete platon
diff --git a/build/deb/ethereum/completions/zsh/_platon b/build/deb/ethereum/completions/zsh/_platon
new file mode 100644
index 0000000000..d1577a6d79
--- /dev/null
+++ b/build/deb/ethereum/completions/zsh/_platon
@@ -0,0 +1,18 @@
+_geth_zsh_autocomplete() {
+ local -a opts
+ local cur
+ cur=${words[-1]}
+ if [[ "$cur" == "-"* ]]; then
+ opts=("${(@f)$(${words[@]:0:#words[@]-1} ${cur} --generate-bash-completion)}")
+ else
+ opts=("${(@f)$(${words[@]:0:#words[@]-1} --generate-bash-completion)}")
+ fi
+
+ if [[ "${opts[1]}" != "" ]]; then
+ _describe 'values' opts
+ else
+ _files
+ fi
+}
+
+compdef _geth_zsh_autocomplete platon
diff --git a/build/deb/ethereum/deb.install b/build/deb/ethereum/deb.install
index e7666ce5fb..e18d37f301 100644
--- a/build/deb/ethereum/deb.install
+++ b/build/deb/ethereum/deb.install
@@ -1 +1,5 @@
build/bin/{{.BinaryName}} usr/bin
+{{- if eq .BinaryName "platon" }}
+build/deb/ethereum/completions/bash/platon etc/bash_completion.d
+build/deb/ethereum/completions/zsh/_platon usr/share/zsh/vendor-completions
+{{end -}}
\ No newline at end of file
diff --git a/cmd/abigen/main.go b/cmd/abigen/main.go
index b720c1fbd0..30f489fe9e 100644
--- a/cmd/abigen/main.go
+++ b/cmd/abigen/main.go
@@ -19,19 +19,17 @@ package main
import (
"encoding/json"
"fmt"
- "io"
- "os"
- "regexp"
- "strings"
-
- "gopkg.in/urfave/cli.v1"
-
"github.com/PlatONnetwork/PlatON-Go/accounts/abi/bind"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
"github.com/PlatONnetwork/PlatON-Go/common/compiler"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/PlatONnetwork/PlatON-Go/log"
+ "github.com/urfave/cli/v2"
+ "io"
+ "os"
+ "regexp"
+ "strings"
)
var (
@@ -42,40 +40,40 @@ var (
app *cli.App
// Flags needed by abigen
- abiFlag = cli.StringFlag{
+ abiFlag = &cli.StringFlag{
Name: "abi",
Usage: "Path to the Ethereum contract ABI json to bind, - for STDIN",
}
- binFlag = cli.StringFlag{
+ binFlag = &cli.StringFlag{
Name: "bin",
Usage: "Path to the Ethereum contract bytecode (generate deploy method)",
}
- typeFlag = cli.StringFlag{
+ typeFlag = &cli.StringFlag{
Name: "type",
Usage: "Struct name for the binding (default = package name)",
}
- jsonFlag = cli.StringFlag{
+ jsonFlag = &cli.StringFlag{
Name: "combined-json",
Usage: "Path to the combined-json file generated by compiler, - for STDIN",
}
- excFlag = cli.StringFlag{
+ excFlag = &cli.StringFlag{
Name: "exc",
Usage: "Comma separated types to exclude from binding",
}
- pkgFlag = cli.StringFlag{
+ pkgFlag = &cli.StringFlag{
Name: "pkg",
Usage: "Package name to generate the binding into",
}
- outFlag = cli.StringFlag{
+ outFlag = &cli.StringFlag{
Name: "out",
Usage: "Output file for the generated binding (default = stdout)",
}
- langFlag = cli.StringFlag{
+ langFlag = &cli.StringFlag{
Name: "lang",
Usage: "Destination language for the bindings (go, java, objc)",
Value: "go",
}
- aliasFlag = cli.StringFlag{
+ aliasFlag = &cli.StringFlag{
Name: "alias",
Usage: "Comma separated aliases for function and event renaming, e.g. original1=alias1, original2=alias2",
}
@@ -83,6 +81,7 @@ var (
func init() {
app = flags.NewApp(gitCommit, gitDate, "platon abi helper tool")
+ app.Name = "abigen"
app.Flags = []cli.Flag{
abiFlag,
binFlag,
@@ -94,17 +93,16 @@ func init() {
langFlag,
aliasFlag,
}
- app.Action = utils.MigrateFlags(abigen)
- cli.CommandHelpTemplate = flags.OriginCommandHelpTemplate
+ app.Action = abigen
}
func abigen(c *cli.Context) error {
utils.CheckExclusive(c, abiFlag, jsonFlag) // Only one source can be selected.
- if c.GlobalString(pkgFlag.Name) == "" {
+ if c.String(pkgFlag.Name) == "" {
utils.Fatalf("No destination package specified (--pkg)")
}
var lang bind.Lang
- switch c.GlobalString(langFlag.Name) {
+ switch c.String(langFlag.Name) {
case "go":
lang = bind.LangGo
case "java":
@@ -113,7 +111,7 @@ func abigen(c *cli.Context) error {
lang = bind.LangObjC
utils.Fatalf("Objc binding generation is uncompleted")
default:
- utils.Fatalf("Unsupported destination language \"%s\" (--lang)", c.GlobalString(langFlag.Name))
+ utils.Fatalf("Unsupported destination language \"%s\" (--lang)", c.String(langFlag.Name))
}
// If the entire solidity code was specified, build and bind based on that
var (
@@ -124,13 +122,13 @@ func abigen(c *cli.Context) error {
libs = make(map[string]string)
aliases = make(map[string]string)
)
- if c.GlobalString(abiFlag.Name) != "" {
+ if c.String(abiFlag.Name) != "" {
// Load up the ABI, optional bytecode and type name from the parameters
var (
abi []byte
err error
)
- input := c.GlobalString(abiFlag.Name)
+ input := c.String(abiFlag.Name)
if input == "-" {
abi, err = io.ReadAll(os.Stdin)
} else {
@@ -142,7 +140,7 @@ func abigen(c *cli.Context) error {
abis = append(abis, string(abi))
var bin []byte
- if binFile := c.GlobalString(binFlag.Name); binFile != "" {
+ if binFile := c.String(binFlag.Name); binFile != "" {
if bin, err = os.ReadFile(binFile); err != nil {
utils.Fatalf("Failed to read input bytecode: %v", err)
}
@@ -152,21 +150,21 @@ func abigen(c *cli.Context) error {
}
bins = append(bins, string(bin))
- kind := c.GlobalString(typeFlag.Name)
+ kind := c.String(typeFlag.Name)
if kind == "" {
- kind = c.GlobalString(pkgFlag.Name)
+ kind = c.String(pkgFlag.Name)
}
types = append(types, kind)
} else {
// Generate the list of types to exclude from binding
exclude := make(map[string]bool)
- for _, kind := range strings.Split(c.GlobalString(excFlag.Name), ",") {
+ for _, kind := range strings.Split(c.String(excFlag.Name), ",") {
exclude[strings.ToLower(kind)] = true
}
var contracts map[string]*compiler.Contract
- if c.GlobalIsSet(jsonFlag.Name) {
- jsonOutput, err := os.ReadFile(c.GlobalString(jsonFlag.Name))
+ if c.IsSet(jsonFlag.Name) {
+ jsonOutput, err := os.ReadFile(c.String(jsonFlag.Name))
if err != nil {
utils.Fatalf("Failed to read combined-json from compiler: %v", err)
}
@@ -199,28 +197,28 @@ func abigen(c *cli.Context) error {
}
}
// Extract all aliases from the flags
- if c.GlobalIsSet(aliasFlag.Name) {
+ if c.IsSet(aliasFlag.Name) {
// We support multi-versions for aliasing
// e.g.
// foo=bar,foo2=bar2
// foo:bar,foo2:bar2
re := regexp.MustCompile(`(?:(\w+)[:=](\w+))`)
- submatches := re.FindAllStringSubmatch(c.GlobalString(aliasFlag.Name), -1)
+ submatches := re.FindAllStringSubmatch(c.String(aliasFlag.Name), -1)
for _, match := range submatches {
aliases[match[1]] = match[2]
}
}
// Generate the contract binding
- code, err := bind.Bind(types, abis, bins, sigs, c.GlobalString(pkgFlag.Name), lang, libs, aliases)
+ code, err := bind.Bind(types, abis, bins, sigs, c.String(pkgFlag.Name), lang, libs, aliases)
if err != nil {
utils.Fatalf("Failed to generate ABI binding: %v", err)
}
// Either flush it out to a file or display on the standard output
- if !c.GlobalIsSet(outFlag.Name) {
+ if !c.IsSet(outFlag.Name) {
fmt.Printf("%s\n", code)
return nil
}
- if err := os.WriteFile(c.GlobalString(outFlag.Name), []byte(code), 0600); err != nil {
+ if err := os.WriteFile(c.String(outFlag.Name), []byte(code), 0600); err != nil {
utils.Fatalf("Failed to write ABI binding: %v", err)
}
return nil
diff --git a/cmd/ctool/core/contractcmd.go b/cmd/ctool/core/contractcmd.go
index b9ca79e413..262b2f8929 100644
--- a/cmd/ctool/core/contractcmd.go
+++ b/cmd/ctool/core/contractcmd.go
@@ -24,18 +24,18 @@ import (
"github.com/PlatONnetwork/PlatON-Go/common/hexutil"
"github.com/PlatONnetwork/PlatON-Go/rlp"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- DeployCmd = cli.Command{
+ DeployCmd = &cli.Command{
Name: "deploy",
Usage: "deploy a contract",
Action: deploy,
Flags: deployCmdFlags,
}
- InvokeCmd = cli.Command{
+ InvokeCmd = &cli.Command{
Name: "invoke",
Aliases: []string{"i"},
Usage: "invoke contract function",
@@ -148,8 +148,8 @@ func invoke(c *cli.Context) error {
return nil
}
-/**
-
+/*
+*
*/
func InvokeContract(contractAddr string, abiPath string, funcParams string, txType int) error {
@@ -242,8 +242,10 @@ func InvokeContract(contractAddr string, abiPath string, funcParams string, txTy
return nil
}
-/**
- Judging whether a contract exists through platon_getCode
+/*
+*
+
+ Judging whether a contract exists through platon_getCode
*/
func getContractByAddress(addr string) bool {
@@ -275,7 +277,7 @@ func getContractByAddress(addr string) bool {
}
/*
- Loop call to get transactionReceipt... until 200s timeout
+Loop call to get transactionReceipt... until 200s timeout
*/
func GetTransactionReceipt(txHash string, ch chan string, exit chan string) {
var receipt = Receipt{}
diff --git a/cmd/ctool/core/flags.go b/cmd/ctool/core/flags.go
index a8bc80f106..5f292389dd 100644
--- a/cmd/ctool/core/flags.go
+++ b/cmd/ctool/core/flags.go
@@ -14,91 +14,90 @@
// You should have received a copy of the GNU General Public License
// along with PlatON-Go. If not, see .
-
package core
-import "gopkg.in/urfave/cli.v1"
+import "github.com/urfave/cli/v2"
var (
- ConfigPathFlag = cli.StringFlag{
+ ConfigPathFlag = &cli.StringFlag{
Name: "config",
Usage: "config path",
}
- PKFilePathFlag = cli.StringFlag{
+ PKFilePathFlag = &cli.StringFlag{
Name: "pkfile",
Value: "",
Usage: "private key file path",
}
- StabExecTimesFlag = cli.IntFlag{
+ StabExecTimesFlag = &cli.IntFlag{
Name: "times",
Value: 1000,
Usage: "execute times",
}
- SendTxIntervalFlag = cli.IntFlag{
+ SendTxIntervalFlag = &cli.IntFlag{
Name: "interval",
Value: 10,
Usage: "Time interval for sending transactions",
}
- AccountSizeFlag = cli.IntFlag{
+ AccountSizeFlag = &cli.IntFlag{
Name: "size",
Value: 10,
Usage: "account size",
}
- TxJsonDataFlag = cli.StringFlag{
+ TxJsonDataFlag = &cli.StringFlag{
Name: "data",
Usage: "transaction data",
}
- ContractWasmFilePathFlag = cli.StringFlag{
+ ContractWasmFilePathFlag = &cli.StringFlag{
Name: "code",
Usage: "wasm file path",
}
- ContractAddrFlag = cli.StringFlag{
+ ContractAddrFlag = &cli.StringFlag{
Name: "addr",
Usage: "the contract address",
}
- ContractFuncNameFlag = cli.StringFlag{
+ ContractFuncNameFlag = &cli.StringFlag{
Name: "func",
Usage: "function and param ,eg :set(1,\"a\")",
}
- TransactionTypeFlag = cli.IntFlag{
+ TransactionTypeFlag = &cli.IntFlag{
Name: "type",
Value: 2,
Usage: "tx type ,default 2",
}
- ContractAbiFilePathFlag = cli.StringFlag{
+ ContractAbiFilePathFlag = &cli.StringFlag{
Name: "abi",
Usage: "abi file path",
}
- TransactionHashFlag = cli.StringFlag{
+ TransactionHashFlag = &cli.StringFlag{
Name: "hash",
Usage: "tx hash",
}
- TxFromFlag = cli.StringFlag{
+ TxFromFlag = &cli.StringFlag{
Name: "from",
Usage: "transaction sender addr",
}
- TxToFlag = cli.StringFlag{
+ TxToFlag = &cli.StringFlag{
Name: "to",
Usage: "transaction acceptor addr",
}
- TransferValueFlag = cli.StringFlag{
+ TransferValueFlag = &cli.StringFlag{
Name: "value",
Value: "0xDE0B6B3A7640000", //one
Usage: "transfer value",
}
- TxStressSourceFilesPathFlag = cli.StringSliceFlag{
+ TxStressSourceFilesPathFlag = &cli.StringSliceFlag{
Name: "sourceFile",
Usage: "the tps source file path",
}
- TxStressStatisticTimeFlag = cli.IntFlag{
+ TxStressStatisticTimeFlag = &cli.IntFlag{
Name: "statisticTime",
Usage: "Statistics every few seconds",
}
- TxStressOutPutFileFlag = cli.StringFlag{
+ TxStressOutPutFileFlag = &cli.StringFlag{
Name: "output",
Usage: "the output file path",
}
diff --git a/cmd/ctool/core/transactioncmd.go b/cmd/ctool/core/transactioncmd.go
index 2329a261e0..a182b57ca9 100644
--- a/cmd/ctool/core/transactioncmd.go
+++ b/cmd/ctool/core/transactioncmd.go
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with PlatON-Go. If not, see .
-
package core
import (
@@ -25,7 +24,7 @@ import (
"strconv"
"strings"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/common/hexutil"
@@ -34,19 +33,19 @@ import (
)
var (
- SendTransactionCmd = cli.Command{
+ SendTransactionCmd = &cli.Command{
Name: "sendTransaction",
Usage: "send a transaction",
Action: sendTransactionCmd,
Flags: sendTransactionCmdFlags,
}
- SendRawTransactionCmd = cli.Command{
+ SendRawTransactionCmd = &cli.Command{
Name: "sendRawTransaction",
Usage: "send a raw transaction",
Action: sendRawTransactionCmd,
Flags: sendRawTransactionCmdFlags,
}
- GetTxReceiptCmd = cli.Command{
+ GetTxReceiptCmd = &cli.Command{
Name: "getTxReceipt",
Usage: "get transaction receipt by hash",
Action: getTxReceiptCmd,
@@ -54,10 +53,11 @@ var (
}
)
-func getTxReceiptCmd(c *cli.Context) {
+func getTxReceiptCmd(c *cli.Context) error {
hash := c.String(TransactionHashFlag.Name)
parseConfigJson(c.String(ConfigPathFlag.Name))
GetTxReceipt(hash)
+ return nil
}
func GetTxReceipt(txHash string) (Receipt, error) {
diff --git a/cmd/ctool/core/tx_stability.go b/cmd/ctool/core/tx_stability.go
index d9f30b61b4..1265e0e483 100644
--- a/cmd/ctool/core/tx_stability.go
+++ b/cmd/ctool/core/tx_stability.go
@@ -31,7 +31,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/core/types"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/crypto/secp256k1"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
@@ -44,14 +44,14 @@ var (
DefaultPrivateKeyFilePath = "./test/privateKeys.txt"
DefaultAccountAddrFilePath = "./test/addr.json"
- StabilityCmd = cli.Command{
+ StabilityCmd = &cli.Command{
Name: "stability",
Aliases: []string{"stab"},
Usage: "start stability test ",
Action: stabilityTest,
Flags: stabilityCmdFlags,
}
- StabPrepareCmd = cli.Command{
+ StabPrepareCmd = &cli.Command{
Name: "prepare",
Aliases: []string{"pre"},
Usage: "prepare some accounts are used for stability test ",
@@ -60,7 +60,7 @@ var (
}
)
-func prepareAccount(c *cli.Context) {
+func prepareAccount(c *cli.Context) error {
pkFile := c.String(PKFilePathFlag.Name)
size := c.Int(AccountSizeFlag.Name)
value := c.String(TransferValueFlag.Name)
@@ -71,9 +71,10 @@ func prepareAccount(c *cli.Context) {
if err != nil {
panic(fmt.Errorf("send raw transaction error,%s", err.Error()))
}
+ return err
}
-func stabilityTest(c *cli.Context) {
+func stabilityTest(c *cli.Context) error {
pkFile := c.String(PKFilePathFlag.Name)
times := c.Int(StabExecTimesFlag.Name)
interval := c.Int(SendTxIntervalFlag.Name)
@@ -84,6 +85,7 @@ func stabilityTest(c *cli.Context) {
if err != nil {
panic(fmt.Errorf("stress test error,%s", err.Error()))
}
+ return err
}
type PriAccount struct {
diff --git a/cmd/ctool/core/tx_stress.go b/cmd/ctool/core/tx_stress.go
index 31739c83b3..ed7cba4936 100644
--- a/cmd/ctool/core/tx_stress.go
+++ b/cmd/ctool/core/tx_stress.go
@@ -19,11 +19,11 @@ package core
import (
"github.com/PlatONnetwork/PlatON-Go/eth"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- AnalyzeStressTestCmd = cli.Command{
+ AnalyzeStressTestCmd = &cli.Command{
Name: "analyzeStressTest",
Usage: "analyze the tx stress test source file to generate result data",
Action: analyzeStressTest,
diff --git a/cmd/ctool/main.go b/cmd/ctool/main.go
index 611097aa3e..c432b70da3 100644
--- a/cmd/ctool/main.go
+++ b/cmd/ctool/main.go
@@ -14,7 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with PlatON-Go. If not, see .
-
package main
import (
@@ -24,7 +23,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/cmd/ctool/core"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/cmd/ctool/ppos"
)
@@ -37,7 +36,7 @@ func init() {
app = cli.NewApp()
// Initialize the CLI app
- app.Commands = []cli.Command{
+ app.Commands = []*cli.Command{
core.DeployCmd,
core.InvokeCmd,
core.SendTransactionCmd,
diff --git a/cmd/ctool/ppos/common.go b/cmd/ctool/ppos/common.go
index 2ceb3166c6..caf737ddbb 100644
--- a/cmd/ctool/ppos/common.go
+++ b/cmd/ctool/ppos/common.go
@@ -23,7 +23,7 @@ import (
"errors"
"fmt"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
platon "github.com/PlatONnetwork/PlatON-Go"
"github.com/PlatONnetwork/PlatON-Go/common"
diff --git a/cmd/ctool/ppos/flag.go b/cmd/ctool/ppos/flag.go
index 84431dbdae..29faadfb23 100644
--- a/cmd/ctool/ppos/flag.go
+++ b/cmd/ctool/ppos/flag.go
@@ -16,20 +16,20 @@
package ppos
-import "gopkg.in/urfave/cli.v1"
+import "github.com/urfave/cli/v2"
var (
- rpcUrlFlag = cli.StringFlag{
+ rpcUrlFlag = &cli.StringFlag{
Name: "rpcurl",
Usage: "the rpc url",
}
- jsonFlag = cli.BoolFlag{
+ jsonFlag = &cli.BoolFlag{
Name: "json",
Usage: "print raw transaction",
}
- addressHRPFlag = cli.StringFlag{
+ addressHRPFlag = &cli.StringFlag{
Name: "addressHRP",
Usage: "set address hrp",
}
diff --git a/cmd/ctool/ppos/gov.go b/cmd/ctool/ppos/gov.go
index 654b2760db..c642eb47b6 100644
--- a/cmd/ctool/ppos/gov.go
+++ b/cmd/ctool/ppos/gov.go
@@ -19,16 +19,16 @@ package ppos
import (
"errors"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/common"
)
var (
- GovCmd = cli.Command{
+ GovCmd = &cli.Command{
Name: "gov",
Usage: "use for gov func",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
getProposalCmd,
getTallyResultCmd,
listProposalCmd,
@@ -38,68 +38,68 @@ var (
listGovernParamCmd,
},
}
- getProposalCmd = cli.Command{
+ getProposalCmd = &cli.Command{
Name: "getProposal",
Usage: "2100,get proposal,parameter:proposalID",
Before: netCheck,
Action: getProposal,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, proposalIDFlag, jsonFlag},
}
- getTallyResultCmd = cli.Command{
+ getTallyResultCmd = &cli.Command{
Name: "getTallyResult",
Usage: "2101,get tally result,parameter:proposalID",
Before: netCheck,
Action: getTallyResult,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, proposalIDFlag, jsonFlag},
}
- listProposalCmd = cli.Command{
+ listProposalCmd = &cli.Command{
Name: "listProposal",
Usage: "2102,list proposal",
Before: netCheck,
Action: listProposal,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getActiveVersionCmd = cli.Command{
+ getActiveVersionCmd = &cli.Command{
Name: "getActiveVersion",
Usage: "2103,query the effective version of the chain",
Before: netCheck,
Action: getActiveVersion,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getGovernParamValueCmd = cli.Command{
+ getGovernParamValueCmd = &cli.Command{
Name: "getGovernParamValue",
Usage: "2104,query the governance parameter value of the current block height,parameter:module,name",
Before: netCheck,
Action: getGovernParamValue,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, moduleFlag, nameFlag, jsonFlag},
}
- getAccuVerifiersCountCmd = cli.Command{
+ getAccuVerifiersCountCmd = &cli.Command{
Name: "getAccuVerifiersCount",
Usage: "2105,query the cumulative number of votes available for a proposal,parameter:proposalID,blockHash",
Before: netCheck,
Action: getAccuVerifiersCount,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, proposalIDFlag, blockHashFlag, jsonFlag},
}
- listGovernParamCmd = cli.Command{
+ listGovernParamCmd = &cli.Command{
Name: "listGovernParam",
Usage: "2106,query the list of governance parameters,parameter:module",
Before: netCheck,
Action: listGovernParam,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, moduleFlag, jsonFlag},
}
- proposalIDFlag = cli.StringFlag{
+ proposalIDFlag = &cli.StringFlag{
Name: "proposalID",
Usage: "proposalID",
}
- moduleFlag = cli.StringFlag{
+ moduleFlag = &cli.StringFlag{
Name: "module",
Usage: "module",
}
- nameFlag = cli.StringFlag{
+ nameFlag = &cli.StringFlag{
Name: "name",
Usage: "name",
}
- blockHashFlag = cli.StringFlag{
+ blockHashFlag = &cli.StringFlag{
Name: "blockHash",
Usage: "blockHash",
}
diff --git a/cmd/ctool/ppos/restricting.go b/cmd/ctool/ppos/restricting.go
index 32b039c220..d249cd997e 100644
--- a/cmd/ctool/ppos/restricting.go
+++ b/cmd/ctool/ppos/restricting.go
@@ -19,20 +19,20 @@ package ppos
import (
"errors"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/common"
)
var (
- RestrictingCmd = cli.Command{
+ RestrictingCmd = &cli.Command{
Name: "restricting",
Usage: "use for restricting",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
getRestrictingInfoCmd,
},
}
- getRestrictingInfoCmd = cli.Command{
+ getRestrictingInfoCmd = &cli.Command{
Name: "getRestrictingInfo",
Usage: "4100,get restricting info,parameter:address",
Before: netCheck,
diff --git a/cmd/ctool/ppos/reward.go b/cmd/ctool/ppos/reward.go
index 3199dea736..d2c10b2f9a 100644
--- a/cmd/ctool/ppos/reward.go
+++ b/cmd/ctool/ppos/reward.go
@@ -17,27 +17,27 @@
package ppos
import (
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
)
var (
- RewardCmd = cli.Command{
+ RewardCmd = &cli.Command{
Name: "reward",
Usage: "use for reward",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
getDelegateRewardCmd,
},
}
- getDelegateRewardCmd = cli.Command{
+ getDelegateRewardCmd = &cli.Command{
Name: "getDelegateReward",
Usage: "5100,query account not withdrawn commission rewards at each node,parameter:nodeList(can empty)",
Before: netCheck,
Action: getDelegateReward,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, nodeList, jsonFlag},
}
- nodeList = cli.StringSliceFlag{
+ nodeList = &cli.StringSliceFlag{
Name: "nodeList",
Usage: "node list,may empty",
}
diff --git a/cmd/ctool/ppos/slashing.go b/cmd/ctool/ppos/slashing.go
index 41145314a8..5033500fe8 100644
--- a/cmd/ctool/ppos/slashing.go
+++ b/cmd/ctool/ppos/slashing.go
@@ -21,25 +21,25 @@ import (
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- SlashingCmd = cli.Command{
+ SlashingCmd = &cli.Command{
Name: "slashing",
Usage: "use for slashing",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
checkDuplicateSignCmd,
zeroProduceNodeListCmd,
},
}
- checkDuplicateSignCmd = cli.Command{
+ checkDuplicateSignCmd = &cli.Command{
Name: "checkDuplicateSign",
Usage: "3001,query whether the node has been reported for too many signatures,parameter:duplicateSignType,nodeid,blockNum",
Before: netCheck,
Action: checkDuplicateSign,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag,
- cli.Uint64Flag{
+ &cli.Uint64Flag{
Name: "duplicateSignType",
Usage: "duplicateSign type,1:prepareBlock,2:prepareVote,3:viewChange",
},
@@ -47,14 +47,14 @@ var (
blockNumFlag, jsonFlag,
},
}
- zeroProduceNodeListCmd = cli.Command{
+ zeroProduceNodeListCmd = &cli.Command{
Name: "zeroProduceNodeList",
Usage: "3002,query the list of nodes with zero block",
Before: netCheck,
Action: zeroProduceNodeList,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- blockNumFlag = cli.Uint64Flag{
+ blockNumFlag = &cli.Uint64Flag{
Name: "blockNum",
Usage: "blockNum",
}
diff --git a/cmd/ctool/ppos/staking.go b/cmd/ctool/ppos/staking.go
index 5fe8fc06e5..01f2ead866 100644
--- a/cmd/ctool/ppos/staking.go
+++ b/cmd/ctool/ppos/staking.go
@@ -23,14 +23,14 @@ import (
"github.com/PlatONnetwork/PlatON-Go/common"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- StakingCmd = cli.Command{
+ StakingCmd = &cli.Command{
Name: "staking",
Usage: "use for staking",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
GetVerifierListCmd,
getValidatorListCmd,
getCandidateListCmd,
@@ -43,85 +43,85 @@ var (
getAvgPackTimeCmd,
},
}
- GetVerifierListCmd = cli.Command{
+ GetVerifierListCmd = &cli.Command{
Name: "getVerifierList",
Usage: "1100,query the validator queue of the current settlement epoch",
Before: netCheck,
Action: getVerifierList,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getValidatorListCmd = cli.Command{
+ getValidatorListCmd = &cli.Command{
Name: "getValidatorList",
Usage: "1101,query the list of validators in the current consensus round",
Before: netCheck,
Action: getValidatorList,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getCandidateListCmd = cli.Command{
+ getCandidateListCmd = &cli.Command{
Name: "getCandidateList",
Usage: "1102,Query the list of all real-time candidates",
Before: netCheck,
Action: getCandidateList,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getRelatedListByDelAddrCmd = cli.Command{
+ getRelatedListByDelAddrCmd = &cli.Command{
Name: "getRelatedListByDelAddr",
Usage: "1103,Query the NodeID and staking Id of the node entrusted by the current account address,parameter:add",
Before: netCheck,
Action: getRelatedListByDelAddr,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, addFlag, jsonFlag},
}
- getDelegateInfoCmd = cli.Command{
+ getDelegateInfoCmd = &cli.Command{
Name: "getDelegateInfo",
Usage: "1104,Query the delegation information of the current single node,parameter:stakingBlock,address,nodeid",
Before: netCheck,
Action: getDelegateInfo,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, stakingBlockNumFlag, addFlag, nodeIdFlag, jsonFlag},
}
- getCandidateInfoCmd = cli.Command{
+ getCandidateInfoCmd = &cli.Command{
Name: "getCandidateInfo",
Usage: "1105,Query the staking information of the current node,parameter:nodeid",
Before: netCheck,
Action: getCandidateInfo,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, nodeIdFlag, jsonFlag},
}
- getDelegationLockCmd = cli.Command{
+ getDelegationLockCmd = &cli.Command{
Name: "getDelegationLock",
Usage: "1106,Query the delegation lock information of the current account,parameter:address",
Before: netCheck,
Action: getDelegationLock,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, addFlag, jsonFlag},
}
- getPackageRewardCmd = cli.Command{
+ getPackageRewardCmd = &cli.Command{
Name: "getPackageReward",
Usage: "1200,query the block reward of the current settlement epoch",
Before: netCheck,
Action: getPackageReward,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getStakingRewardCmd = cli.Command{
+ getStakingRewardCmd = &cli.Command{
Name: "getStakingReward",
Usage: "1201,query the staking reward of the current settlement epoch",
Before: netCheck,
Action: getStakingReward,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- getAvgPackTimeCmd = cli.Command{
+ getAvgPackTimeCmd = &cli.Command{
Name: "getAvgPackTime",
Usage: "1202,average time to query packaged blocks",
Before: netCheck,
Action: getAvgPackTime,
Flags: []cli.Flag{rpcUrlFlag, addressHRPFlag, jsonFlag},
}
- addFlag = cli.StringFlag{
+ addFlag = &cli.StringFlag{
Name: "address",
Usage: "account address",
}
- stakingBlockNumFlag = cli.Uint64Flag{
+ stakingBlockNumFlag = &cli.Uint64Flag{
Name: "stakingBlock",
Usage: "block height when staking is initiated",
}
- nodeIdFlag = cli.StringFlag{
+ nodeIdFlag = &cli.StringFlag{
Name: "nodeid",
Usage: "node id",
}
diff --git a/cmd/keytool/changepassword.go b/cmd/keytool/changepassword.go
index 233a275172..c0d34b50fb 100644
--- a/cmd/keytool/changepassword.go
+++ b/cmd/keytool/changepassword.go
@@ -5,18 +5,18 @@ import (
"os"
"strings"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
)
-var newPassphraseFlag = cli.StringFlag{
+var newPassphraseFlag = &cli.StringFlag{
Name: "newpasswordfile",
Usage: "the file that contains the new password for the keyfile",
}
-var commandChangePassphrase = cli.Command{
+var commandChangePassphrase = &cli.Command{
Name: "changepassword",
Usage: "change the password on a keyfile",
ArgsUsage: "",
diff --git a/cmd/keytool/genblskeypair.go b/cmd/keytool/genblskeypair.go
index 84f724b3f0..a8f218373b 100644
--- a/cmd/keytool/genblskeypair.go
+++ b/cmd/keytool/genblskeypair.go
@@ -21,7 +21,7 @@ import (
"fmt"
"github.com/PlatONnetwork/PlatON-Go/crypto/bls"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
type outputGenblskeypair struct {
@@ -29,7 +29,7 @@ type outputGenblskeypair struct {
PublicKey string
}
-var commandGenblskeypair = cli.Command{
+var commandGenblskeypair = &cli.Command{
Name: "genblskeypair",
Usage: "generate new bls private key pair",
ArgsUsage: "[ ]",
diff --git a/cmd/keytool/generate.go b/cmd/keytool/generate.go
index 71da085b21..8a6d3fb806 100644
--- a/cmd/keytool/generate.go
+++ b/cmd/keytool/generate.go
@@ -25,7 +25,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/google/uuid"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
@@ -38,17 +38,17 @@ type outputGenerate struct {
}
var (
- privateKeyFlag = cli.StringFlag{
+ privateKeyFlag = &cli.StringFlag{
Name: "privatekey",
Usage: "file containing a raw private key to encrypt",
}
- lightKDFFlag = cli.BoolFlag{
+ lightKDFFlag = &cli.BoolFlag{
Name: "lightkdf",
Usage: "use less secure scrypt parameters",
}
)
-var commandGenerate = cli.Command{
+var commandGenerate = &cli.Command{
Name: "generate",
Usage: "generate new keyfile",
ArgsUsage: "[ ]",
diff --git a/cmd/keytool/genkeypair.go b/cmd/keytool/genkeypair.go
index acf94532f2..312fe5c09d 100644
--- a/cmd/keytool/genkeypair.go
+++ b/cmd/keytool/genkeypair.go
@@ -21,7 +21,7 @@ import (
"encoding/hex"
"fmt"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
"github.com/PlatONnetwork/PlatON-Go/crypto"
diff --git a/cmd/keytool/hex_to_bech32.go b/cmd/keytool/hex_to_bech32.go
index fbd990226d..6c55c4a62f 100644
--- a/cmd/keytool/hex_to_bech32.go
+++ b/cmd/keytool/hex_to_bech32.go
@@ -12,10 +12,10 @@ import (
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
"github.com/PlatONnetwork/PlatON-Go/common"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
-var HexAccountFileFlag = cli.StringFlag{
+var HexAccountFileFlag = &cli.StringFlag{
Name: "hexAddressFile",
Usage: "file bech32/hex accounts want to update to bech32 address,file like [hex,hex...]",
}
@@ -26,7 +26,7 @@ type addressPair struct {
Hex string
}
-var commandAddressHexToBech32 = cli.Command{
+var commandAddressHexToBech32 = &cli.Command{
Name: "updateaddress",
Usage: "update hex/bech32 address to bech32 address",
ArgsUsage: "[ ...]",
@@ -55,7 +55,7 @@ update hex/bech32 address to bech32 address.
utils.Fatalf("Failed to json decode '%s': %v", accountPath, err)
}
} else {
- for _, add := range ctx.Args() {
+ for _, add := range ctx.Args().Slice() {
if add == "" {
utils.Fatalf("the account can't be nil")
}
diff --git a/cmd/keytool/inspect.go b/cmd/keytool/inspect.go
index 158f47f26f..b176140c7e 100644
--- a/cmd/keytool/inspect.go
+++ b/cmd/keytool/inspect.go
@@ -22,7 +22,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/common"
"os"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
@@ -36,13 +36,13 @@ type outputInspect struct {
}
var (
- privateFlag = cli.BoolFlag{
+ privateFlag = &cli.BoolFlag{
Name: "private",
Usage: "include the private key in the output",
}
)
-var commandInspect = cli.Command{
+var commandInspect = &cli.Command{
Name: "inspect",
Usage: "inspect a keyfile",
ArgsUsage: "",
diff --git a/cmd/keytool/main.go b/cmd/keytool/main.go
index f04d3e6b32..33bc43934a 100644
--- a/cmd/keytool/main.go
+++ b/cmd/keytool/main.go
@@ -21,7 +21,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/internal/flags"
"os"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
const (
@@ -31,37 +31,33 @@ const (
// Git SHA1 commit hash of the release (set via linker flags)
var gitCommit = ""
var gitDate = ""
+
var app *cli.App
func init() {
- app = flags.NewApp(gitCommit, gitDate, "an PlatON-Go key manager")
- app.Commands = []cli.Command{
+ app = flags.NewApp(gitCommit, gitDate, "an PlatON key manager")
+ app.Commands = []*cli.Command{
commandGenerate,
commandInspect,
commandChangePassphrase,
commandSignMessage,
commandVerifyMessage,
- commandGenkeypair,
- commandGenblskeypair,
- commandAddressHexToBech32,
}
- cli.CommandHelpTemplate = flags.OriginCommandHelpTemplate
}
// Commonly used command line flags.
var (
- passphraseFlag = cli.StringFlag{
+ passphraseFlag = &cli.StringFlag{
Name: "passwordfile",
- Usage: "the file that contains the passphrase for the keyfile",
+ Usage: "the file that contains the password for the keyfile",
}
- jsonFlag = cli.BoolFlag{
+ jsonFlag = &cli.BoolFlag{
Name: "json",
Usage: "output JSON instead of human-readable format",
}
)
func main() {
- cli.CommandHelpTemplate = flags.OriginCommandHelpTemplate
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
diff --git a/cmd/keytool/message.go b/cmd/keytool/message.go
index 2004869ebd..32ab926b13 100644
--- a/cmd/keytool/message.go
+++ b/cmd/keytool/message.go
@@ -22,7 +22,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/accounts"
"os"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
@@ -34,12 +34,12 @@ type outputSign struct {
Signature string
}
-var msgfileFlag = cli.StringFlag{
+var msgfileFlag = &cli.StringFlag{
Name: "msgfile",
Usage: "file containing the message to sign/verify",
}
-var commandSignMessage = cli.Command{
+var commandSignMessage = &cli.Command{
Name: "signmessage",
Usage: "sign a message",
ArgsUsage: " ",
@@ -90,7 +90,7 @@ type outputVerify struct {
RecoveredPublicKey string
}
-var commandVerifyMessage = cli.Command{
+var commandVerifyMessage = &cli.Command{
Name: "verifymessage",
Usage: "verify the signature of a signed message",
ArgsUsage: " ",
@@ -153,7 +153,7 @@ It is possible to refer to a file containing the message.`,
func getMessage(ctx *cli.Context, msgarg int) []byte {
if file := ctx.String(msgfileFlag.Name); file != "" {
- if len(ctx.Args()) > msgarg {
+ if ctx.NArg() > msgarg {
utils.Fatalf("Can't use --msgfile and message argument at the same time.")
}
msg, err := os.ReadFile(file)
@@ -161,9 +161,9 @@ func getMessage(ctx *cli.Context, msgarg int) []byte {
utils.Fatalf("Can't read message file: %v", err)
}
return msg
- } else if len(ctx.Args()) == msgarg+1 {
+ } else if ctx.NArg() == msgarg+1 {
return []byte(ctx.Args().Get(msgarg))
}
- utils.Fatalf("Invalid number of arguments: want %d, got %d", msgarg+1, len(ctx.Args()))
+ utils.Fatalf("Invalid number of arguments: want %d, got %d", msgarg+1, ctx.NArg())
return nil
}
diff --git a/cmd/keytool/utils.go b/cmd/keytool/utils.go
index 9055cdbddb..ad7b1d80d4 100644
--- a/cmd/keytool/utils.go
+++ b/cmd/keytool/utils.go
@@ -22,7 +22,7 @@ import (
"os"
"strings"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
)
diff --git a/cmd/p2psim/main.go b/cmd/p2psim/main.go
index e3d5ebce6c..a3c07a2ea7 100644
--- a/cmd/p2psim/main.go
+++ b/cmd/p2psim/main.go
@@ -39,6 +39,7 @@ import (
"context"
"encoding/json"
"fmt"
+ "github.com/PlatONnetwork/PlatON-Go/internal/flags"
"io"
"os"
"strings"
@@ -46,7 +47,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/p2p/enode"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/p2p"
@@ -59,59 +60,64 @@ var client *simulations.Client
var (
// global command flags
- apiFlag = cli.StringFlag{
- Name: "api",
- Value: "http://localhost:8888",
- Usage: "simulation API URL",
- EnvVar: "P2PSIM_API_URL",
+ apiFlag = &cli.StringFlag{
+ Name: "api",
+ Value: "http://localhost:8888",
+ Usage: "simulation API URL",
+ EnvVars: []string{"P2PSIM_API_URL"},
}
// events subcommand flags
- currentFlag = cli.BoolFlag{
+ currentFlag = &cli.BoolFlag{
Name: "current",
Usage: "get existing nodes and conns first",
}
- filterFlag = cli.StringFlag{
+ filterFlag = &cli.StringFlag{
Name: "filter",
Value: "",
Usage: "message filter",
}
// node create subcommand flags
- nameFlag = cli.StringFlag{
+ nameFlag = &cli.StringFlag{
Name: "name",
Value: "",
Usage: "node name",
}
- servicesFlag = cli.StringFlag{
+ servicesFlag = &cli.StringFlag{
Name: "services",
Value: "",
Usage: "node services (comma separated)",
}
- keyFlag = cli.StringFlag{
+ keyFlag = &cli.StringFlag{
Name: "key",
Value: "",
Usage: "node private key (hex encoded)",
}
// node rpc subcommand flags
- subscribeFlag = cli.BoolFlag{
+ subscribeFlag = &cli.BoolFlag{
Name: "subscribe",
Usage: "method is a subscription",
}
)
+var (
+ // Git information set by linker when building with ci.go.
+ gitCommit string
+ gitDate string
+)
+
func main() {
- app := cli.NewApp()
- app.Usage = "devp2p simulation command-line client"
+ app := flags.NewApp(gitCommit, gitDate, "devp2p simulation command-line client")
app.Flags = []cli.Flag{
apiFlag,
}
app.Before = func(ctx *cli.Context) error {
- client = simulations.NewClient(ctx.GlobalString(apiFlag.Name))
+ client = simulations.NewClient(ctx.String(apiFlag.Name))
return nil
}
- app.Commands = []cli.Command{
+ app.Commands = []*cli.Command{
{
Name: "show",
Usage: "show network information",
@@ -140,7 +146,7 @@ func main() {
Name: "node",
Usage: "manage simulation nodes",
Action: listNodes,
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
{
Name: "list",
Usage: "list nodes",
@@ -205,7 +211,7 @@ func main() {
}
func showNetwork(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
network, err := client.GetNetwork()
@@ -220,7 +226,7 @@ func showNetwork(ctx *cli.Context) error {
}
func streamNetwork(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
events := make(chan *simulations.Event)
@@ -246,7 +252,7 @@ func streamNetwork(ctx *cli.Context) error {
}
func createSnapshot(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
snap, err := client.CreateSnapshot()
@@ -257,7 +263,7 @@ func createSnapshot(ctx *cli.Context) error {
}
func loadSnapshot(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
snap := &simulations.Snapshot{}
@@ -268,7 +274,7 @@ func loadSnapshot(ctx *cli.Context) error {
}
func listNodes(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
nodes, err := client.GetNodes()
@@ -293,7 +299,7 @@ func protocolList(node *p2p.NodeInfo) []string {
}
func createNode(ctx *cli.Context) error {
- if len(ctx.Args()) != 0 {
+ if ctx.NArg() != 0 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
config := adapters.RandomNodeConfig()
@@ -318,11 +324,10 @@ func createNode(ctx *cli.Context) error {
}
func showNode(ctx *cli.Context) error {
- args := ctx.Args()
- if len(args) != 1 {
+ if ctx.NArg() != 1 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
+ nodeName := ctx.Args().First()
node, err := client.GetNode(nodeName)
if err != nil {
return err
@@ -343,11 +348,10 @@ func showNode(ctx *cli.Context) error {
}
func startNode(ctx *cli.Context) error {
- args := ctx.Args()
- if len(args) != 1 {
+ if ctx.NArg() != 1 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
+ nodeName := ctx.Args().First()
if err := client.StartNode(nodeName); err != nil {
return err
}
@@ -356,11 +360,10 @@ func startNode(ctx *cli.Context) error {
}
func stopNode(ctx *cli.Context) error {
- args := ctx.Args()
- if len(args) != 1 {
+ if ctx.NArg() != 1 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
+ nodeName := ctx.Args().First()
if err := client.StopNode(nodeName); err != nil {
return err
}
@@ -369,12 +372,12 @@ func stopNode(ctx *cli.Context) error {
}
func connectNode(ctx *cli.Context) error {
- args := ctx.Args()
- if len(args) != 2 {
+ if ctx.NArg() != 2 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
- peerName := args[1]
+ args := ctx.Args()
+ nodeName := args.Get(0)
+ peerName := args.Get(1)
if err := client.ConnectNode(nodeName, peerName); err != nil {
return err
}
@@ -384,11 +387,11 @@ func connectNode(ctx *cli.Context) error {
func disconnectNode(ctx *cli.Context) error {
args := ctx.Args()
- if len(args) != 2 {
+ if args.Len() != 2 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
- peerName := args[1]
+ nodeName := args.Get(0)
+ peerName := args.Get(1)
if err := client.DisconnectNode(nodeName, peerName); err != nil {
return err
}
@@ -398,21 +401,21 @@ func disconnectNode(ctx *cli.Context) error {
func rpcNode(ctx *cli.Context) error {
args := ctx.Args()
- if len(args) < 2 {
+ if args.Len() < 2 {
return cli.ShowCommandHelp(ctx, ctx.Command.Name)
}
- nodeName := args[0]
- method := args[1]
+ nodeName := args.Get(0)
+ method := args.Get(1)
rpcClient, err := client.RPCClient(context.Background(), nodeName)
if err != nil {
return err
}
if ctx.Bool(subscribeFlag.Name) {
- return rpcSubscribe(rpcClient, ctx.App.Writer, method, args[3:]...)
+ return rpcSubscribe(rpcClient, ctx.App.Writer, method, args.Slice()[3:]...)
}
var result interface{}
- params := make([]interface{}, len(args[3:]))
- for i, v := range args[3:] {
+ params := make([]interface{}, len(args.Slice()[3:]))
+ for i, v := range args.Slice()[3:] {
params[i] = v
}
if err := rpcClient.Call(&result, method, params...); err != nil {
diff --git a/cmd/platon/accountcmd.go b/cmd/platon/accountcmd.go
index 9eb4b82665..ccd0953e01 100644
--- a/cmd/platon/accountcmd.go
+++ b/cmd/platon/accountcmd.go
@@ -18,7 +18,8 @@ package main
import (
"fmt"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
+ "os"
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
@@ -29,10 +30,9 @@ import (
)
var (
- accountCommand = cli.Command{
- Name: "account",
- Usage: "Manage accounts",
- Category: "ACCOUNT COMMANDS",
+ accountCommand = &cli.Command{
+ Name: "account",
+ Usage: "Manage accounts",
Description: `
Manage accounts, list all existing accounts, import a private key into a new
@@ -53,11 +53,11 @@ It is safe to transfer the entire directory or the individual keys therein
between PlatON nodes by simply copying.
Make sure you backup your keys regularly.`,
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
{
Name: "list",
Usage: "Print summary of existing accounts",
- Action: utils.MigrateFlags(accountList),
+ Action: accountList,
Flags: []cli.Flag{
utils.DataDirFlag,
utils.KeyStoreDirFlag,
@@ -68,7 +68,7 @@ Print a short summary of all accounts`,
{
Name: "new",
Usage: "Create a new account",
- Action: utils.MigrateFlags(accountCreate),
+ Action: accountCreate,
Flags: []cli.Flag{
utils.DataDirFlag,
utils.KeyStoreDirFlag,
@@ -94,7 +94,7 @@ password to file or expose in any other way.
{
Name: "update",
Usage: "Update an existing account",
- Action: utils.MigrateFlags(accountUpdate),
+ Action: accountUpdate,
ArgsUsage: "",
Flags: []cli.Flag{
utils.DataDirFlag,
@@ -123,7 +123,7 @@ changing your password is only possible interactively.
{
Name: "import",
Usage: "Import a private key into a new account",
- Action: utils.MigrateFlags(accountImport),
+ Action: accountImport,
Flags: []cli.Flag{
utils.DataDirFlag,
utils.KeyStoreDirFlag,
@@ -234,13 +234,12 @@ func accountCreate(ctx *cli.Context) error {
cfg := platonConfig{Node: defaultNodeConfig()}
// Load config file.
- if file := ctx.GlobalString(configFileFlag.Name); file != "" {
+ if file := ctx.String(configFileFlag.Name); file != "" {
if err := loadConfig(file, &cfg); err != nil {
utils.Fatalf("%v", err)
}
}
utils.SetNodeConfig(ctx, &cfg.Node)
-
keydir, err := cfg.Node.KeyDirConfig()
if err != nil {
utils.Fatalf("Failed to read configuration: %v", err)
@@ -272,13 +271,13 @@ func accountCreate(ctx *cli.Context) error {
// accountUpdate transitions an account from a previous format to the current
// one, also providing the possibility to change the pass-phrase.
func accountUpdate(ctx *cli.Context) error {
- if len(ctx.Args()) == 0 {
+ if ctx.Args().Len() == 0 {
utils.Fatalf("No accounts specified to update")
}
stack, _ := makeConfigNode(ctx)
ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
- for _, addr := range ctx.Args() {
+ for _, addr := range ctx.Args().Slice() {
account, oldPassword := unlockAccount(ks, addr, 0, nil)
newPassword := utils.GetPassPhraseWithList("Please give a new password. Do not forget this password.", true, 0, nil)
if err := ks.Update(account, oldPassword, newPassword); err != nil {
@@ -287,12 +286,31 @@ func accountUpdate(ctx *cli.Context) error {
}
return nil
}
+func importWallet(ctx *cli.Context) error {
+ if ctx.Args().Len() != 1 {
+ utils.Fatalf("keyfile must be given as the only argument", "args.count", ctx.Args().Len())
+ }
+ keyfile := ctx.Args().First()
+ keyJSON, err := os.ReadFile(keyfile)
+ if err != nil {
+ utils.Fatalf("Could not read wallet file: %v", err)
+ }
+ stack, _ := makeConfigNode(ctx)
+ passphrase := utils.GetPassPhraseWithList("", false, 0, utils.MakePasswordList(ctx))
+ ks := stack.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore)
+ acct, err := ks.ImportPreSaleKey(keyJSON, passphrase)
+ if err != nil {
+ utils.Fatalf("%v", err)
+ }
+ fmt.Printf("Address: {%x}\n", acct.Address)
+ return nil
+}
func accountImport(ctx *cli.Context) error {
- keyfile := ctx.Args().First()
- if len(keyfile) == 0 {
- utils.Fatalf("keyfile must be given as argument")
+ if ctx.Args().Len() != 1 {
+ utils.Fatalf("keyfile must be given as the only argument", "args.count", ctx.Args().Len())
}
+ keyfile := ctx.Args().First()
key, err := crypto.LoadECDSA(keyfile)
if err != nil {
utils.Fatalf("Failed to load the private key: %v", err)
diff --git a/cmd/platon/accountcmd_test.go b/cmd/platon/accountcmd_test.go
index 80213ad2bd..3371bb8732 100644
--- a/cmd/platon/accountcmd_test.go
+++ b/cmd/platon/accountcmd_test.go
@@ -49,20 +49,27 @@ func TestAccountListEmpty(t *testing.T) {
func TestAccountList(t *testing.T) {
datadir := tmpDatadirWithKeystore(t)
- platon := runPlatON(t, "account", "list", "--datadir", datadir)
- defer platon.ExpectExit()
+ var want = `
+Account #0: {lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
+Account #1: {lat173ngt84dryedws7kyt9hflq93zpwsey2m0wqp6} keystore://{{.Datadir}}/keystore/aaa
+Account #2: {lat19zw5shvhw9c5en536vun6ajwzvgeq7kvh7rqmg} keystore://{{.Datadir}}/keystore/zzz
+`
if runtime.GOOS == "windows" {
- platon.Expect(`
+ want = `
Account #0: {lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32} keystore://{{.Datadir}}\keystore\UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
Account #1: {lat173ngt84dryedws7kyt9hflq93zpwsey2m0wqp6} keystore://{{.Datadir}}\keystore\aaa
Account #2: {lat19zw5shvhw9c5en536vun6ajwzvgeq7kvh7rqmg} keystore://{{.Datadir}}\keystore\zzz
-`)
- } else {
- platon.Expect(`
-Account #0: {lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32} keystore://{{.Datadir}}/keystore/UTC--2016-03-22T12-57-55.920751759Z--7ef5a6135f1fd6a02593eedc869c6d41d934aef8
-Account #1: {lat173ngt84dryedws7kyt9hflq93zpwsey2m0wqp6} keystore://{{.Datadir}}/keystore/aaa
-Account #2: {lat19zw5shvhw9c5en536vun6ajwzvgeq7kvh7rqmg} keystore://{{.Datadir}}/keystore/zzz
-`)
+`
+ }
+ {
+ platon := runPlatON(t, "account", "list", "--datadir", datadir)
+ platon.Expect(want)
+ platon.ExpectExit()
+ }
+ {
+ platon := runPlatON(t, "--datadir", datadir, "account", "list")
+ platon.Expect(want)
+ platon.ExpectExit()
}
}
@@ -105,6 +112,20 @@ func TestAccountImport(t *testing.T) {
}
}
+func TestAccountHelp(t *testing.T) {
+ platon := runPlatON(t, "account", "-h")
+ platon.WaitExit()
+ if have, want := platon.ExitStatus(), 0; have != want {
+ t.Errorf("exit error, have %d want %d", have, want)
+ }
+
+ platon = runPlatON(t, "account", "import", "-h")
+ platon.WaitExit()
+ if have, want := platon.ExitStatus(), 0; have != want {
+ t.Errorf("exit error, have %d want %d", have, want)
+ }
+}
+
func importAccountWithExpect(t *testing.T, key string, expected string) {
dir := t.TempDir()
keyfile := filepath.Join(dir, "key.prv")
@@ -115,7 +136,7 @@ func importAccountWithExpect(t *testing.T, key string, expected string) {
if err := os.WriteFile(passwordFile, []byte("foobar"), 0600); err != nil {
t.Error(err)
}
- platon := runPlatON(t, "account", "import", keyfile, "-password", passwordFile)
+ platon := runPlatON(t, "account", "import", "-password", passwordFile, keyfile)
defer platon.ExpectExit()
platon.Expect(expected)
}
@@ -152,12 +173,12 @@ func TestUnlockFlag(t *testing.T) {
datadir := tmpDatadirWithKeystore(t)
platon := runPlatON(t,
"--datadir", datadir, "--ipcdisable", "--testnet", "--nat", "none", "--nodiscover", "--maxpeers", "60", "--port", "0",
- "--unlock", "lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32",
- "js", "testdata/empty.js")
+ "--unlock", "lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32", "console", "--exec", "loadScript('testdata/empty.js')")
platon.Expect(`
Unlocking account lat10m66vy6lrlt2qfvnamwgd8rdg8vnfthcd74p32 | Attempt 1/3
!! Unsupported terminal, password will be echoed.
Password: {{.InputLine "foobar"}}
+undefined
`)
platon.ExpectExit()
@@ -195,14 +216,14 @@ func TestUnlockFlagMultiIndex(t *testing.T) {
datadir := tmpDatadirWithKeystore(t)
platon := runPlatON(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "60", "--port", "0", "--ipcdisable", "--testnet",
- "--unlock", "0,2",
- "js", "testdata/empty.js")
+ "--unlock", "0,2", "console", "--exec", "loadScript('testdata/empty.js')")
platon.Expect(`
Unlocking account 0 | Attempt 1/3
!! Unsupported terminal, password will be echoed.
Password: {{.InputLine "foobar"}}
Unlocking account 2 | Attempt 1/3
Password: {{.InputLine "foobar"}}
+undefined
`)
platon.ExpectExit()
@@ -223,7 +244,10 @@ func TestUnlockFlagPasswordFile(t *testing.T) {
platon := runPlatON(t,
"--datadir", datadir, "--nat", "none", "--nodiscover", "--maxpeers", "60", "--port", "0",
"--password", "testdata/passwords.txt", "--unlock", "0,2", "--ipcdisable", "--testnet",
- "js", "testdata/empty.js")
+ "console", "--exec", "loadScript('testdata/empty.js')")
+ platon.Expect(`
+undefined
+`)
platon.ExpectExit()
wantMessages := []string{
@@ -254,7 +278,7 @@ func TestUnlockFlagAmbiguous(t *testing.T) {
platon := runPlatON(t,
"--keystore", store, "--nat", "none", "--nodiscover", "--maxpeers", "60", "--port", "0", "--ipcdisable", "--testnet",
"--unlock", "lat173ngt84dryedws7kyt9hflq93zpwsey2m0wqp6",
- "js", "testdata/empty.js")
+ "console", "--exec", "loadScript('testdata/empty.js')")
defer platon.ExpectExit()
// Helper for the expect template, returns absolute keystore path.
@@ -273,6 +297,7 @@ Testing your password against all of them...
Your password unlocked keystore://{{keypath "1"}}
In order to avoid this warning, you need to remove the following duplicate key files:
keystore://{{keypath "2"}}
+undefined
`)
platon.ExpectExit()
diff --git a/cmd/platon/chaincmd.go b/cmd/platon/chaincmd.go
index 28e3900728..2fca4103d4 100644
--- a/cmd/platon/chaincmd.go
+++ b/cmd/platon/chaincmd.go
@@ -29,7 +29,7 @@ import (
"time"
"github.com/PlatONnetwork/PlatON-Go/core/snapshotdb"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/cmd/utils"
"github.com/PlatONnetwork/PlatON-Go/common"
@@ -44,13 +44,12 @@ import (
)
var (
- initCommand = cli.Command{
- Action: utils.MigrateFlags(initGenesis),
+ initCommand = &cli.Command{
+ Action: initGenesis,
Name: "init",
Usage: "Bootstrap and initialize a new genesis block",
ArgsUsage: "",
Flags: utils.DatabasePathFlags,
- Category: "BLOCKCHAIN COMMANDS",
Description: `
The init command initializes a new genesis block and definition for the network.
This is a destructive action and changes the network in which you will be
@@ -58,20 +57,19 @@ participating.
It expects the genesis file as argument.`,
}
- dumpGenesisCommand = cli.Command{
- Action: utils.MigrateFlags(dumpGenesis),
+ dumpGenesisCommand = &cli.Command{
+ Action: dumpGenesis,
Name: "dumpgenesis",
Usage: "Dumps genesis block JSON configuration to stdout",
ArgsUsage: "",
Flags: []cli.Flag{
utils.DataDirFlag,
},
- Category: "BLOCKCHAIN COMMANDS",
Description: `
The dumpgenesis command dumps the genesis block configuration in JSON format to stdout.`,
}
- importPreimagesCommand = cli.Command{
- Action: utils.MigrateFlags(importPreimages),
+ importPreimagesCommand = &cli.Command{
+ Action: importPreimages,
Name: "import-preimages",
Usage: "Import the preimage database from an RLP stream",
ArgsUsage: "",
@@ -79,14 +77,13 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to
utils.CacheFlag,
utils.SyncModeFlag,
}, utils.DatabasePathFlags...),
- Category: "BLOCKCHAIN COMMANDS",
Description: `
The import-preimages command imports hash preimages from an RLP encoded stream.
It's deprecated, please use "geth db import" instead.
`,
}
- exportPreimagesCommand = cli.Command{
- Action: utils.MigrateFlags(exportPreimages),
+ exportPreimagesCommand = &cli.Command{
+ Action: exportPreimages,
Name: "export-preimages",
Usage: "Export the preimage database into an RLP stream",
ArgsUsage: "",
@@ -94,14 +91,13 @@ It's deprecated, please use "geth db import" instead.
utils.CacheFlag,
utils.SyncModeFlag,
}, utils.DatabasePathFlags...),
- Category: "BLOCKCHAIN COMMANDS",
Description: `
The export-preimages command exports hash preimages to an RLP encoded stream.
It's deprecated, please use "geth db export" instead.
`,
}
- dumpCommand = cli.Command{
- Action: utils.MigrateFlags(dump),
+ dumpCommand = &cli.Command{
+ Action: dump,
Name: "dump",
Usage: "Dump a specific block from storage",
ArgsUsage: "[? | ]",
@@ -114,7 +110,6 @@ It's deprecated, please use "geth db export" instead.
utils.StartKeyFlag,
utils.DumpLimitFlag,
}, utils.DatabasePathFlags...),
- Category: "BLOCKCHAIN COMMANDS",
Description: `
This command dumps out the state for a given block (or latest, if none provided).
`,
@@ -140,7 +135,7 @@ func initGenesis(ctx *cli.Context) error {
defer stack.Close()
for _, name := range []string{"chaindata", "lightchaindata"} {
- chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.GlobalString(utils.AncientFlag.Name), "", false)
+ chaindb, err := stack.OpenDatabaseWithFreezer(name, 0, 0, ctx.String(utils.AncientFlag.Name), "", false)
if err != nil {
utils.Fatalf("Failed to open database: %v", err)
}
@@ -196,7 +191,7 @@ func dumpGenesis(ctx *cli.Context) error {
// importPreimages imports preimage data from the specified file.
func importPreimages(ctx *cli.Context) error {
- if len(ctx.Args()) < 1 {
+ if ctx.Args().Len() < 1 {
utils.Fatalf("This command requires an argument.")
}
stack, _ := makeFullNode(ctx)
@@ -214,7 +209,7 @@ func importPreimages(ctx *cli.Context) error {
// exportPreimages dumps the preimage data to specified json file in streaming way.
func exportPreimages(ctx *cli.Context) error {
- if len(ctx.Args()) < 1 {
+ if ctx.Args().Len() < 1 {
utils.Fatalf("This command requires an argument.")
}
stack, _ := makeFullNode(ctx)
diff --git a/cmd/platon/config.go b/cmd/platon/config.go
index 1578c97fd8..2e648d1b92 100644
--- a/cmd/platon/config.go
+++ b/cmd/platon/config.go
@@ -21,9 +21,10 @@ import (
"encoding/json"
"errors"
"fmt"
+ "github.com/PlatONnetwork/PlatON-Go/accounts/external"
"github.com/PlatONnetwork/PlatON-Go/core/rawdb"
+ "github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/PlatONnetwork/PlatON-Go/log"
- "io"
"os"
"reflect"
"unicode"
@@ -38,24 +39,23 @@ import (
"github.com/PlatONnetwork/PlatON-Go/node"
"github.com/PlatONnetwork/PlatON-Go/params"
"github.com/naoina/toml"
- cli "gopkg.in/urfave/cli.v1"
+ cli "github.com/urfave/cli/v2"
)
var (
- dumpConfigCommand = cli.Command{
- Action: utils.MigrateFlags(dumpConfig),
- Name: "dumpconfig",
- Usage: "Show configuration values",
- ArgsUsage: "",
- //Flags: append(append(nodeFlags, rpcFlags...), whisperFlags...),
+ dumpConfigCommand = &cli.Command{
+ Action: dumpConfig,
+ Name: "dumpconfig",
+ Usage: "Show configuration values",
+ ArgsUsage: "",
Flags: utils.GroupFlags(nodeFlags, rpcFlags),
- Category: "MISCELLANEOUS COMMANDS",
Description: `The dumpconfig command shows configuration values.`,
}
- configFileFlag = cli.StringFlag{
- Name: "config",
- Usage: "TOML configuration file",
+ configFileFlag = &cli.StringFlag{
+ Name: "config",
+ Usage: "TOML configuration file",
+ Category: flags.EthCategory,
}
)
@@ -131,9 +131,8 @@ func defaultNodeConfig() node.Config {
return cfg
}
-// makeConfigNode loads platon configuration and creates a blank node instance.
+// makeConfigNode loads geth configuration and creates a blank node instance.
func makeConfigNode(ctx *cli.Context) (*node.Node, platonConfig) {
-
// Load defaults.
cfg := platonConfig{
Eth: ethconfig.Defaults,
@@ -142,7 +141,7 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, platonConfig) {
}
// Load config file.
- if file := ctx.GlobalString(configFileFlag.Name); file != "" {
+ if file := ctx.String(configFileFlag.Name); file != "" {
/* if err := loadConfig(file, &cfg); err != nil {
utils.Fatalf("%v", err)
}*/
@@ -175,8 +174,8 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, platonConfig) {
// cfg.Eth.CbftConfig = *cbftConfig
//}
- //if ctx.GlobalIsSet(utils.EthStatsURLFlag.Name) {
- // cfg.Ethstats.URL = ctx.GlobalString(utils.EthStatsURLFlag.Name)
+ //if ctx.IsSet(utils.EthStatsURLFlag.Name) {
+ // cfg.Ethstats.URL = ctx.String(utils.EthStatsURLFlag.Name)
//}
//utils.SetShhConfig(ctx, stack, &cfg.Shh)
@@ -190,12 +189,11 @@ func makeConfigNode(ctx *cli.Context) (*node.Node, platonConfig) {
func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
stack, cfg := makeConfigNode(ctx)
-
snapshotdb.SetDBPathWithNode(stack.ResolvePath(snapshotdb.DBPath))
backend, eth := utils.RegisterEthService(stack, &cfg.Eth)
// Warn users to migrate if they have a legacy freezer format.
- if eth != nil {
+ if eth != nil && !ctx.IsSet(utils.IgnoreLegacyReceiptsFlag.Name) {
firstIdx := uint64(0)
// Hack to speed up check for mainnet because we know
// the first non-empty block.
@@ -205,15 +203,15 @@ func makeFullNode(ctx *cli.Context) (*node.Node, ethapi.Backend) {
}
isLegacy, _, err := dbHasLegacyReceipts(eth.ChainDb(), firstIdx)
if err != nil {
- utils.Fatalf("Failed to check db for legacy receipts: %v", err)
- }
- if isLegacy {
- log.Warn("Database has receipts with a legacy format. Please run `geth db freezer-migrate`.")
+ log.Error("Failed to check db for legacy receipts", "err", err)
+ } else if isLegacy {
+ stack.Close()
+ utils.Fatalf("Database has receipts with a legacy format. Please run `geth db freezer-migrate`.")
}
}
// Configure GraphQL if requested
- if ctx.GlobalIsSet(utils.GraphQLEnabledFlag.Name) {
+ if ctx.IsSet(utils.GraphQLEnabledFlag.Name) {
utils.RegisterGraphQLService(stack, backend, cfg.Node)
}
@@ -238,53 +236,63 @@ func dumpConfig(ctx *cli.Context) error {
if err != nil {
return err
}
- io.WriteString(os.Stdout, comment)
- os.Stdout.Write(out)
+
+ dump := os.Stdout
+ if ctx.NArg() > 0 {
+ dump, err = os.OpenFile(ctx.Args().Get(0), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644)
+ if err != nil {
+ return err
+ }
+ defer dump.Close()
+ }
+ dump.WriteString(comment)
+ dump.Write(out)
+
return nil
}
func applyMetricConfig(ctx *cli.Context, cfg *platonConfig) {
- if ctx.GlobalIsSet(utils.MetricsEnabledFlag.Name) {
- cfg.Metrics.Enabled = ctx.GlobalBool(utils.MetricsEnabledFlag.Name)
+ if ctx.IsSet(utils.MetricsEnabledFlag.Name) {
+ cfg.Metrics.Enabled = ctx.Bool(utils.MetricsEnabledFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsEnabledExpensiveFlag.Name) {
- cfg.Metrics.EnabledExpensive = ctx.GlobalBool(utils.MetricsEnabledExpensiveFlag.Name)
+ if ctx.IsSet(utils.MetricsEnabledExpensiveFlag.Name) {
+ cfg.Metrics.EnabledExpensive = ctx.Bool(utils.MetricsEnabledExpensiveFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsHTTPFlag.Name) {
- cfg.Metrics.HTTP = ctx.GlobalString(utils.MetricsHTTPFlag.Name)
+ if ctx.IsSet(utils.MetricsHTTPFlag.Name) {
+ cfg.Metrics.HTTP = ctx.String(utils.MetricsHTTPFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsPortFlag.Name) {
- cfg.Metrics.Port = ctx.GlobalInt(utils.MetricsPortFlag.Name)
+ if ctx.IsSet(utils.MetricsPortFlag.Name) {
+ cfg.Metrics.Port = ctx.Int(utils.MetricsPortFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsEnableInfluxDBFlag.Name) {
- cfg.Metrics.EnableInfluxDB = ctx.GlobalBool(utils.MetricsEnableInfluxDBFlag.Name)
+ if ctx.IsSet(utils.MetricsEnableInfluxDBFlag.Name) {
+ cfg.Metrics.EnableInfluxDB = ctx.Bool(utils.MetricsEnableInfluxDBFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBEndpointFlag.Name) {
- cfg.Metrics.InfluxDBEndpoint = ctx.GlobalString(utils.MetricsInfluxDBEndpointFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBEndpointFlag.Name) {
+ cfg.Metrics.InfluxDBEndpoint = ctx.String(utils.MetricsInfluxDBEndpointFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBDatabaseFlag.Name) {
- cfg.Metrics.InfluxDBDatabase = ctx.GlobalString(utils.MetricsInfluxDBDatabaseFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBDatabaseFlag.Name) {
+ cfg.Metrics.InfluxDBDatabase = ctx.String(utils.MetricsInfluxDBDatabaseFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBUsernameFlag.Name) {
- cfg.Metrics.InfluxDBUsername = ctx.GlobalString(utils.MetricsInfluxDBUsernameFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBUsernameFlag.Name) {
+ cfg.Metrics.InfluxDBUsername = ctx.String(utils.MetricsInfluxDBUsernameFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBPasswordFlag.Name) {
- cfg.Metrics.InfluxDBPassword = ctx.GlobalString(utils.MetricsInfluxDBPasswordFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBPasswordFlag.Name) {
+ cfg.Metrics.InfluxDBPassword = ctx.String(utils.MetricsInfluxDBPasswordFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBTagsFlag.Name) {
- cfg.Metrics.InfluxDBTags = ctx.GlobalString(utils.MetricsInfluxDBTagsFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBTagsFlag.Name) {
+ cfg.Metrics.InfluxDBTags = ctx.String(utils.MetricsInfluxDBTagsFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsEnableInfluxDBV2Flag.Name) {
- cfg.Metrics.EnableInfluxDBV2 = ctx.GlobalBool(utils.MetricsEnableInfluxDBV2Flag.Name)
+ if ctx.IsSet(utils.MetricsEnableInfluxDBV2Flag.Name) {
+ cfg.Metrics.EnableInfluxDBV2 = ctx.Bool(utils.MetricsEnableInfluxDBV2Flag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBTokenFlag.Name) {
- cfg.Metrics.InfluxDBToken = ctx.GlobalString(utils.MetricsInfluxDBTokenFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBTokenFlag.Name) {
+ cfg.Metrics.InfluxDBToken = ctx.String(utils.MetricsInfluxDBTokenFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBBucketFlag.Name) {
- cfg.Metrics.InfluxDBBucket = ctx.GlobalString(utils.MetricsInfluxDBBucketFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBBucketFlag.Name) {
+ cfg.Metrics.InfluxDBBucket = ctx.String(utils.MetricsInfluxDBBucketFlag.Name)
}
- if ctx.GlobalIsSet(utils.MetricsInfluxDBOrganizationFlag.Name) {
- cfg.Metrics.InfluxDBOrganization = ctx.GlobalString(utils.MetricsInfluxDBOrganizationFlag.Name)
+ if ctx.IsSet(utils.MetricsInfluxDBOrganizationFlag.Name) {
+ cfg.Metrics.InfluxDBOrganization = ctx.String(utils.MetricsInfluxDBOrganizationFlag.Name)
}
}
@@ -303,6 +311,17 @@ func setAccountManagerBackends(stack *node.Node) error {
scryptP = keystore.LightScryptP
}
+ // Assemble the supported backends
+ if len(conf.ExternalSigner) > 0 {
+ log.Info("Using external signer", "url", conf.ExternalSigner)
+ if extapi, err := external.NewExternalBackend(conf.ExternalSigner); err == nil {
+ am.AddBackend(extapi)
+ return nil
+ } else {
+ return fmt.Errorf("error connecting to external signer: %v", err)
+ }
+ }
+
// For now, we're using EITHER external signer OR local signers.
// If/when we implement some form of lockfile for USB and keystore wallets,
// we can have both, but it's very confusing for the user to see the same
diff --git a/cmd/platon/consolecmd.go b/cmd/platon/consolecmd.go
index 1916f886cb..cfc86d6a76 100644
--- a/cmd/platon/consolecmd.go
+++ b/cmd/platon/consolecmd.go
@@ -22,34 +22,30 @@ import (
"github.com/PlatONnetwork/PlatON-Go/console"
"github.com/PlatONnetwork/PlatON-Go/node"
"github.com/PlatONnetwork/PlatON-Go/rpc"
- "gopkg.in/urfave/cli.v1"
- "path/filepath"
+ "github.com/urfave/cli/v2"
"strings"
)
var (
consoleFlags = []cli.Flag{utils.JSpathFlag, utils.ExecFlag, utils.PreloadJSFlag}
- consoleCommand = cli.Command{
- Action: utils.MigrateFlags(localConsole),
+ consoleCommand = &cli.Command{
+ Action: localConsole,
Name: "console",
Usage: "Start an interactive JavaScript environment",
- //Flags: append(append(append(nodeFlags, rpcFlags...), consoleFlags...), whisperFlags...),
- Flags: utils.GroupFlags(nodeFlags, rpcFlags, consoleFlags),
- Category: "CONSOLE COMMANDS",
+ Flags: utils.GroupFlags(nodeFlags, rpcFlags, consoleFlags),
Description: `
The platon console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.`,
}
- attachCommand = cli.Command{
- Action: utils.MigrateFlags(remoteConsole),
+ attachCommand = &cli.Command{
+ Action: remoteConsole,
Name: "attach",
Usage: "Start an interactive JavaScript environment (connect to node)",
ArgsUsage: "[endpoint]",
Flags: utils.GroupFlags([]cli.Flag{utils.DataDirFlag}, consoleFlags),
- Category: "CONSOLE COMMANDS",
Description: `
The platon console is an interactive shell for the JavaScript runtime environment
which exposes a node admin interface as well as the Ðapp JavaScript API.
@@ -57,13 +53,12 @@ See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console.
This command allows to open a console on a running platon node.`,
}
- javascriptCommand = cli.Command{
- Action: utils.MigrateFlags(ephemeralConsole),
+ javascriptCommand = &cli.Command{
+ Action: ephemeralConsole,
Name: "js",
- Usage: "Execute the specified JavaScript files",
+ Usage: "(DEPRECATED) Execute the specified JavaScript files",
ArgsUsage: " [jsfile...]",
Flags: utils.GroupFlags(nodeFlags, consoleFlags),
- Category: "CONSOLE COMMANDS",
Description: `
The JavaScript VM exposes a node admin interface as well as the Ðapp
JavaScript API. See https://github.com/ethereum/go-ethereum/wiki/JavaScript-Console`,
@@ -85,7 +80,7 @@ func localConsole(ctx *cli.Context) error {
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
- DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
+ DocRoot: ctx.String(utils.JSpathFlag.Name),
Client: client,
Preload: utils.MakeConsolePreloads(ctx),
}
@@ -97,7 +92,7 @@ func localConsole(ctx *cli.Context) error {
defer console.Stop(false)
// If only a short execution was requested, evaluate and return.
- if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
+ if script := ctx.String(utils.ExecFlag.Name); script != "" {
console.Evaluate(script)
return nil
}
@@ -120,16 +115,9 @@ func localConsole(ctx *cli.Context) error {
func remoteConsole(ctx *cli.Context) error {
endpoint := ctx.Args().First()
if endpoint == "" {
- path := node.DefaultDataDir()
- if ctx.GlobalIsSet(utils.DataDirFlag.Name) {
- path = ctx.GlobalString(utils.DataDirFlag.Name)
- }
- if path != "" {
- if ctx.GlobalBool(utils.TestnetFlag.Name) {
- path = filepath.Join(path, "testnet")
- }
- }
- endpoint = fmt.Sprintf("%s/platon.ipc", path)
+ cfg := defaultNodeConfig()
+ utils.SetDataDir(ctx, &cfg)
+ endpoint = cfg.IPCEndpoint()
}
client, err := dialRPC(endpoint)
if err != nil {
@@ -137,7 +125,7 @@ func remoteConsole(ctx *cli.Context) error {
}
config := console.Config{
DataDir: utils.MakeDataDir(ctx),
- DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
+ DocRoot: ctx.String(utils.JSpathFlag.Name),
Client: client,
Preload: utils.MakeConsolePreloads(ctx),
}
@@ -147,7 +135,7 @@ func remoteConsole(ctx *cli.Context) error {
}
defer console.Stop(false)
- if script := ctx.GlobalString(utils.ExecFlag.Name); script != "" {
+ if script := ctx.String(utils.ExecFlag.Name); script != "" {
console.Evaluate(script)
return nil
}
@@ -158,6 +146,19 @@ func remoteConsole(ctx *cli.Context) error {
return nil
}
+// ephemeralConsole starts a new geth node, attaches an ephemeral JavaScript
+// console to it, executes each of the files specified as arguments and tears
+// everything down.
+func ephemeralConsole(ctx *cli.Context) error {
+ var b strings.Builder
+ for _, file := range ctx.Args().Slice() {
+ b.Write([]byte(fmt.Sprintf("loadScript('%s');", file)))
+ }
+ utils.Fatalf(`The "js" command is deprecated. Please use the following instead:
+geth --exec "%s" console`, b.String())
+ return nil
+}
+
// dialRPC returns a RPC client which connects to the given endpoint.
// The check for empty endpoint implements the defaulting logic
// for "platon attach" with no argument.
@@ -171,48 +172,3 @@ func dialRPC(endpoint string) (*rpc.Client, error) {
}
return rpc.Dial(endpoint)
}
-
-// ephemeralConsole starts a new platon node, attaches an ephemeral JavaScript
-// console to it, executes each of the files specified as arguments and tears
-// everything down.
-func ephemeralConsole(ctx *cli.Context) error {
- // Create and start the node based on the CLI flags
- stack, backend := makeFullNode(ctx)
- startNode(ctx, stack, backend, false)
- defer stack.Close()
-
- // Attach to the newly started node and start the JavaScript console
- client, err := stack.Attach()
- if err != nil {
- return fmt.Errorf("Failed to attach to the inproc platon: %v", err)
- }
- config := console.Config{
- DataDir: utils.MakeDataDir(ctx),
- DocRoot: ctx.GlobalString(utils.JSpathFlag.Name),
- Client: client,
- Preload: utils.MakeConsolePreloads(ctx),
- }
-
- console, err := console.New(config)
- if err != nil {
- return fmt.Errorf("Failed to start the JavaScript console: %v", err)
- }
- defer console.Stop(false)
-
- // Interrupt the JS interpreter when node is stopped.
- go func() {
- stack.Wait()
- console.Stop(false)
- }()
-
- // Evaluate each of the specified JavaScript files.
- for _, file := range ctx.Args() {
- if err = console.Execute(file); err != nil {
- return fmt.Errorf("Failed to execute %s: %v", file, err)
- }
- }
-
- // The main script is now done, but keep running timers/callbacks.
- console.Stop(true)
- return nil
-}
diff --git a/cmd/platon/dbcmd.go b/cmd/platon/dbcmd.go
index a6a8a4a18e..6fb3fed865 100644
--- a/cmd/platon/dbcmd.go
+++ b/cmd/platon/dbcmd.go
@@ -41,26 +41,24 @@ import (
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/ethdb"
"github.com/PlatONnetwork/PlatON-Go/log"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- removedbCommand = cli.Command{
- Action: utils.MigrateFlags(removeDB),
+ removedbCommand = &cli.Command{
+ Action: removeDB,
Name: "removedb",
Usage: "Remove blockchain and state databases",
ArgsUsage: "",
Flags: utils.DatabasePathFlags,
- Category: "DATABASE COMMANDS",
Description: `
Remove blockchain and state databases`,
}
- dbCommand = cli.Command{
+ dbCommand = &cli.Command{
Name: "db",
Usage: "Low level database operations",
ArgsUsage: "",
- Category: "DATABASE COMMANDS",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
dbInspectCmd,
dbStatCmd,
dbCompactCmd,
@@ -76,8 +74,8 @@ Remove blockchain and state databases`,
dbCheckStateContentCmd,
},
}
- dbInspectCmd = cli.Command{
- Action: utils.MigrateFlags(inspect),
+ dbInspectCmd = &cli.Command{
+ Action: inspect,
Name: "inspect",
ArgsUsage: " ",
Flags: utils.GroupFlags([]cli.Flag{
@@ -86,8 +84,8 @@ Remove blockchain and state databases`,
Usage: "Inspect the storage size for each type of data in the database",
Description: `This commands iterates the entire database. If the optional 'prefix' and 'start' arguments are provided, then the iteration is limited to the given subset of data.`,
}
- dbCheckStateContentCmd = cli.Command{
- Action: utils.MigrateFlags(checkStateContent),
+ dbCheckStateContentCmd = &cli.Command{
+ Action: checkStateContent,
Name: "check-state-content",
ArgsUsage: "",
Flags: utils.GroupFlags(utils.NetworkFlags, utils.DatabasePathFlags),
@@ -96,16 +94,16 @@ Remove blockchain and state databases`,
For each trie node encountered, it checks that the key corresponds to the keccak256(value). If this is not true, this indicates
a data corruption.`,
}
- dbStatCmd = cli.Command{
- Action: utils.MigrateFlags(dbStats),
+ dbStatCmd = &cli.Command{
+ Action: dbStats,
Name: "stats",
Usage: "Print leveldb statistics",
Flags: utils.GroupFlags([]cli.Flag{
utils.SyncModeFlag,
}, utils.NetworkFlags, utils.DatabasePathFlags),
}
- dbCompactCmd = cli.Command{
- Action: utils.MigrateFlags(dbCompact),
+ dbCompactCmd = &cli.Command{
+ Action: dbCompact,
Name: "compact",
Usage: "Compact leveldb database. WARNING: May take a very long time",
Flags: utils.GroupFlags([]cli.Flag{
@@ -117,8 +115,8 @@ a data corruption.`,
WARNING: This operation may take a very long time to finish, and may cause database
corruption if it is aborted during execution'!`,
}
- dbGetCmd = cli.Command{
- Action: utils.MigrateFlags(dbGet),
+ dbGetCmd = &cli.Command{
+ Action: dbGet,
Name: "get",
Usage: "Show the value of a database key",
ArgsUsage: "",
@@ -127,8 +125,8 @@ corruption if it is aborted during execution'!`,
}, utils.NetworkFlags, utils.DatabasePathFlags),
Description: "This command looks up the specified database key from the database.",
}
- dbDeleteCmd = cli.Command{
- Action: utils.MigrateFlags(dbDelete),
+ dbDeleteCmd = &cli.Command{
+ Action: dbDelete,
Name: "delete",
Usage: "Delete a database key (WARNING: may corrupt your database)",
ArgsUsage: "",
@@ -138,8 +136,8 @@ corruption if it is aborted during execution'!`,
Description: `This command deletes the specified database key from the database.
WARNING: This is a low-level operation which may cause database corruption!`,
}
- dbPutCmd = cli.Command{
- Action: utils.MigrateFlags(dbPut),
+ dbPutCmd = &cli.Command{
+ Action: dbPut,
Name: "put",
Usage: "Set the value of a database key (WARNING: may corrupt your database)",
ArgsUsage: " ",
@@ -149,8 +147,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
Description: `This command sets a given database key to the given value.
WARNING: This is a low-level operation which may cause database corruption!`,
}
- dbGetSlotsCmd = cli.Command{
- Action: utils.MigrateFlags(dbDumpTrie),
+ dbGetSlotsCmd = &cli.Command{
+ Action: dbDumpTrie,
Name: "dumptrie",
Usage: "Show the storage key/values of a given storage trie",
ArgsUsage: " ",
@@ -159,8 +157,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
}, utils.NetworkFlags, utils.DatabasePathFlags),
Description: "This command looks up the specified database key from the database.",
}
- dbDumpFreezerIndex = cli.Command{
- Action: utils.MigrateFlags(freezerInspect),
+ dbDumpFreezerIndex = &cli.Command{
+ Action: freezerInspect,
Name: "freezer-index",
Usage: "Dump out the index of a given freezer type",
ArgsUsage: " ",
@@ -169,8 +167,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
}, utils.NetworkFlags, utils.DatabasePathFlags),
Description: "This command displays information about the freezer index.",
}
- dbImportCmd = cli.Command{
- Action: utils.MigrateFlags(importLDBdata),
+ dbImportCmd = &cli.Command{
+ Action: importLDBdata,
Name: "import",
Usage: "Imports leveldb-data from an exported RLP dump.",
ArgsUsage: " has .gz suffix, gzip compression will be used.",
ArgsUsage: " ",
@@ -189,8 +187,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
}, utils.NetworkFlags, utils.DatabasePathFlags),
Description: "Exports the specified chain data to an RLP encoded stream, optionally gzip-compressed.",
}
- dbMetadataCmd = cli.Command{
- Action: utils.MigrateFlags(showMetaData),
+ dbMetadataCmd = &cli.Command{
+ Action: showMetaData,
Name: "metadata",
Usage: "Shows metadata about the chain status.",
Flags: utils.GroupFlags([]cli.Flag{
@@ -198,8 +196,8 @@ WARNING: This is a low-level operation which may cause database corruption!`,
}, utils.NetworkFlags, utils.DatabasePathFlags),
Description: "Shows metadata about the chain status.",
}
- dbMigrateFreezerCmd = cli.Command{
- Action: utils.MigrateFlags(freezerMigrate),
+ dbMigrateFreezerCmd = &cli.Command{
+ Action: freezerMigrate,
Name: "freezer-migrate",
Usage: "Migrate legacy parts of the freezer. (WARNING: may take a long time)",
ArgsUsage: "",
diff --git a/cmd/platon/main.go b/cmd/platon/main.go
index 874cc10b1d..47a116e4f7 100644
--- a/cmd/platon/main.go
+++ b/cmd/platon/main.go
@@ -30,7 +30,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/console/prompt"
"github.com/panjf2000/ants/v2"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
@@ -58,7 +58,7 @@ var (
gitCommit = ""
gitDate = ""
// The app that holds all commands and flags.
- app = flags.NewApp(gitCommit, gitDate, "the platon-go command line interface")
+ app = flags.NewApp(gitCommit, gitDate, "the PlatON-Go command line interface")
// flags that configure the node
nodeFlags = utils.GroupFlags([]cli.Flag{
utils.IdentityFlag,
@@ -96,6 +96,7 @@ var (
utils.CachePreimagesFlag,
utils.FDLimitFlag,
utils.ListenPortFlag,
+ utils.DiscoveryPortFlag,
utils.MaxPeersFlag,
utils.MaxConsensusPeersFlag,
utils.MaxPendingPeersFlag,
@@ -111,9 +112,7 @@ var (
//utils.EthStatsURLFlag,
//utils.NoCompactionFlag,
utils.GpoBlocksFlag,
- utils.LegacyGpoBlocksFlag,
utils.GpoPercentileFlag,
- utils.LegacyGpoPercentileFlag,
utils.GpoMaxGasPriceFlag,
utils.GpoIgnoreGasPriceFlag,
utils.IgnoreLegacyReceiptsFlag,
@@ -125,8 +124,6 @@ var (
utils.HTTPListenAddrFlag,
utils.HTTPPortFlag,
utils.HTTPCORSDomainFlag,
- utils.AuthHostFlag,
- utils.AuthPortFlag,
utils.JWTSecretFlag,
utils.HTTPVirtualHostsFlag,
utils.GraphQLEnabledFlag,
@@ -137,14 +134,10 @@ var (
utils.HTTPEnabledEthCompatibleFlag,
utils.WSEnabledFlag,
utils.WSListenAddrFlag,
- utils.LegacyWSListenAddrFlag,
utils.WSPortFlag,
- utils.LegacyWSPortFlag,
utils.WSApiFlag,
- utils.LegacyWSApiFlag,
utils.WSAllowedOriginsFlag,
utils.WSPathPrefixFlag,
- utils.LegacyWSAllowedOriginsFlag,
utils.IPCDisabledFlag,
utils.IPCPathFlag,
utils.InsecureUnlockAllowedFlag,
@@ -199,7 +192,7 @@ func init() {
app.Action = platon
app.HideVersion = true // we have a command to print the version
app.Copyright = "Copyright 2023 The PlatON-Go Authors"
- app.Commands = []cli.Command{
+ app.Commands = []*cli.Command{
// See chaincmd.go:
initCommand,
//importCommand,
@@ -228,7 +221,16 @@ func init() {
}
sort.Sort(cli.CommandsByName(app.Commands))
- app.Flags = utils.GroupFlags(nodeFlags, rpcFlags, consoleFlags, debug.Flags, metricsFlags, cbftFlags, dbFlags, vmFlags)
+ app.Flags = utils.GroupFlags(
+ nodeFlags,
+ rpcFlags,
+ consoleFlags,
+ debug.Flags,
+ metricsFlags,
+ cbftFlags,
+ dbFlags,
+ vmFlags,
+ )
app.Before = func(ctx *cli.Context) error {
runtime.GOMAXPROCS(runtime.NumCPU())
@@ -236,7 +238,7 @@ func init() {
if err != nil {
return err
}
-
+ flags.MigrateGlobalFlags(ctx)
if err := debug.Setup(ctx); err != nil {
return err
}
@@ -274,7 +276,7 @@ func main() {
// It creates a default node based on the command line arguments and runs it in
// blocking mode, waiting for it to be shut down.
func platon(ctx *cli.Context) error {
- if args := ctx.Args(); len(args) > 0 {
+ if args := ctx.Args().Slice(); len(args) > 0 {
return fmt.Errorf("invalid command: %q", args[0])
}
stack, backend := makeFullNode(ctx)
@@ -341,7 +343,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
}()
// Start auxiliary services if enabled
// Mining only makes sense if a full Ethereum node is running
- if ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
+ if ctx.String(utils.SyncModeFlag.Name) == "light" {
utils.Fatalf("Light clients do not support mining")
}
ethBackend, ok := backend.(*eth.EthAPIBackend)
@@ -349,7 +351,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
utils.Fatalf("Ethereum service not running")
}
// Set the gas price to the limits from the CLI and start mining
- gasprice := utils.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
+ gasprice := flags.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
ethBackend.TxPool().SetGasPrice(gasprice)
@@ -361,7 +363,7 @@ func startNode(ctx *cli.Context, stack *node.Node, backend ethapi.Backend, isCon
// unlockAccounts unlocks any account specifically requested.
func unlockAccounts(ctx *cli.Context, stack *node.Node) {
var unlocks []string
- inputs := strings.Split(ctx.GlobalString(utils.UnlockedAccountFlag.Name), ",")
+ inputs := strings.Split(ctx.String(utils.UnlockedAccountFlag.Name), ",")
for _, input := range inputs {
if trimmed := strings.TrimSpace(input); trimmed != "" {
unlocks = append(unlocks, trimmed)
diff --git a/cmd/platon/misccmd.go b/cmd/platon/misccmd.go
index 0af116ac41..e5e5dd4b53 100644
--- a/cmd/platon/misccmd.go
+++ b/cmd/platon/misccmd.go
@@ -21,14 +21,13 @@ import (
"os"
"runtime"
- "github.com/PlatONnetwork/PlatON-Go/cmd/utils"
"github.com/PlatONnetwork/PlatON-Go/params"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var (
- versionCommand = cli.Command{
- Action: utils.MigrateFlags(version),
+ versionCommand = &cli.Command{
+ Action: version,
Name: "version",
Usage: "Print version numbers",
ArgsUsage: " ",
@@ -37,8 +36,8 @@ var (
The output of this command is supposed to be machine-readable.
`,
}
- licenseCommand = cli.Command{
- Action: utils.MigrateFlags(license),
+ licenseCommand = &cli.Command{
+ Action: license,
Name: "license",
Usage: "Display license information",
ArgsUsage: " ",
diff --git a/cmd/platon/snapshot.go b/cmd/platon/snapshot.go
index 8bc2f0d4c7..101f56afc6 100644
--- a/cmd/platon/snapshot.go
+++ b/cmd/platon/snapshot.go
@@ -34,7 +34,7 @@ import (
"github.com/PlatONnetwork/PlatON-Go/log"
"github.com/PlatONnetwork/PlatON-Go/rlp"
"github.com/PlatONnetwork/PlatON-Go/trie"
- cli "gopkg.in/urfave/cli.v1"
+ cli "github.com/urfave/cli/v2"
)
var (
@@ -46,18 +46,16 @@ var (
)
var (
- snapshotCommand = cli.Command{
+ snapshotCommand = &cli.Command{
Name: "snapshot",
Usage: "A set of commands based on the snapshot",
- Category: "MISCELLANEOUS COMMANDS",
Description: "",
- Subcommands: []cli.Command{
+ Subcommands: []*cli.Command{
{
Name: "prune-state",
Usage: "Prune stale ethereum state data based on the snapshot",
ArgsUsage: "",
- Action: utils.MigrateFlags(pruneState),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: pruneState,
Flags: utils.GroupFlags([]cli.Flag{
utils.CacheTrieJournalFlag,
utils.BloomFilterSizeFlag,
@@ -81,8 +79,7 @@ the trie clean cache with default directory will be deleted.
Name: "verify-state",
Usage: "Recalculate state hash based on the snapshot for verification",
ArgsUsage: "",
- Action: utils.MigrateFlags(verifyState),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: verifyState,
Flags: utils.GroupFlags(utils.NetworkFlags, utils.DatabasePathFlags),
Description: `
platon snapshot verify-state
@@ -95,8 +92,7 @@ In other words, this command does the snapshot to trie conversion.
Name: "check-dangling-storage",
Usage: "Check that there is no 'dangling' snap storage",
ArgsUsage: "",
- Action: utils.MigrateFlags(checkDanglingStorage),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: checkDanglingStorage,
Flags: utils.GroupFlags(utils.NetworkFlags, utils.DatabasePathFlags),
Description: `
geth snapshot check-dangling-storage traverses the snap storage
@@ -107,8 +103,7 @@ data, and verifies that all snapshot storage data has a corresponding account.
Name: "inspect-account",
Usage: "Check all snapshot layers for the a specific account",
ArgsUsage: "",
- Action: utils.MigrateFlags(checkAccount),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: checkAccount,
Flags: utils.GroupFlags(utils.DatabasePathFlags),
Description: `
geth snapshot inspect-account checks all snapshot layers and prints out
@@ -119,8 +114,7 @@ information about the specified address.
Name: "traverse-state",
Usage: "Traverse the state with given root hash and perform quick verification",
ArgsUsage: "",
- Action: utils.MigrateFlags(traverseState),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: traverseState,
Flags: utils.GroupFlags(utils.NetworkFlags, utils.DatabasePathFlags),
Description: `
platon snapshot traverse-state
@@ -135,8 +129,7 @@ It's also usable without snapshot enabled.
Name: "traverse-rawstate",
Usage: "Traverse the state with given root hash and perform detailed verification",
ArgsUsage: "",
- Action: utils.MigrateFlags(traverseRawState),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: traverseRawState,
Flags: utils.GroupFlags(utils.NetworkFlags, utils.DatabasePathFlags),
Description: `
platon snapshot traverse-rawstate
@@ -152,8 +145,7 @@ It's also usable without snapshot enabled.
Name: "dump",
Usage: "Dump a specific block from storage (same as 'geth dump' but using snapshots)",
ArgsUsage: "[? | ]",
- Action: utils.MigrateFlags(dumpState),
- Category: "MISCELLANEOUS COMMANDS",
+ Action: dumpState,
Flags: utils.GroupFlags([]cli.Flag{
utils.ExcludeCodeFlag,
utils.ExcludeStorageFlag,
@@ -177,7 +169,7 @@ func pruneState(ctx *cli.Context) error {
defer stack.Close()
chaindb := utils.MakeChainDatabase(ctx, stack, false)
- pruner, err := pruner.NewPruner(chaindb, stack.ResolvePath(""), stack.ResolvePath(config.Eth.TrieCleanCacheJournal), ctx.GlobalUint64(utils.BloomFilterSizeFlag.Name))
+ pruner, err := pruner.NewPruner(chaindb, stack.ResolvePath(""), stack.ResolvePath(config.Eth.TrieCleanCacheJournal), ctx.Uint64(utils.BloomFilterSizeFlag.Name))
if err != nil {
log.Error("Failed to open snapshot tree", "err", err)
return err
@@ -188,7 +180,7 @@ func pruneState(ctx *cli.Context) error {
}
var targetRoot common.Hash
if ctx.NArg() == 1 {
- targetRoot, err = parseRoot(ctx.Args()[0])
+ targetRoot, err = parseRoot(ctx.Args().First())
if err != nil {
log.Error("Failed to resolve state root", "err", err)
return err
@@ -222,7 +214,7 @@ func verifyState(ctx *cli.Context) error {
}
var root = headBlock.Root()
if ctx.NArg() == 1 {
- root, err = parseRoot(ctx.Args()[0])
+ root, err = parseRoot(ctx.Args().First())
if err != nil {
log.Error("Failed to resolve state root", "err", err)
return err
@@ -267,7 +259,7 @@ func traverseState(ctx *cli.Context) error {
err error
)
if ctx.NArg() == 1 {
- root, err = parseRoot(ctx.Args()[0])
+ root, err = parseRoot(ctx.Args().First())
if err != nil {
log.Error("Failed to resolve state root", "err", err)
return err
@@ -356,7 +348,7 @@ func traverseRawState(ctx *cli.Context) error {
err error
)
if ctx.NArg() == 1 {
- root, err = parseRoot(ctx.Args()[0])
+ root, err = parseRoot(ctx.Args().First())
if err != nil {
log.Error("Failed to resolve state root", "err", err)
return err
@@ -558,12 +550,12 @@ func checkAccount(ctx *cli.Context) error {
hash common.Hash
addr common.Address
)
- switch len(ctx.Args()[0]) {
+ switch arg := ctx.Args().First(); len(arg) {
case 40, 42:
- addr = common.HexToAddress(ctx.Args()[0])
+ addr = common.HexToAddress(ctx.Args().First())
hash = crypto.Keccak256Hash(addr.Bytes())
case 64, 66:
- hash = common.HexToHash(ctx.Args()[0])
+ hash = common.HexToHash(ctx.Args().First())
default:
return errors.New("malformed address or hash")
}
diff --git a/cmd/platon/usage.go b/cmd/platon/usage.go
deleted file mode 100644
index 7c907fc860..0000000000
--- a/cmd/platon/usage.go
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright 2015 The go-ethereum Authors
-// This file is part of go-ethereum.
-//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// go-ethereum 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
-
-// Contains the platon command usage template and generator.
-
-package main
-
-import (
- "io"
- "sort"
-
- "github.com/PlatONnetwork/PlatON-Go/internal/flags"
-
- "gopkg.in/urfave/cli.v1"
-
- "github.com/PlatONnetwork/PlatON-Go/cmd/utils"
-)
-
-// AppHelpFlagGroups is the application flags, grouped by functionality.
-var AppHelpFlagGroups = []flags.FlagGroup{
- {
- Name: "PLATON",
- Flags: utils.GroupFlags([]cli.Flag{
- configFileFlag,
- utils.MinFreeDiskSpaceFlag,
- utils.KeyStoreDirFlag,
- utils.NetworkIdFlag,
- utils.SyncModeFlag,
- // utils.EthStatsURLFlag,
- utils.IdentityFlag,
- utils.TxLookupLimitFlag,
- utils.LightKDFFlag,
- }, utils.NetworkFlags, utils.DatabasePathFlags),
- },
- {
- Name: "TRANSACTION POOL",
- Flags: []cli.Flag{
- utils.TxPoolLocalsFlag,
- utils.TxPoolNoLocalsFlag,
- utils.TxPoolJournalFlag,
- utils.TxPoolRejournalFlag,
- utils.TxPoolPriceBumpFlag,
- utils.TxPoolAccountSlotsFlag,
- utils.TxPoolGlobalSlotsFlag,
- utils.TxPoolAccountQueueFlag,
- utils.TxPoolGlobalQueueFlag,
- utils.TxPoolGlobalTxCountFlag,
- utils.TxPoolLifetimeFlag,
- utils.TxPoolCacheSizeFlag,
- },
- },
- {
- Name: "PERFORMANCE TUNING",
- Flags: []cli.Flag{
- utils.CacheFlag,
- utils.CacheDatabaseFlag,
- utils.CacheTrieFlag,
- utils.CacheTrieJournalFlag,
- utils.CacheTrieRejournalFlag,
- utils.CacheGCFlag,
- utils.CacheSnapshotFlag,
- utils.CacheTrieDBFlag,
- utils.CachePreimagesFlag,
- utils.FDLimitFlag,
- },
- },
- {
- Name: "ACCOUNT",
- Flags: []cli.Flag{
- utils.UnlockedAccountFlag,
- utils.PasswordFileFlag,
- utils.InsecureUnlockAllowedFlag,
- },
- },
- {
- Name: "API AND CONSOLE",
- Flags: []cli.Flag{
- utils.IPCDisabledFlag,
- utils.IPCPathFlag,
- utils.HTTPEnabledFlag,
- utils.HTTPListenAddrFlag,
- utils.HTTPPortFlag,
- utils.HTTPApiFlag,
- utils.HTTPEnabledEthCompatibleFlag,
- utils.HTTPPathPrefixFlag,
- utils.HTTPCORSDomainFlag,
- utils.HTTPVirtualHostsFlag,
- utils.WSEnabledFlag,
- utils.WSListenAddrFlag,
- utils.WSPortFlag,
- utils.WSApiFlag,
- utils.WSPathPrefixFlag,
- utils.WSAllowedOriginsFlag,
- utils.JWTSecretFlag,
- utils.AuthHostFlag,
- utils.AuthPortFlag,
- utils.GraphQLEnabledFlag,
- utils.GraphQLCORSDomainFlag,
- utils.GraphQLVirtualHostsFlag,
- utils.RPCGlobalGasCapFlag,
- utils.RPCGlobalEVMTimeoutFlag,
- utils.RPCGlobalTxFeeCapFlag,
- utils.JSpathFlag,
- utils.ExecFlag,
- utils.PreloadJSFlag,
- utils.AllowUnprotectedTxs,
- },
- },
- {
- Name: "NETWORKING",
- Flags: []cli.Flag{
- utils.BootnodesFlag,
- utils.BootnodesV4Flag,
- // utils.BootnodesV5Flag,
- // utils.DNSDiscoveryFlag,
- utils.ListenPortFlag,
- utils.MaxPeersFlag,
- utils.MaxConsensusPeersFlag,
- utils.MaxPendingPeersFlag,
- utils.NATFlag,
- utils.NoDiscoverFlag,
- // utils.DiscoveryV5Flag,
- utils.NetrestrictFlag,
- utils.NodeKeyFileFlag,
- utils.NodeKeyHexFlag,
- },
- },
- {
- Name: "MINER",
- Flags: []cli.Flag{
- utils.MinerGasPriceFlag,
- },
- },
- {
- Name: "GAS PRICE ORACLE",
- Flags: []cli.Flag{
- utils.GpoBlocksFlag,
- utils.GpoPercentileFlag,
- utils.GpoMaxGasPriceFlag,
- utils.GpoIgnoreGasPriceFlag,
- },
- },
- /* {
- Name: "LOGGING AND DEBUGGING",
- Flags: append([]cli.Flag{
- utils.NoCompactionFlag,
- }, debug.Flags...),
- },*/
- {
- Name: "METRICS AND STATS",
- Flags: metricsFlags,
- },
- {
- Name: "CBFT",
- Flags: []cli.Flag{
- utils.CbftPeerMsgQueueSize,
- utils.CbftWalDisabledFlag,
- utils.CbftMaxPingLatency,
- utils.CbftBlsPriKeyFileFlag,
- utils.CbftBlacklistDeadlineFlag,
- },
- },
- {
- Name: "DB",
- Flags: []cli.Flag{
- utils.DBNoGCFlag,
- utils.DBGCIntervalFlag,
- utils.DBGCTimeoutFlag,
- utils.DBGCMptFlag,
- utils.DBGCBlockFlag,
- utils.DBValidatorsHistoryFlag,
- },
- },
- {
- Name: "VM",
- Flags: []cli.Flag{
- utils.VMWasmType,
- utils.VmTimeoutDuration,
- },
- },
- {
- Name: "ALIASED (deprecated)",
- Flags: append([]cli.Flag{
- utils.LegacyWSListenAddrFlag,
- utils.LegacyWSPortFlag,
- utils.LegacyWSAllowedOriginsFlag,
- utils.LegacyWSApiFlag,
- utils.LegacyGpoBlocksFlag,
- utils.LegacyGpoPercentileFlag,
- }),
- },
- {
- Name: "MISC",
- Flags: []cli.Flag{
- utils.IgnoreLegacyReceiptsFlag,
- cli.HelpFlag,
- },
- },
-}
-
-func init() {
- // Override the default app help template
- cli.AppHelpTemplate = flags.AppHelpTemplate
-
- // Override the default app help printer, but only for the global app help
- originalHelpPrinter := cli.HelpPrinter
- cli.HelpPrinter = func(w io.Writer, tmpl string, data interface{}) {
- if tmpl == flags.AppHelpTemplate {
- // Iterate over all the flags and add any uncategorized ones
- categorized := make(map[string]struct{})
- for _, group := range AppHelpFlagGroups {
- for _, flag := range group.Flags {
- categorized[flag.String()] = struct{}{}
- }
- }
- deprecated := make(map[string]struct{})
- for _, flag := range utils.DeprecatedFlags {
- deprecated[flag.String()] = struct{}{}
- }
- // Only add uncategorized flags if they are not deprecated
- var uncategorized []cli.Flag
- for _, flag := range data.(*cli.App).Flags {
- if _, ok := categorized[flag.String()]; !ok {
- if _, ok := deprecated[flag.String()]; !ok {
- uncategorized = append(uncategorized, flag)
- }
- }
- }
- if len(uncategorized) > 0 {
- // Append all ungategorized options to the misc group
- miscs := len(AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags)
- AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags = append(AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags, uncategorized...)
-
- // Make sure they are removed afterwards
- defer func() {
- AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags = AppHelpFlagGroups[len(AppHelpFlagGroups)-1].Flags[:miscs]
- }()
- }
- // Render out custom usage screen
- originalHelpPrinter(w, tmpl, flags.HelpData{App: data, FlagGroups: AppHelpFlagGroups})
- } else if tmpl == flags.CommandHelpTemplate {
- // Iterate over all command specific flags and categorize them
- categorized := make(map[string][]cli.Flag)
- for _, flag := range data.(cli.Command).Flags {
- if _, ok := categorized[flag.String()]; !ok {
- categorized[flags.FlagCategory(flag, AppHelpFlagGroups)] = append(categorized[flags.FlagCategory(flag, AppHelpFlagGroups)], flag)
- }
- }
-
- // sort to get a stable ordering
- sorted := make([]flags.FlagGroup, 0, len(categorized))
- for cat, flgs := range categorized {
- sorted = append(sorted, flags.FlagGroup{Name: cat, Flags: flgs})
- }
- sort.Sort(flags.ByCategory(sorted))
-
- // add sorted array to data and render with default printer
- originalHelpPrinter(w, tmpl, map[string]interface{}{
- "cmd": data,
- "categorizedFlags": sorted,
- })
- } else {
- originalHelpPrinter(w, tmpl, data)
- }
- }
-}
diff --git a/cmd/utils/cmd.go b/cmd/utils/cmd.go
index b3716220ba..c648188af4 100644
--- a/cmd/utils/cmd.go
+++ b/cmd/utils/cmd.go
@@ -31,7 +31,7 @@ import (
"time"
"github.com/PlatONnetwork/PlatON-Go/eth/ethconfig"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
"github.com/PlatONnetwork/PlatON-Go/common"
"github.com/PlatONnetwork/PlatON-Go/core"
@@ -79,10 +79,10 @@ func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
defer signal.Stop(sigc)
minFreeDiskSpace := 2 * ethconfig.Defaults.TrieDirtyCache // Default 2 * 256Mb
- if ctx.GlobalIsSet(MinFreeDiskSpaceFlag.Name) {
- minFreeDiskSpace = ctx.GlobalInt(MinFreeDiskSpaceFlag.Name)
- } else if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
- minFreeDiskSpace = 2 * ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
+ if ctx.IsSet(MinFreeDiskSpaceFlag.Name) {
+ minFreeDiskSpace = ctx.Int(MinFreeDiskSpaceFlag.Name)
+ } else if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheGCFlag.Name) {
+ minFreeDiskSpace = 2 * ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100
}
if minFreeDiskSpace > 0 {
go monitorFreeDiskSpace(sigc, stack.InstanceDir(), uint64(minFreeDiskSpace)*1024*1024)
@@ -119,6 +119,9 @@ func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
}
func monitorFreeDiskSpace(sigc chan os.Signal, path string, freeDiskSpaceCritical uint64) {
+ if path == "" {
+ return
+ }
for {
freeSpace, err := getFreeDiskSpace(path)
if err != nil {
@@ -182,7 +185,7 @@ func ImportChain(chain *core.BlockChain, fn string) error {
for batch := 0; ; batch++ {
// Load a batch of RLP blocks.
if checkInterrupt() {
- return fmt.Errorf("interrupted")
+ return errors.New("interrupted")
}
i := 0
for ; i < importBatchSize; i++ {
@@ -205,15 +208,21 @@ func ImportChain(chain *core.BlockChain, fn string) error {
}
// Import the batch.
if checkInterrupt() {
- return fmt.Errorf("interrupted")
+ return errors.New("interrupted")
}
missing := missingBlocks(chain, blocks[:i])
if len(missing) == 0 {
log.Info("Skipping batch as all blocks present", "batch", batch, "first", blocks[0].Hash(), "last", blocks[i-1].Hash())
continue
}
- if _, err := chain.InsertChain(missing); err != nil {
- return fmt.Errorf("invalid block %d: %v", n, err)
+ if failindex, err := chain.InsertChain(missing); err != nil {
+ var failnumber uint64
+ if failindex > 0 && failindex < len(missing) {
+ failnumber = missing[failindex].NumberU64()
+ } else {
+ failnumber = missing[0].NumberU64()
+ }
+ return fmt.Errorf("invalid block %d: %v", failnumber, err)
}
}
return nil
diff --git a/cmd/utils/cmd_test.go b/cmd/utils/cmd_test.go
deleted file mode 100644
index 02cc86c7a8..0000000000
--- a/cmd/utils/cmd_test.go
+++ /dev/null
@@ -1,59 +0,0 @@
-package utils
-
-import (
- "testing"
-)
-
-func TestImportChain(t *testing.T) {
- /*
- rootDir := "/tmp/testchain" + strconv.Itoa(int(time.Now().UnixNano()))
-
- sourceDir := rootDir + "_1"
-
- fileName := "000001.log"
-
- cbft := consensus.NewFaker()
-
- sdb, err := ethdb.NewLDBDatabase(sourceDir, 0, 0)
- if err != nil {
- Fatalf("Open db from file, dir: %s, err: %v", sourceDir, err)
- }
-
- genesis := core.DefaultGenesisBlock()
- genesisBlock := genesis.MustCommit(sdb)
-
- chain1, err := core.NewBlockChain(sdb, nil, params.TestChainConfig, cbft, vm.Config{}, nil)
- if err != nil {
- Fatalf("Can't create source BlockChain: %v", err)
- }
-
- // inserChain
- // Full block-chain requested
-
- blocks, _ := core.GenerateChain(params.TestChainConfig, types.NewBlockWithHeader(genesisBlock.Header()), cbft, sdb, 100, func(i int, b *core.BlockGen) {
- b.SetCoinbase(common.Address{0: byte(12), 19: byte(i)})
- })
-
- _, err = chain1.InsertChain(blocks)
-
- if nil != err {
- Fatalf("Failed to InsertChain: %v", err)
- }
-
- //chainDb := ethdb.NewMemDatabase()
-
- chainDb, err := ethdb.NewLDBDatabase(rootDir+"_2", 0, 0)
- if err != nil {
- Fatalf("Open db from file, dir: %s, err: %v", sourceDir, err)
- }
-
- genesis.MustCommit(chainDb)
-
- chain2, err := core.NewBlockChain(chainDb, nil, params.TestChainConfig, cbft, vm.Config{}, nil)
- if err != nil {
- Fatalf("Can't create target BlockChain: %v", err)
- }
-
- err = ImportChain(chain2, sourceDir+"/"+fileName)
- fmt.Println("importchain: " + err.Error())*/
-}
diff --git a/cmd/utils/customflags.go b/cmd/utils/customflags.go
deleted file mode 100644
index 4d6e35a282..0000000000
--- a/cmd/utils/customflags.go
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright 2015 The go-ethereum Authors
-// This file is part of go-ethereum.
-//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// go-ethereum 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
-
-package utils
-
-import (
- "encoding"
- "errors"
- "flag"
- "math/big"
- "os"
- "os/user"
- "path"
- "strings"
-
- "github.com/PlatONnetwork/PlatON-Go/common/math"
- "gopkg.in/urfave/cli.v1"
-)
-
-// Custom type which is registered in the flags library which cli uses for
-// argument parsing. This allows us to expand Value to an absolute path when
-// the argument is parsed
-type DirectoryString string
-
-func (s *DirectoryString) String() string {
- return string(*s)
-}
-
-func (s *DirectoryString) Set(value string) error {
- *s = DirectoryString(expandPath(value))
- return nil
-}
-
-// Custom cli.Flag type which expand the received string to an absolute path.
-// e.g. ~/.ethereum -> /home/username/.ethereum
-type DirectoryFlag struct {
- Name string
- Value DirectoryString
- Usage string
- EnvVar string
-}
-
-func (f DirectoryFlag) String() string {
- return cli.FlagStringer(f)
-}
-
-// called by cli library, grabs variable from environment (if in env)
-// and adds variable to flag set for parsing.
-func (f DirectoryFlag) Apply(set *flag.FlagSet) {
- eachName(f.Name, func(name string) {
- set.Var(&f.Value, f.Name, f.Usage)
- })
-}
-
-func (f DirectoryFlag) GetName() string {
- return f.Name
-}
-
-func (f *DirectoryFlag) Set(value string) {
- f.Value.Set(value)
-}
-
-func eachName(longName string, fn func(string)) {
- parts := strings.Split(longName, ",")
- for _, name := range parts {
- name = strings.Trim(name, " ")
- fn(name)
- }
-}
-
-type TextMarshaler interface {
- encoding.TextMarshaler
- encoding.TextUnmarshaler
-}
-
-// textMarshalerVal turns a TextMarshaler into a flag.Value
-type textMarshalerVal struct {
- v TextMarshaler
-}
-
-func (v textMarshalerVal) String() string {
- if v.v == nil {
- return ""
- }
- text, _ := v.v.MarshalText()
- return string(text)
-}
-
-func (v textMarshalerVal) Set(s string) error {
- return v.v.UnmarshalText([]byte(s))
-}
-
-// TextMarshalerFlag wraps a TextMarshaler value.
-type TextMarshalerFlag struct {
- Name string
- Value TextMarshaler
- Usage string
- EnvVar string
-}
-
-func (f TextMarshalerFlag) GetName() string {
- return f.Name
-}
-
-func (f TextMarshalerFlag) String() string {
- return cli.FlagStringer(f)
-}
-
-func (f TextMarshalerFlag) Apply(set *flag.FlagSet) {
- eachName(f.Name, func(name string) {
- set.Var(textMarshalerVal{f.Value}, f.Name, f.Usage)
- })
-}
-
-// GlobalTextMarshaler returns the value of a TextMarshalerFlag from the global flag set.
-func GlobalTextMarshaler(ctx *cli.Context, name string) TextMarshaler {
- val := ctx.GlobalGeneric(name)
- if val == nil {
- return nil
- }
- return val.(textMarshalerVal).v
-}
-
-// BigFlag is a command line flag that accepts 256 bit big integers in decimal or
-// hexadecimal syntax.
-type BigFlag struct {
- Name string
- Value *big.Int
- Usage string
- EnvVar string
-}
-
-// bigValue turns *big.Int into a flag.Value
-type bigValue big.Int
-
-func (b *bigValue) String() string {
- if b == nil {
- return ""
- }
- return (*big.Int)(b).String()
-}
-
-func (b *bigValue) Set(s string) error {
- int, ok := math.ParseBig256(s)
- if !ok {
- return errors.New("invalid integer syntax")
- }
- *b = (bigValue)(*int)
- return nil
-}
-
-func (f BigFlag) GetName() string {
- return f.Name
-}
-
-func (f BigFlag) String() string {
- return cli.FlagStringer(f)
-}
-
-func (f BigFlag) Apply(set *flag.FlagSet) {
- eachName(f.Name, func(name string) {
- set.Var((*bigValue)(f.Value), f.Name, f.Usage)
- })
-}
-
-// GlobalBig returns the value of a BigFlag from the global flag set.
-func GlobalBig(ctx *cli.Context, name string) *big.Int {
- val := ctx.GlobalGeneric(name)
- if val == nil {
- return nil
- }
- return (*big.Int)(val.(*bigValue))
-}
-
-func prefixFor(name string) (prefix string) {
- if len(name) == 1 {
- prefix = "-"
- } else {
- prefix = "--"
- }
-
- return
-}
-
-func prefixedNames(fullName string) (prefixed string) {
- parts := strings.Split(fullName, ",")
- for i, name := range parts {
- name = strings.Trim(name, " ")
- prefixed += prefixFor(name) + name
- if i < len(parts)-1 {
- prefixed += ", "
- }
- }
- return
-}
-
-// Expands a file path
-// 1. replace tilde with users home dir
-// 2. expands embedded environment variables
-// 3. cleans the path, e.g. /a/b/../c -> /a/c
-// Note, it has limitations, e.g. ~someuser/tmp will not be expanded
-func expandPath(p string) string {
- if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
- if home := HomeDir(); home != "" {
- p = home + p[1:]
- }
- }
- return path.Clean(os.ExpandEnv(p))
-}
-
-func HomeDir() string {
- if home := os.Getenv("HOME"); home != "" {
- return home
- }
- if usr, err := user.Current(); err == nil {
- return usr.HomeDir
- }
- return ""
-}
diff --git a/cmd/utils/customflags_test.go b/cmd/utils/customflags_test.go
deleted file mode 100644
index de39ca36a1..0000000000
--- a/cmd/utils/customflags_test.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The go-ethereum Authors
-// This file is part of go-ethereum.
-//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// go-ethereum 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 General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
-
-package utils
-
-import (
- "os"
- "os/user"
- "testing"
-)
-
-func TestPathExpansion(t *testing.T) {
- user, _ := user.Current()
- tests := map[string]string{
- "/home/someuser/tmp": "/home/someuser/tmp",
- "~/tmp": user.HomeDir + "/tmp",
- "~thisOtherUser/b/": "~thisOtherUser/b",
- "$DDDXXX/a/b": "/tmp/a/b",
- "/a/b/": "/a/b",
- }
- os.Setenv("DDDXXX", "/tmp")
- for test, expected := range tests {
- got := expandPath(test)
- if got != expected {
- t.Errorf("test %s, got %s, expected %s\n", test, got, expected)
- }
- }
-}
diff --git a/cmd/utils/diskusage.go b/cmd/utils/diskusage.go
index b1cf07c073..0e88f91944 100644
--- a/cmd/utils/diskusage.go
+++ b/cmd/utils/diskusage.go
@@ -1,21 +1,21 @@
// Copyright 2021 The go-ethereum Authors
-// This file is part of the go-ethereum library.
+// This file is part of go-ethereum.
//
-// 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
+// go-ethereum is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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,
+// go-ethereum 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.
+// GNU 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 .
+// You should have received a copy of the GNU General Public License
+// along with go-ethereum. If not, see .
-//go:build !windows
-// +build !windows
+//go:build !windows && !openbsd
+// +build !windows,!openbsd
package utils
@@ -32,5 +32,13 @@ func getFreeDiskSpace(path string) (uint64, error) {
}
// Available blocks * size per block = available space in bytes
- return stat.Bavail * uint64(stat.Bsize), nil
+ var bavail = stat.Bavail
+ // nolint:staticcheck
+ if stat.Bavail < 0 {
+ // FreeBSD can have a negative number of blocks available
+ // because of the grace limit.
+ bavail = 0
+ }
+ //nolint:unconvert
+ return uint64(bavail) * uint64(stat.Bsize), nil
}
diff --git a/cmd/utils/diskuage_windows.go b/cmd/utils/diskusage_windows.go
similarity index 63%
rename from cmd/utils/diskuage_windows.go
rename to cmd/utils/diskusage_windows.go
index 9bf7740b99..db31449323 100644
--- a/cmd/utils/diskuage_windows.go
+++ b/cmd/utils/diskusage_windows.go
@@ -1,18 +1,18 @@
// Copyright 2021 The go-ethereum Authors
-// This file is part of the go-ethereum library.
+// This file is part of go-ethereum.
//
-// 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
+// go-ethereum is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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,
+// go-ethereum 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.
+// GNU 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 .
+// You should have received a copy of the GNU General Public License
+// along with go-ethereum. If not, see .
package utils
diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go
index c6a83d9bab..619a0d6744 100644
--- a/cmd/utils/flags.go
+++ b/cmd/utils/flags.go
@@ -20,35 +20,6 @@ package utils
import (
"crypto/ecdsa"
"fmt"
- "github.com/PlatONnetwork/PlatON-Go/eth/tracers"
- "github.com/PlatONnetwork/PlatON-Go/ethdb/remotedb"
- "io"
- "math"
- "math/big"
- "os"
- "path/filepath"
- godebug "runtime/debug"
- "strconv"
- "strings"
- "text/tabwriter"
- "text/template"
- "time"
-
- "github.com/PlatONnetwork/PlatON-Go/eth/ethconfig"
- "github.com/PlatONnetwork/PlatON-Go/internal/flags"
-
- "github.com/PlatONnetwork/PlatON-Go/metrics/exp"
- "github.com/PlatONnetwork/PlatON-Go/p2p/enode"
-
- "github.com/PlatONnetwork/PlatON-Go/graphql"
- "github.com/PlatONnetwork/PlatON-Go/internal/ethapi"
-
- "github.com/PlatONnetwork/PlatON-Go/miner"
-
- "github.com/PlatONnetwork/PlatON-Go/core/snapshotdb"
-
- "gopkg.in/urfave/cli.v1"
-
"github.com/PlatONnetwork/PlatON-Go/accounts"
"github.com/PlatONnetwork/PlatON-Go/accounts/keystore"
"github.com/PlatONnetwork/PlatON-Go/common"
@@ -56,53 +27,45 @@ import (
"github.com/PlatONnetwork/PlatON-Go/consensus"
"github.com/PlatONnetwork/PlatON-Go/consensus/cbft/types"
"github.com/PlatONnetwork/PlatON-Go/core"
+ "github.com/PlatONnetwork/PlatON-Go/core/snapshotdb"
types2 "github.com/PlatONnetwork/PlatON-Go/core/types"
"github.com/PlatONnetwork/PlatON-Go/core/vm"
"github.com/PlatONnetwork/PlatON-Go/crypto"
"github.com/PlatONnetwork/PlatON-Go/crypto/bls"
"github.com/PlatONnetwork/PlatON-Go/eth"
"github.com/PlatONnetwork/PlatON-Go/eth/downloader"
+ "github.com/PlatONnetwork/PlatON-Go/eth/ethconfig"
"github.com/PlatONnetwork/PlatON-Go/eth/gasprice"
+ "github.com/PlatONnetwork/PlatON-Go/eth/tracers"
"github.com/PlatONnetwork/PlatON-Go/ethdb"
+ "github.com/PlatONnetwork/PlatON-Go/ethdb/remotedb"
"github.com/PlatONnetwork/PlatON-Go/ethstats"
+ "github.com/PlatONnetwork/PlatON-Go/graphql"
+ "github.com/PlatONnetwork/PlatON-Go/internal/ethapi"
+ "github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/PlatONnetwork/PlatON-Go/log"
"github.com/PlatONnetwork/PlatON-Go/metrics"
+ "github.com/PlatONnetwork/PlatON-Go/metrics/exp"
"github.com/PlatONnetwork/PlatON-Go/metrics/influxdb"
+ "github.com/PlatONnetwork/PlatON-Go/miner"
"github.com/PlatONnetwork/PlatON-Go/node"
"github.com/PlatONnetwork/PlatON-Go/p2p"
+ "github.com/PlatONnetwork/PlatON-Go/p2p/enode"
"github.com/PlatONnetwork/PlatON-Go/p2p/nat"
"github.com/PlatONnetwork/PlatON-Go/p2p/netutil"
"github.com/PlatONnetwork/PlatON-Go/params"
gopsutil "github.com/shirou/gopsutil/mem"
-)
-
-func init() {
- cli.AppHelpTemplate = `{{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...]
-
-VERSION:
- {{.Version}}
-
-COMMANDS:
- {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
- {{end}}{{if .Flags}}
-GLOBAL OPTIONS:
- {{range .Flags}}{{.}}
- {{end}}{{end}}
-`
- cli.CommandHelpTemplate = flags.CommandHelpTemplate
- cli.HelpPrinter = printHelp
-}
+ "math"
+ "math/big"
+ "os"
+ "path/filepath"
+ godebug "runtime/debug"
+ "strconv"
+ "strings"
+ "time"
-func printHelp(out io.Writer, templ string, data interface{}) {
- funcMap := template.FuncMap{"join": strings.Join}
- t := template.Must(template.New("help").Funcs(funcMap).Parse(templ))
- w := tabwriter.NewWriter(out, 38, 8, 2, ' ', 0)
- err := t.Execute(w, data)
- if err != nil {
- panic(err)
- }
- w.Flush()
-}
+ "github.com/urfave/cli/v2"
+)
// These are all the command line flags we support.
// If you add to this list, please remember to include the
@@ -113,407 +76,498 @@ func printHelp(out io.Writer, templ string, data interface{}) {
var (
// General settings
- DataDirFlag = DirectoryFlag{
- Name: "datadir",
- Usage: "Data directory for the databases and keystore",
- Value: DirectoryString(node.DefaultDataDir()),
- }
- RemoteDBFlag = cli.StringFlag{
- Name: "remotedb",
- Usage: "URL for remote database",
- }
- AncientFlag = DirectoryFlag{
- Name: "datadir.ancient",
- Usage: "Data directory for ancient chain segments (default = inside chaindata)",
- }
- MinFreeDiskSpaceFlag = DirectoryFlag{
- Name: "datadir.minfreedisk",
- Usage: "Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)",
- }
- KeyStoreDirFlag = DirectoryFlag{
- Name: "keystore",
- Usage: "Directory for the keystore (default = inside the datadir)",
- }
- NetworkIdFlag = cli.Uint64Flag{
- Name: "networkid",
- Usage: "Explicitly set network id (integer)",
- Value: ethconfig.Defaults.NetworkId,
- }
- MainnetFlag = cli.BoolFlag{
- Name: "main",
- Usage: "Mainnet network: pre-configured main network (default network)",
- }
- TestnetFlag = cli.BoolFlag{
- Name: "testnet",
- Usage: "Testnet network: pre-configured test network",
- }
- AddressHRPFlag = cli.StringFlag{
- Name: "addressHRP",
- Usage: "set the address hrp,if not set,use default address hrp",
- }
- IdentityFlag = cli.StringFlag{
- Name: "identity",
- Usage: "Custom node name",
- }
- DocRootFlag = DirectoryFlag{
- Name: "docroot",
- Usage: "Document Root for HTTPClient file scheme",
- Value: DirectoryString(HomeDir()),
- }
- IterativeOutputFlag = cli.BoolTFlag{
+ DataDirFlag = &flags.DirectoryFlag{
+ Name: "datadir",
+ Usage: "Data directory for the databases and keystore",
+ Value: flags.DirectoryString(node.DefaultDataDir()),
+ Category: flags.EthCategory,
+ }
+ RemoteDBFlag = &cli.StringFlag{
+ Name: "remotedb",
+ Usage: "URL for remote database",
+ Category: flags.LoggingCategory,
+ }
+ AncientFlag = &flags.DirectoryFlag{
+ Name: "datadir.ancient",
+ Usage: "Data directory for ancient chain segments (default = inside chaindata)",
+ Category: flags.EthCategory,
+ }
+ MinFreeDiskSpaceFlag = &flags.DirectoryFlag{
+ Name: "datadir.minfreedisk",
+ Usage: "Minimum free disk space in MB, once reached triggers auto shut down (default = --cache.gc converted to MB, 0 = disabled)",
+ Category: flags.EthCategory,
+ }
+ KeyStoreDirFlag = &flags.DirectoryFlag{
+ Name: "keystore",
+ Usage: "Directory for the keystore (default = inside the datadir)",
+ Category: flags.AccountCategory,
+ }
+ NetworkIdFlag = &cli.Uint64Flag{
+ Name: "networkid",
+ Usage: "Explicitly set network id (integer)",
+ Value: ethconfig.Defaults.NetworkId,
+ Category: flags.EthCategory,
+ }
+ MainnetFlag = &cli.BoolFlag{
+ Name: "mainnet",
+ Usage: "Ethereum mainnet",
+ Category: flags.EthCategory,
+ }
+ TestnetFlag = &cli.BoolFlag{
+ Name: "testnet",
+ Usage: "Testnet network: pre-configured test network",
+ Category: flags.EthCategory,
+ }
+ AddressHRPFlag = &cli.StringFlag{
+ Name: "addressHRP",
+ Usage: "set the address hrp,if not set,use default address hrp",
+ Category: flags.EthCategory,
+ }
+ IdentityFlag = &cli.StringFlag{
+ Name: "identity",
+ Usage: "Custom node name",
+ Category: flags.NetworkingCategory,
+ }
+ DocRootFlag = &flags.DirectoryFlag{
+ Name: "docroot",
+ Usage: "Document Root for HTTPClient file scheme",
+ Value: flags.DirectoryString(flags.HomeDir()),
+ Category: flags.APICategory,
+ }
+ ExitWhenSyncedFlag = &cli.BoolFlag{
+ Name: "exitwhensynced",
+ Usage: "Exits after block synchronisation completes",
+ Category: flags.EthCategory,
+ }
+
+ // Dump command options.
+ IterativeOutputFlag = &cli.BoolFlag{
Name: "iterative",
Usage: "Print streaming JSON iteratively, delimited by newlines",
+ Value: true,
}
- ExcludeStorageFlag = cli.BoolFlag{
+ ExcludeStorageFlag = &cli.BoolFlag{
Name: "nostorage",
Usage: "Exclude storage entries (save db lookups)",
}
- IncludeIncompletesFlag = cli.BoolFlag{
+ IncludeIncompletesFlag = &cli.BoolFlag{
Name: "incompletes",
Usage: "Include accounts for which we don't have the address (missing preimage)",
}
- ExcludeCodeFlag = cli.BoolFlag{
+ ExcludeCodeFlag = &cli.BoolFlag{
Name: "nocode",
Usage: "Exclude contract code (save db lookups)",
}
- StartKeyFlag = cli.StringFlag{
+ StartKeyFlag = &cli.StringFlag{
Name: "start",
Usage: "Start position. Either a hash or address",
Value: "0x0000000000000000000000000000000000000000000000000000000000000000",
}
- DumpLimitFlag = cli.Uint64Flag{
+ DumpLimitFlag = &cli.Uint64Flag{
Name: "limit",
Usage: "Max number of elements (0 = no limit)",
Value: 0,
}
defaultSyncMode = ethconfig.Defaults.SyncMode
- SyncModeFlag = TextMarshalerFlag{
- Name: "syncmode",
- Usage: `Blockchain sync mode ("snap", "full")`,
- Value: &defaultSyncMode,
- }
- TxLookupLimitFlag = cli.Uint64Flag{
- Name: "txlookuplimit",
- Usage: "Number of recent blocks to maintain transactions index by-hash for (default = index all blocks)",
- Value: 0,
- }
- LightKDFFlag = cli.BoolFlag{
- Name: "lightkdf",
- Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
+
+ SyncModeFlag = &flags.TextMarshalerFlag{
+ Name: "syncmode",
+ Usage: `Blockchain sync mode ("snap", "full")`,
+ Value: &defaultSyncMode,
+ Category: flags.EthCategory,
+ }
+ GCModeFlag = &cli.StringFlag{
+ Name: "gcmode",
+ Usage: `Blockchain garbage collection mode ("full", "archive")`,
+ Value: "full",
+ Category: flags.EthCategory,
+ }
+ SnapshotFlag = &cli.BoolFlag{
+ Name: "snapshot",
+ Usage: `Enables snapshot-database mode (default = enable)`,
+ Value: true,
+ Category: flags.EthCategory,
+ }
+ TxLookupLimitFlag = &cli.Uint64Flag{
+ Name: "txlookuplimit",
+ Usage: "Number of recent blocks to maintain transactions index for (default = about one year, 0 = entire chain)",
+ Value: ethconfig.Defaults.TxLookupLimit,
+ Category: flags.EthCategory,
+ }
+ LightKDFFlag = &cli.BoolFlag{
+ Name: "lightkdf",
+ Usage: "Reduce key-derivation RAM & CPU usage at some expense of KDF strength",
+ Category: flags.AccountCategory,
}
// Transaction pool settings
- TxPoolLocalsFlag = cli.StringFlag{
- Name: "txpool.locals",
- Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)",
- }
- TxPoolNoLocalsFlag = cli.BoolFlag{
- Name: "txpool.nolocals",
- Usage: "Disables price exemptions for locally submitted transactions",
- }
- TxPoolJournalFlag = cli.StringFlag{
- Name: "txpool.journal",
- Usage: "Disk journal for local transaction to survive node restarts",
- Value: core.DefaultTxPoolConfig.Journal,
- }
- TxPoolRejournalFlag = cli.DurationFlag{
- Name: "txpool.rejournal",
- Usage: "Time interval to regenerate the local transaction journal",
- Value: core.DefaultTxPoolConfig.Rejournal,
- }
- TxPoolPriceBumpFlag = cli.Uint64Flag{
- Name: "txpool.pricebump",
- Usage: "Price bump percentage to replace an already existing transaction",
- Value: ethconfig.Defaults.TxPool.PriceBump,
- }
- TxPoolAccountSlotsFlag = cli.Uint64Flag{
- Name: "txpool.accountslots",
- Usage: "Minimum number of executable transaction slots guaranteed per account",
- Value: ethconfig.Defaults.TxPool.AccountSlots,
- }
- TxPoolGlobalSlotsFlag = cli.Uint64Flag{
- Name: "txpool.globalslots",
- Usage: "Maximum number of executable transaction slots for all accounts",
- Value: ethconfig.Defaults.TxPool.GlobalSlots,
- }
- TxPoolAccountQueueFlag = cli.Uint64Flag{
- Name: "txpool.accountqueue",
- Usage: "Maximum number of non-executable transaction slots permitted per account",
- Value: ethconfig.Defaults.TxPool.AccountQueue,
- }
- TxPoolGlobalQueueFlag = cli.Uint64Flag{
- Name: "txpool.globalqueue",
- Usage: "Maximum number of non-executable transaction slots for all accounts",
- Value: ethconfig.Defaults.TxPool.GlobalQueue,
- }
- TxPoolGlobalTxCountFlag = cli.Uint64Flag{
- Name: "txpool.globaltxcount",
- Usage: "Maximum number of transactions for package",
- Value: ethconfig.Defaults.TxPool.GlobalTxCount,
- }
- TxPoolLifetimeFlag = cli.DurationFlag{
- Name: "txpool.lifetime",
- Usage: "Maximum amount of time non-executable transaction are queued",
- Value: ethconfig.Defaults.TxPool.Lifetime,
- }
- TxPoolCacheSizeFlag = cli.Uint64Flag{
- Name: "txpool.cacheSize",
- Usage: "After receiving the specified number of transactions from the remote, move the transactions in the queen to pending",
- Value: ethconfig.Defaults.TxPool.TxCacheSize,
+ TxPoolLocalsFlag = &cli.StringFlag{
+ Name: "txpool.locals",
+ Usage: "Comma separated accounts to treat as locals (no flush, priority inclusion)",
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolNoLocalsFlag = &cli.BoolFlag{
+ Name: "txpool.nolocals",
+ Usage: "Disables price exemptions for locally submitted transactions",
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolJournalFlag = &cli.StringFlag{
+ Name: "txpool.journal",
+ Usage: "Disk journal for local transaction to survive node restarts",
+ Value: core.DefaultTxPoolConfig.Journal,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolRejournalFlag = &cli.DurationFlag{
+ Name: "txpool.rejournal",
+ Usage: "Time interval to regenerate the local transaction journal",
+ Value: core.DefaultTxPoolConfig.Rejournal,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolPriceLimitFlag = &cli.Uint64Flag{
+ Name: "txpool.pricelimit",
+ Usage: "Minimum gas price limit to enforce for acceptance into the pool",
+ Value: ethconfig.Defaults.TxPool.PriceLimit,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolPriceBumpFlag = &cli.Uint64Flag{
+ Name: "txpool.pricebump",
+ Usage: "Price bump percentage to replace an already existing transaction",
+ Value: ethconfig.Defaults.TxPool.PriceBump,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolAccountSlotsFlag = &cli.Uint64Flag{
+ Name: "txpool.accountslots",
+ Usage: "Minimum number of executable transaction slots guaranteed per account",
+ Value: ethconfig.Defaults.TxPool.AccountSlots,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolGlobalSlotsFlag = &cli.Uint64Flag{
+ Name: "txpool.globalslots",
+ Usage: "Maximum number of executable transaction slots for all accounts",
+ Value: ethconfig.Defaults.TxPool.GlobalSlots,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolAccountQueueFlag = &cli.Uint64Flag{
+ Name: "txpool.accountqueue",
+ Usage: "Maximum number of non-executable transaction slots permitted per account",
+ Value: ethconfig.Defaults.TxPool.AccountQueue,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolGlobalQueueFlag = &cli.Uint64Flag{
+ Name: "txpool.globalqueue",
+ Usage: "Maximum number of non-executable transaction slots for all accounts",
+ Value: ethconfig.Defaults.TxPool.GlobalQueue,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolGlobalTxCountFlag = &cli.Uint64Flag{
+ Name: "txpool.globaltxcount",
+ Usage: "Maximum number of transactions for package",
+ Value: ethconfig.Defaults.TxPool.GlobalTxCount,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolLifetimeFlag = &cli.DurationFlag{
+ Name: "txpool.lifetime",
+ Usage: "Maximum amount of time non-executable transaction are queued",
+ Value: ethconfig.Defaults.TxPool.Lifetime,
+ Category: flags.TxPoolCategory,
+ }
+ TxPoolCacheSizeFlag = &cli.Uint64Flag{
+ Name: "txpool.cacheSize",
+ Usage: "After receiving the specified number of transactions from the remote, move the transactions in the queen to pending",
+ Value: ethconfig.Defaults.TxPool.TxCacheSize,
+ Category: flags.TxPoolCategory,
}
// Performance tuning settings
- CacheFlag = cli.IntFlag{
- Name: "cache",
- Usage: "Megabytes of memory allocated to internal caching",
- Value: 1024,
- }
- CacheDatabaseFlag = cli.IntFlag{
- Name: "cache.database",
- Usage: "Percentage of cache memory allowance to use for database io",
- Value: 50,
- }
- CacheTrieFlag = cli.IntFlag{
- Name: "cache.trie",
- Usage: "Percentage of cache memory allowance to use for trie caching",
- Value: 25,
- }
- CacheTrieJournalFlag = cli.StringFlag{
- Name: "cache.trie.journal",
- Usage: "Disk journal directory for trie cache to survive node restarts",
- Value: ethconfig.Defaults.TrieCleanCacheJournal,
- }
- CacheTrieRejournalFlag = cli.DurationFlag{
- Name: "cache.trie.rejournal",
- Usage: "Time interval to regenerate the trie cache journal",
- Value: ethconfig.Defaults.TrieCleanCacheRejournal,
- }
- SnapshotFlag = cli.BoolTFlag{
- Name: "snapshot",
- Usage: `Enables snapshot-database mode (default = enable)`,
- }
- BloomFilterSizeFlag = cli.Uint64Flag{
- Name: "bloomfilter.size",
- Usage: "Megabytes of memory allocated to bloom-filter for pruning",
- Value: 2048,
- }
- CacheGCFlag = cli.IntFlag{
- Name: "cache.gc",
- Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
- Value: 25,
- }
- CacheSnapshotFlag = cli.IntFlag{
- Name: "cache.snapshot",
- Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)",
- Value: 10,
- }
- CacheTrieDBFlag = cli.IntFlag{
- Name: "cache.triedb",
- Usage: "Megabytes of memory allocated to triedb internal caching",
- Value: ethconfig.Defaults.TrieDBCache,
- }
- CachePreimagesFlag = cli.BoolFlag{
- Name: "cache.preimages",
- Usage: "Enable recording the SHA3/keccak preimages of trie keys",
- }
- FDLimitFlag = cli.IntFlag{
- Name: "fdlimit",
- Usage: "Raise the open file descriptor resource limit (default = system fd limit)",
- }
- MinerGasPriceFlag = BigFlag{
- Name: "miner.gasprice",
- Usage: "Minimum gas price for mining a transaction",
- Value: ethconfig.Defaults.Miner.GasPrice,
+ CacheFlag = &cli.IntFlag{
+ Name: "cache",
+ Usage: "Megabytes of memory allocated to internal caching (default = 4096 mainnet full node, 128 light mode)",
+ Value: 1024,
+ Category: flags.PerfCategory,
+ }
+ CacheDatabaseFlag = &cli.IntFlag{
+ Name: "cache.database",
+ Usage: "Percentage of cache memory allowance to use for database io",
+ Value: 50,
+ Category: flags.PerfCategory,
+ }
+ CacheTrieFlag = &cli.IntFlag{
+ Name: "cache.trie",
+ Usage: "Percentage of cache memory allowance to use for trie caching (default = 15% full mode, 30% archive mode)",
+ Value: 25,
+ Category: flags.PerfCategory,
+ }
+ CacheTrieJournalFlag = &cli.StringFlag{
+ Name: "cache.trie.journal",
+ Usage: "Disk journal directory for trie cache to survive node restarts",
+ Value: ethconfig.Defaults.TrieCleanCacheJournal,
+ Category: flags.PerfCategory,
+ }
+ CacheTrieRejournalFlag = &cli.DurationFlag{
+ Name: "cache.trie.rejournal",
+ Usage: "Time interval to regenerate the trie cache journal",
+ Value: ethconfig.Defaults.TrieCleanCacheRejournal,
+ Category: flags.PerfCategory,
+ }
+ BloomFilterSizeFlag = &cli.Uint64Flag{
+ Name: "bloomfilter.size",
+ Usage: "Megabytes of memory allocated to bloom-filter for pruning",
+ Value: 2048,
+ Category: flags.EthCategory,
+ }
+ CacheGCFlag = &cli.IntFlag{
+ Name: "cache.gc",
+ Usage: "Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)",
+ Value: 25,
+ Category: flags.PerfCategory,
+ }
+ CacheSnapshotFlag = &cli.IntFlag{
+ Name: "cache.snapshot",
+ Usage: "Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)",
+ Value: 10,
+ Category: flags.PerfCategory,
+ }
+ CacheTrieDBFlag = &cli.IntFlag{
+ Name: "cache.triedb",
+ Usage: "Megabytes of memory allocated to triedb internal caching",
+ Value: ethconfig.Defaults.TrieDBCache,
+ Category: flags.PerfCategory,
+ }
+ CachePreimagesFlag = &cli.BoolFlag{
+ Name: "cache.preimages",
+ Usage: "Enable recording the SHA3/keccak preimages of trie keys",
+ Category: flags.PerfCategory,
+ }
+ FDLimitFlag = &cli.IntFlag{
+ Name: "fdlimit",
+ Usage: "Raise the open file descriptor resource limit (default = system fd limit)",
+ Category: flags.PerfCategory,
+ }
+ MinerGasPriceFlag = &flags.BigFlag{
+ Name: "miner.gasprice",
+ Usage: "Minimum gas price for mining a transaction",
+ Value: ethconfig.Defaults.Miner.GasPrice,
+ Category: flags.MinerCategory,
}
// Account settings
- UnlockedAccountFlag = cli.StringFlag{
- Name: "unlock",
- Usage: "Comma separated list of accounts to unlock",
- Value: "",
- }
- PasswordFileFlag = cli.StringFlag{
- Name: "password",
- Usage: "Password file to use for non-interactive password input",
- Value: "",
- }
- InsecureUnlockAllowedFlag = cli.BoolFlag{
- Name: "allow-insecure-unlock",
- Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
- }
- RPCGlobalGasCapFlag = cli.Uint64Flag{
- Name: "rpc.gascap",
- Usage: "Sets a cap on gas that can be used in platon_call/estimateGas (0=infinite)",
- Value: ethconfig.Defaults.RPCGasCap,
- }
- RPCGlobalEVMTimeoutFlag = cli.DurationFlag{
- Name: "rpc.evmtimeout",
- Usage: "Sets a timeout used for eth_call (0=infinite)",
- Value: ethconfig.Defaults.RPCEVMTimeout,
- }
- RPCGlobalTxFeeCapFlag = cli.Float64Flag{
- Name: "rpc.txfeecap",
- Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
- Value: ethconfig.Defaults.RPCTxFeeCap,
- }
- // Authenticated RPC HTTP settings
- AuthHostFlag = cli.StringFlag{
- Name: "authrpc.host",
- Usage: "Listening address for authenticated APIs",
- Value: node.DefaultConfig.AuthHost,
- }
- AuthPortFlag = cli.IntFlag{
- Name: "authrpc.port",
- Usage: "Listening port for authenticated APIs",
- Value: node.DefaultConfig.AuthPort,
- }
- JWTSecretFlag = cli.StringFlag{
- Name: "authrpc.jwtsecret",
- Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
+ UnlockedAccountFlag = &cli.StringFlag{
+ Name: "unlock",
+ Usage: "Comma separated list of accounts to unlock",
+ Value: "",
+ Category: flags.AccountCategory,
+ }
+ PasswordFileFlag = &cli.StringFlag{
+ Name: "password",
+ Usage: "Password file to use for non-interactive password input",
+ Value: "",
+ Category: flags.AccountCategory,
+ }
+ InsecureUnlockAllowedFlag = &cli.BoolFlag{
+ Name: "allow-insecure-unlock",
+ Usage: "Allow insecure account unlocking when account-related RPCs are exposed by http",
+ Category: flags.AccountCategory,
+ }
+ // API options.
+ RPCGlobalGasCapFlag = &cli.Uint64Flag{
+ Name: "rpc.gascap",
+ Usage: "Sets a cap on gas that can be used in eth_call/estimateGas (0=infinite)",
+ Value: ethconfig.Defaults.RPCGasCap,
+ Category: flags.APICategory,
+ }
+ RPCGlobalEVMTimeoutFlag = &cli.DurationFlag{
+ Name: "rpc.evmtimeout",
+ Usage: "Sets a timeout used for eth_call (0=infinite)",
+ Value: ethconfig.Defaults.RPCEVMTimeout,
+ Category: flags.APICategory,
+ }
+ RPCGlobalTxFeeCapFlag = &cli.Float64Flag{
+ Name: "rpc.txfeecap",
+ Usage: "Sets a cap on transaction fee (in ether) that can be sent via the RPC APIs (0 = no cap)",
+ Value: ethconfig.Defaults.RPCTxFeeCap,
+ Category: flags.APICategory,
+ }
+ JWTSecretFlag = &cli.StringFlag{
+ Name: "authrpc.jwtsecret",
+ Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
+ Category: flags.APICategory,
}
// Logging and debug settings
- EthStatsURLFlag = cli.StringFlag{
- Name: "ethstats",
- Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
+ EthStatsURLFlag = &cli.StringFlag{
+ Name: "ethstats",
+ Usage: "Reporting URL of a ethstats service (nodename:secret@host:port)",
+ Category: flags.MetricsCategory,
}
- NoCompactionFlag = cli.BoolFlag{
- Name: "nocompaction",
- Usage: "Disables db compaction after import",
+ NoCompactionFlag = &cli.BoolFlag{
+ Name: "nocompaction",
+ Usage: "Disables db compaction after import",
+ Category: flags.LoggingCategory,
}
- IgnoreLegacyReceiptsFlag = cli.BoolFlag{
- Name: "ignore-legacy-receipts",
- Usage: "Platon will start up even if there are legacy receipts in freezer",
+
+ IgnoreLegacyReceiptsFlag = &cli.BoolFlag{
+ Name: "ignore-legacy-receipts",
+ Usage: "Platon will start up even if there are legacy receipts in freezer",
+ Category: flags.MiscCategory,
}
+
// RPC settings
- IPCDisabledFlag = cli.BoolFlag{
- Name: "ipcdisable",
- Usage: "Disable the IPC-RPC server",
- }
- IPCPathFlag = DirectoryFlag{
- Name: "ipcpath",
- Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
- }
- HTTPEnabledFlag = cli.BoolFlag{
- Name: "http",
- Usage: "Enable the HTTP-RPC server",
- }
- HTTPListenAddrFlag = cli.StringFlag{
- Name: "http.addr",
- Usage: "HTTP-RPC server listening interface",
- Value: node.DefaultHTTPHost,
- }
- HTTPPortFlag = cli.IntFlag{
- Name: "http.port",
- Usage: "HTTP-RPC server listening port",
- Value: node.DefaultHTTPPort,
- }
- HTTPCORSDomainFlag = cli.StringFlag{
- Name: "http.corsdomain",
- Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
- Value: "",
- }
- HTTPVirtualHostsFlag = cli.StringFlag{
- Name: "http.vhosts",
- Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
- Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
- }
- HTTPApiFlag = cli.StringFlag{
- Name: "http.api",
- Usage: "API's offered over the HTTP-RPC interface",
- Value: "",
- }
- HTTPPathPrefixFlag = cli.StringFlag{
- Name: "http.rpcprefix",
- Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
- Value: "",
- }
- HTTPEnabledEthCompatibleFlag = cli.BoolFlag{
- Name: "http.ethcompatible",
- Usage: "Enable eth compatible",
- }
- GraphQLEnabledFlag = cli.BoolFlag{
- Name: "graphql",
- Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",
- }
- GraphQLCORSDomainFlag = cli.StringFlag{
- Name: "graphql.corsdomain",
- Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
- Value: "",
- }
- GraphQLVirtualHostsFlag = cli.StringFlag{
- Name: "graphql.vhosts",
- Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
- Value: strings.Join(node.DefaultConfig.GraphQLVirtualHosts, ","),
- }
- WSEnabledFlag = cli.BoolFlag{
- Name: "ws",
- Usage: "Enable the WS-RPC server",
- }
- WSListenAddrFlag = cli.StringFlag{
- Name: "ws.addr",
- Usage: "WS-RPC server listening interface",
- Value: node.DefaultWSHost,
- }
- WSPortFlag = cli.IntFlag{
- Name: "ws.port",
- Usage: "WS-RPC server listening port",
- Value: node.DefaultWSPort,
- }
- WSApiFlag = cli.StringFlag{
- Name: "ws.api",
- Usage: "API's offered over the WS-RPC interface",
- Value: "",
- }
- WSAllowedOriginsFlag = cli.StringFlag{
- Name: "ws.origins",
- Usage: "Origins from which to accept websockets requests",
- Value: "",
- }
- WSPathPrefixFlag = cli.StringFlag{
- Name: "ws.rpcprefix",
- Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
- Value: "",
- }
- ExecFlag = cli.StringFlag{
- Name: "exec",
- Usage: "Execute JavaScript statement",
- }
- PreloadJSFlag = cli.StringFlag{
- Name: "preload",
- Usage: "Comma separated list of JavaScript files to preload into the console",
+ IPCDisabledFlag = &cli.BoolFlag{
+ Name: "ipcdisable",
+ Usage: "Disable the IPC-RPC server",
+ Category: flags.APICategory,
+ }
+ IPCPathFlag = &flags.DirectoryFlag{
+ Name: "ipcpath",
+ Usage: "Filename for IPC socket/pipe within the datadir (explicit paths escape it)",
+ Category: flags.APICategory,
+ }
+ HTTPEnabledFlag = &cli.BoolFlag{
+ Name: "http",
+ Usage: "Enable the HTTP-RPC server",
+ Category: flags.APICategory,
+ }
+ HTTPListenAddrFlag = &cli.StringFlag{
+ Name: "http.addr",
+ Usage: "HTTP-RPC server listening interface",
+ Value: node.DefaultHTTPHost,
+ Category: flags.APICategory,
+ }
+ HTTPPortFlag = &cli.IntFlag{
+ Name: "http.port",
+ Usage: "HTTP-RPC server listening port",
+ Value: node.DefaultHTTPPort,
+ Category: flags.APICategory,
+ }
+ HTTPCORSDomainFlag = &cli.StringFlag{
+ Name: "http.corsdomain",
+ Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ HTTPVirtualHostsFlag = &cli.StringFlag{
+ Name: "http.vhosts",
+ Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
+ Value: strings.Join(node.DefaultConfig.HTTPVirtualHosts, ","),
+ Category: flags.APICategory,
+ }
+ HTTPApiFlag = &cli.StringFlag{
+ Name: "http.api",
+ Usage: "API's offered over the HTTP-RPC interface",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ HTTPPathPrefixFlag = &cli.StringFlag{
+ Name: "http.rpcprefix",
+ Usage: "HTTP path path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ HTTPEnabledEthCompatibleFlag = &cli.BoolFlag{
+ Name: "http.ethcompatible",
+ Usage: "Enable eth compatible",
+ Category: flags.EthCategory,
+ }
+ GraphQLEnabledFlag = &cli.BoolFlag{
+ Name: "graphql",
+ Usage: "Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well.",
+ Category: flags.APICategory,
+ }
+ GraphQLCORSDomainFlag = &cli.StringFlag{
+ Name: "graphql.corsdomain",
+ Usage: "Comma separated list of domains from which to accept cross origin requests (browser enforced)",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ GraphQLVirtualHostsFlag = &cli.StringFlag{
+ Name: "graphql.vhosts",
+ Usage: "Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard.",
+ Value: strings.Join(node.DefaultConfig.GraphQLVirtualHosts, ","),
+ Category: flags.APICategory,
+ }
+ WSEnabledFlag = &cli.BoolFlag{
+ Name: "ws",
+ Usage: "Enable the WS-RPC server",
+ Category: flags.APICategory,
+ }
+ WSListenAddrFlag = &cli.StringFlag{
+ Name: "ws.addr",
+ Usage: "WS-RPC server listening interface",
+ Value: node.DefaultWSHost,
+ Category: flags.APICategory,
+ }
+ WSPortFlag = &cli.IntFlag{
+ Name: "ws.port",
+ Usage: "WS-RPC server listening port",
+ Value: node.DefaultWSPort,
+ Category: flags.APICategory,
+ }
+ WSApiFlag = &cli.StringFlag{
+ Name: "ws.api",
+ Usage: "API's offered over the WS-RPC interface",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ WSAllowedOriginsFlag = &cli.StringFlag{
+ Name: "ws.origins",
+ Usage: "Origins from which to accept websockets requests",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ WSPathPrefixFlag = &cli.StringFlag{
+ Name: "ws.rpcprefix",
+ Usage: "HTTP path prefix on which JSON-RPC is served. Use '/' to serve on all paths.",
+ Value: "",
+ Category: flags.APICategory,
+ }
+ ExecFlag = &cli.StringFlag{
+ Name: "exec",
+ Usage: "Execute JavaScript statement",
+ Category: flags.APICategory,
+ }
+ PreloadJSFlag = &cli.StringFlag{
+ Name: "preload",
+ Usage: "Comma separated list of JavaScript files to preload into the console",
+ Category: flags.APICategory,
}
AllowUnprotectedTxs = &cli.BoolFlag{
- Name: "rpc.allow-unprotected-txs",
- Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC",
+ Name: "rpc.allow-unprotected-txs",
+ Usage: "Allow for unprotected (non EIP155 signed) transactions to be submitted via RPC",
+ Category: flags.APICategory,
}
// Network Settings
- MaxPeersFlag = cli.IntFlag{
- Name: "maxpeers",
- Usage: "Maximum number of network peers (network disabled if set to 0)",
- Value: node.DefaultConfig.P2P.MaxPeers,
- }
- MaxConsensusPeersFlag = cli.IntFlag{
- Name: "maxconsensuspeers",
- Usage: "Maximum number of network consensus peers (network disabled if set to 0)",
- Value: 40,
- }
- MaxPendingPeersFlag = cli.IntFlag{
- Name: "maxpendpeers",
- Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
- Value: node.DefaultConfig.P2P.MaxPendingPeers,
- }
- ListenPortFlag = cli.IntFlag{
- Name: "port",
- Usage: "Network listening port",
- Value: 16789,
- }
- BootnodesFlag = cli.StringFlag{
- Name: "bootnodes",
- Usage: "Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)",
- Value: "",
- }
- BootnodesV4Flag = cli.StringFlag{
- Name: "bootnodesv4",
- Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
- Value: "",
+ MaxPeersFlag = &cli.IntFlag{
+ Name: "maxpeers",
+ Usage: "Maximum number of network peers (network disabled if set to 0)",
+ Value: node.DefaultConfig.P2P.MaxPeers,
+ Category: flags.NetworkingCategory,
+ }
+ MaxConsensusPeersFlag = &cli.IntFlag{
+ Name: "maxconsensuspeers",
+ Usage: "Maximum number of network consensus peers (network disabled if set to 0)",
+ Value: 40,
+ Category: flags.NetworkingCategory,
+ }
+ MaxPendingPeersFlag = &cli.IntFlag{
+ Name: "maxpendpeers",
+ Usage: "Maximum number of pending connection attempts (defaults used if set to 0)",
+ Value: node.DefaultConfig.P2P.MaxPendingPeers,
+ Category: flags.NetworkingCategory,
+ }
+ ListenPortFlag = &cli.IntFlag{
+ Name: "port",
+ Usage: "Network listening port",
+ Value: 16789,
+ Category: flags.NetworkingCategory,
+ }
+ BootnodesFlag = &cli.StringFlag{
+ Name: "bootnodes",
+ Usage: "Comma separated enode URLs for P2P discovery bootstrap (set v4+v5 instead for light servers)",
+ Value: "",
+ Category: flags.NetworkingCategory,
+ }
+ BootnodesV4Flag = &cli.StringFlag{
+ Name: "bootnodesv4",
+ Usage: "Comma separated enode URLs for P2P v4 discovery bootstrap (light server, full nodes)",
+ Value: "",
+ Category: flags.NetworkingCategory,
}
/*
BootnodesV5Flag = cli.StringFlag{
@@ -521,215 +575,259 @@ var (
Usage: "Comma separated enode URLs for P2P v5 discovery bootstrap (light server, light nodes)",
Value: "",
}*/
- NodeKeyFileFlag = cli.StringFlag{
- Name: "nodekey",
- Usage: "P2P node key file",
- }
- NodeKeyHexFlag = cli.StringFlag{
- Name: "nodekeyhex",
- Usage: "P2P node key as hex (for testing)",
- }
- NATFlag = cli.StringFlag{
- Name: "nat",
- Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:)",
- Value: "any",
- }
- NoDiscoverFlag = cli.BoolFlag{
- Name: "nodiscover",
- Usage: "Disables the peer discovery mechanism (manual peer addition)",
+ NodeKeyFileFlag = &cli.StringFlag{
+ Name: "nodekey",
+ Usage: "P2P node key file",
+ Category: flags.NetworkingCategory,
+ }
+ NodeKeyHexFlag = &cli.StringFlag{
+ Name: "nodekeyhex",
+ Usage: "P2P node key as hex (for testing)",
+ Category: flags.NetworkingCategory,
+ }
+ NATFlag = &cli.StringFlag{
+ Name: "nat",
+ Usage: "NAT port mapping mechanism (any|none|upnp|pmp|extip:)",
+ Value: "any",
+ Category: flags.NetworkingCategory,
+ }
+ NoDiscoverFlag = &cli.BoolFlag{
+ Name: "nodiscover",
+ Usage: "Disables the peer discovery mechanism (manual peer addition)",
+ Category: flags.NetworkingCategory,
}
/*
DiscoveryV5Flag = cli.BoolFlag{
Name: "v5disc",
Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism",
}*/
- NetrestrictFlag = cli.StringFlag{
- Name: "netrestrict",
- Usage: "Restricts network communication to the given IP networks (CIDR masks)",
+ NetrestrictFlag = &cli.StringFlag{
+ Name: "netrestrict",
+ Usage: "Restricts network communication to the given IP networks (CIDR masks)",
+ Category: flags.NetworkingCategory,
}
- DNSDiscoveryFlag = cli.StringFlag{
- Name: "discovery.dns",
- Usage: "Sets DNS discovery entry points (use \"\" to disable DNS)",
+ DNSDiscoveryFlag = &cli.StringFlag{
+ Name: "discovery.dns",
+ Usage: "Sets DNS discovery entry points (use \"\" to disable DNS)",
+ Category: flags.NetworkingCategory,
+ }
+
+ DiscoveryPortFlag = &cli.IntFlag{
+ Name: "discovery.port",
+ Usage: "Use a custom UDP port for P2P discovery",
+ Value: 30303,
+ Category: flags.NetworkingCategory,
}
// ATM the url is left to the user and deployment to
- JSpathFlag = DirectoryFlag{
- Name: "jspath",
- Usage: "JavaScript root path for `loadScript`",
- Value: DirectoryString("."),
+ // Console
+ JSpathFlag = &flags.DirectoryFlag{
+ Name: "jspath",
+ Usage: "JavaScript root path for `loadScript`",
+ Value: flags.DirectoryString("."),
+ Category: flags.APICategory,
}
// Gas price oracle settings
- GpoBlocksFlag = cli.IntFlag{
- Name: "gpo.blocks",
- Usage: "Number of recent blocks to check for gas prices",
- Value: ethconfig.Defaults.GPO.Blocks,
- }
- GpoPercentileFlag = cli.IntFlag{
- Name: "gpo.percentile",
- Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
- Value: ethconfig.Defaults.GPO.Percentile,
- }
- GpoMaxGasPriceFlag = cli.Int64Flag{
- Name: "gpo.maxprice",
- Usage: "Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo",
- Value: ethconfig.Defaults.GPO.MaxPrice.Int64(),
- }
- GpoIgnoreGasPriceFlag = cli.Int64Flag{
- Name: "gpo.ignoreprice",
- Usage: "Gas price below which gpo will ignore transactions",
- Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(),
+ GpoBlocksFlag = &cli.IntFlag{
+ Name: "gpo.blocks",
+ Usage: "Number of recent blocks to check for gas prices",
+ Value: ethconfig.Defaults.GPO.Blocks,
+ Category: flags.GasPriceCategory,
+ }
+ GpoPercentileFlag = &cli.IntFlag{
+ Name: "gpo.percentile",
+ Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices",
+ Value: ethconfig.Defaults.GPO.Percentile,
+ Category: flags.GasPriceCategory,
+ }
+ GpoMaxGasPriceFlag = &cli.Int64Flag{
+ Name: "gpo.maxprice",
+ Usage: "Maximum transaction priority fee (or gasprice before London fork) to be recommended by gpo",
+ Value: ethconfig.Defaults.GPO.MaxPrice.Int64(),
+ Category: flags.GasPriceCategory,
+ }
+ GpoIgnoreGasPriceFlag = &cli.Int64Flag{
+ Name: "gpo.ignoreprice",
+ Usage: "Gas price below which gpo will ignore transactions",
+ Value: ethconfig.Defaults.GPO.IgnorePrice.Int64(),
+ Category: flags.GasPriceCategory,
}
// Metrics flags
- MetricsEnabledFlag = cli.BoolFlag{
- Name: "metrics",
- Usage: "Enable metrics collection and reporting",
+ MetricsEnabledFlag = &cli.BoolFlag{
+ Name: "metrics",
+ Usage: "Enable metrics collection and reporting",
+ Category: flags.MetricsCategory,
}
- MetricsEnabledExpensiveFlag = cli.BoolFlag{
- Name: "metrics.expensive",
- Usage: "Enable expensive metrics collection and reporting",
+ MetricsEnabledExpensiveFlag = &cli.BoolFlag{
+ Name: "metrics.expensive",
+ Usage: "Enable expensive metrics collection and reporting",
+ Category: flags.MetricsCategory,
}
// MetricsHTTPFlag defines the endpoint for a stand-alone metrics HTTP endpoint.
// Since the pprof service enables sensitive/vulnerable behavior, this allows a user
// to enable a public-OK metrics endpoint without having to worry about ALSO exposing
// other profiling behavior or information.
- MetricsHTTPFlag = cli.StringFlag{
- Name: "metrics.addr",
- Usage: "Enable stand-alone metrics HTTP server listening interface",
- Value: metrics.DefaultConfig.HTTP,
- }
- MetricsPortFlag = cli.IntFlag{
- Name: "metrics.port",
- Usage: "Metrics HTTP server listening port",
- Value: metrics.DefaultConfig.Port,
- }
- MetricsEnableInfluxDBFlag = cli.BoolFlag{
- Name: "metrics.influxdb",
- Usage: "Enable metrics export/push to an external InfluxDB database",
- }
- MetricsInfluxDBEndpointFlag = cli.StringFlag{
- Name: "metrics.influxdb.endpoint",
- Usage: "InfluxDB API endpoint to report metrics to",
- Value: metrics.DefaultConfig.InfluxDBEndpoint,
- }
- MetricsInfluxDBDatabaseFlag = cli.StringFlag{
- Name: "metrics.influxdb.database",
- Usage: "InfluxDB database name to push reported metrics to",
- Value: metrics.DefaultConfig.InfluxDBDatabase,
- }
- MetricsInfluxDBUsernameFlag = cli.StringFlag{
- Name: "metrics.influxdb.username",
- Usage: "Username to authorize access to the database",
- Value: metrics.DefaultConfig.InfluxDBUsername,
- }
- MetricsInfluxDBPasswordFlag = cli.StringFlag{
- Name: "metrics.influxdb.password",
- Usage: "Password to authorize access to the database",
- Value: metrics.DefaultConfig.InfluxDBPassword,
+ MetricsHTTPFlag = &cli.StringFlag{
+ Name: "metrics.addr",
+ Usage: "Enable stand-alone metrics HTTP server listening interface",
+ Value: metrics.DefaultConfig.HTTP,
+ Category: flags.MetricsCategory,
+ }
+ MetricsPortFlag = &cli.IntFlag{
+ Name: "metrics.port",
+ Usage: "Metrics HTTP server listening port",
+ Value: metrics.DefaultConfig.Port,
+ Category: flags.MetricsCategory,
+ }
+ MetricsEnableInfluxDBFlag = &cli.BoolFlag{
+ Name: "metrics.influxdb",
+ Usage: "Enable metrics export/push to an external InfluxDB database",
+ Category: flags.MetricsCategory,
+ }
+ MetricsInfluxDBEndpointFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.endpoint",
+ Usage: "InfluxDB API endpoint to report metrics to",
+ Value: metrics.DefaultConfig.InfluxDBEndpoint,
+ Category: flags.MetricsCategory,
+ }
+ MetricsInfluxDBDatabaseFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.database",
+ Usage: "InfluxDB database name to push reported metrics to",
+ Value: metrics.DefaultConfig.InfluxDBDatabase,
+ Category: flags.MetricsCategory,
+ }
+ MetricsInfluxDBUsernameFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.username",
+ Usage: "Username to authorize access to the database",
+ Value: metrics.DefaultConfig.InfluxDBUsername,
+ Category: flags.MetricsCategory,
+ }
+ MetricsInfluxDBPasswordFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.password",
+ Usage: "Password to authorize access to the database",
+ Value: metrics.DefaultConfig.InfluxDBPassword,
+ Category: flags.MetricsCategory,
}
// Tags are part of every measurement sent to InfluxDB. Queries on tags are faster in InfluxDB.
// For example `host` tag could be used so that we can group all nodes and average a measurement
// across all of them, but also so that we can select a specific node and inspect its measurements.
// https://docs.influxdata.com/influxdb/v1.4/concepts/key_concepts/#tag-key
- MetricsInfluxDBTagsFlag = cli.StringFlag{
- Name: "metrics.influxdb.tags",
- Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
- Value: metrics.DefaultConfig.InfluxDBTags,
+ MetricsInfluxDBTagsFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.tags",
+ Usage: "Comma-separated InfluxDB tags (key/values) attached to all measurements",
+ Value: metrics.DefaultConfig.InfluxDBTags,
+ Category: flags.MetricsCategory,
}
- MetricsEnableInfluxDBV2Flag = cli.BoolFlag{
- Name: "metrics.influxdbv2",
- Usage: "Enable metrics export/push to an external InfluxDB v2 database",
+ MetricsEnableInfluxDBV2Flag = &cli.BoolFlag{
+ Name: "metrics.influxdbv2",
+ Usage: "Enable metrics export/push to an external InfluxDB v2 database",
+ Category: flags.MetricsCategory,
}
- MetricsInfluxDBTokenFlag = cli.StringFlag{
- Name: "metrics.influxdb.token",
- Usage: "Token to authorize access to the database (v2 only)",
- Value: metrics.DefaultConfig.InfluxDBToken,
+ MetricsInfluxDBTokenFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.token",
+ Usage: "Token to authorize access to the database (v2 only)",
+ Value: metrics.DefaultConfig.InfluxDBToken,
+ Category: flags.MetricsCategory,
}
- MetricsInfluxDBBucketFlag = cli.StringFlag{
- Name: "metrics.influxdb.bucket",
- Usage: "InfluxDB bucket name to push reported metrics to (v2 only)",
- Value: metrics.DefaultConfig.InfluxDBBucket,
+ MetricsInfluxDBBucketFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.bucket",
+ Usage: "InfluxDB bucket name to push reported metrics to (v2 only)",
+ Value: metrics.DefaultConfig.InfluxDBBucket,
+ Category: flags.MetricsCategory,
}
- MetricsInfluxDBOrganizationFlag = cli.StringFlag{
- Name: "metrics.influxdb.organization",
- Usage: "InfluxDB organization name (v2 only)",
- Value: metrics.DefaultConfig.InfluxDBOrganization,
+ MetricsInfluxDBOrganizationFlag = &cli.StringFlag{
+ Name: "metrics.influxdb.organization",
+ Usage: "InfluxDB organization name (v2 only)",
+ Value: metrics.DefaultConfig.InfluxDBOrganization,
+ Category: flags.MetricsCategory,
}
- CbftPeerMsgQueueSize = cli.Uint64Flag{
- Name: "cbft.msg_queue_size",
- Usage: "Message queue size",
- Value: 1024,
+ CbftPeerMsgQueueSize = &cli.Uint64Flag{
+ Name: "cbft.msg_queue_size",
+ Usage: "Message queue size",
+ Value: 1024,
+ Category: flags.CbftCategory,
}
- CbftWalDisabledFlag = cli.BoolFlag{
- Name: "cbft.wal.disabled",
- Usage: "Disable the Wal server",
+ CbftWalDisabledFlag = &cli.BoolFlag{
+ Name: "cbft.wal.disabled",
+ Usage: "Disable the Wal server",
+ Category: flags.CbftCategory,
}
- CbftMaxPingLatency = cli.Int64Flag{
- Name: "cbft.max_ping_latency",
- Usage: "Maximum latency of ping",
- Value: 2000,
+ CbftMaxPingLatency = &cli.Int64Flag{
+ Name: "cbft.max_ping_latency",
+ Usage: "Maximum latency of ping",
+ Value: 2000,
+ Category: flags.CbftCategory,
}
- CbftBlsPriKeyFileFlag = cli.StringFlag{
- Name: "cbft.blskey",
- Usage: "BLS key file",
+ CbftBlsPriKeyFileFlag = &cli.StringFlag{
+ Name: "cbft.blskey",
+ Usage: "BLS key file",
+ Category: flags.CbftCategory,
}
- CbftBlacklistDeadlineFlag = cli.StringFlag{
- Name: "cbft.blacklist_deadline",
- Usage: "Blacklist effective time. uint:minute",
- Value: "60",
+ CbftBlacklistDeadlineFlag = &cli.StringFlag{
+ Name: "cbft.blacklist_deadline",
+ Usage: "Blacklist effective time. uint:minute",
+ Value: "60",
+ Category: flags.CbftCategory,
}
- DBNoGCFlag = cli.BoolFlag{
- Name: "db.nogc",
- Usage: "Disables database garbage collection",
+ DBNoGCFlag = &cli.BoolFlag{
+ Name: "db.nogc",
+ Usage: "Disables database garbage collection",
+ Category: flags.DbCategory,
}
- DBGCIntervalFlag = cli.Uint64Flag{
- Name: "db.gc_interval",
- Usage: "Block interval for garbage collection",
- Value: ethconfig.Defaults.DBGCInterval,
+ DBGCIntervalFlag = &cli.Uint64Flag{
+ Name: "db.gc_interval",
+ Usage: "Block interval for garbage collection",
+ Value: ethconfig.Defaults.DBGCInterval,
+ Category: flags.DbCategory,
}
- DBGCTimeoutFlag = cli.DurationFlag{
- Name: "db.gc_timeout",
- Usage: "Maximum time for database garbage collection",
- Value: ethconfig.Defaults.DBGCTimeout,
+ DBGCTimeoutFlag = &cli.DurationFlag{
+ Name: "db.gc_timeout",
+ Usage: "Maximum time for database garbage collection",
+ Value: ethconfig.Defaults.DBGCTimeout,
+ Category: flags.DbCategory,
}
- DBGCMptFlag = cli.BoolFlag{
- Name: "db.gc_mpt",
- Usage: "Enables database garbage collection MPT",
+ DBGCMptFlag = &cli.BoolFlag{
+ Name: "db.gc_mpt",
+ Usage: "Enables database garbage collection MPT",
+ Category: flags.DbCategory,
}
- DBGCBlockFlag = cli.IntFlag{
- Name: "db.gc_block",
- Usage: "Number of cache block states, default 10",
- Value: ethconfig.Defaults.DBGCBlock,
+ DBGCBlockFlag = &cli.IntFlag{
+ Name: "db.gc_block",
+ Usage: "Number of cache block states, default 10",
+ Value: ethconfig.Defaults.DBGCBlock,
+ Category: flags.DbCategory,
}
- DBValidatorsHistoryFlag = cli.BoolFlag{
- Name: "db.validators_history",
- Usage: "Store the list of validators for each consensus round",
+ DBValidatorsHistoryFlag = &cli.BoolFlag{
+ Name: "db.validators_history",
+ Usage: "Store the list of validators for each consensus round",
+ Category: flags.DbCategory,
}
- VMWasmType = cli.StringFlag{
- Name: "vm.wasm_type",
- Usage: "The actual implementation type of the wasm instance",
- EnvVar: "",
- Value: ethconfig.Defaults.VMWasmType,
+ VMWasmType = &cli.StringFlag{
+ Name: "vm.wasm_type",
+ Usage: "The actual implementation type of the wasm instance",
+ Value: ethconfig.Defaults.VMWasmType,
+ Category: flags.VMCategory,
}
- VmTimeoutDuration = cli.Uint64Flag{
- Name: "vm.timeout_duration",
- Usage: "The VM execution timeout duration (uint: ms)",
- EnvVar: "",
- Value: ethconfig.Defaults.VmTimeoutDuration,
+ VmTimeoutDuration = &cli.Uint64Flag{
+ Name: "vm.timeout_duration",
+ Usage: "The VM execution timeout duration (uint: ms)",
+ Value: ethconfig.Defaults.VmTimeoutDuration,
+ Category: flags.VMCategory,
}
)
@@ -764,9 +862,9 @@ func GroupFlags(groups ...[]cli.Flag) []cli.Flag {
// if none (or the empty string) is specified. If the node is starting a testnet,
// then a subdirectory of the specified datadir will be used.
func MakeDataDir(ctx *cli.Context) string {
- if path := ctx.GlobalString(DataDirFlag.Name); path != "" {
+ if path := ctx.String(DataDirFlag.Name); path != "" {
- if ctx.GlobalBool(TestnetFlag.Name) {
+ if ctx.Bool(TestnetFlag.Name) {
return filepath.Join(path, "testnet")
}
return path
@@ -780,8 +878,8 @@ func MakeDataDir(ctx *cli.Context) string {
// method returns nil and an emphemeral key is to be generated.
func setNodeKey(ctx *cli.Context, cfg *p2p.Config) {
var (
- hex = ctx.GlobalString(NodeKeyHexFlag.Name)
- file = ctx.GlobalString(NodeKeyFileFlag.Name)
+ hex = ctx.String(NodeKeyHexFlag.Name)
+ file = ctx.String(NodeKeyFileFlag.Name)
key *ecdsa.PrivateKey
err error
)
@@ -803,7 +901,7 @@ func setNodeKey(ctx *cli.Context, cfg *p2p.Config) {
// setNodeUserIdent creates the user identifier from CLI flags.
func setNodeUserIdent(ctx *cli.Context, cfg *node.Config) {
- if identity := ctx.GlobalString(IdentityFlag.Name); len(identity) > 0 {
+ if identity := ctx.String(IdentityFlag.Name); len(identity) > 0 {
cfg.UserIdent = identity
}
}
@@ -814,16 +912,18 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
urls := params.MainnetBootnodes
switch {
- case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV4Flag.Name):
- if ctx.GlobalIsSet(BootnodesV4Flag.Name) {
- urls = SplitAndTrim(ctx.GlobalString(BootnodesV4Flag.Name))
+ case ctx.IsSet(BootnodesFlag.Name) || ctx.IsSet(BootnodesV4Flag.Name):
+ if ctx.IsSet(BootnodesV4Flag.Name) {
+ urls = SplitAndTrim(ctx.String(BootnodesV4Flag.Name))
} else {
- urls = SplitAndTrim(ctx.GlobalString(BootnodesFlag.Name))
+ urls = SplitAndTrim(ctx.String(BootnodesFlag.Name))
}
- case ctx.GlobalBool(TestnetFlag.Name):
+ case ctx.Bool(TestnetFlag.Name):
urls = params.TestnetBootnodes
- case cfg.BootstrapNodes != nil:
- return // already set, don't apply defaults.
+ }
+ // don't apply defaults if BootstrapNodes is already set
+ if cfg.BootstrapNodes != nil {
+ return
}
cfg.BootstrapNodes = make([]*enode.Node, 0, len(urls))
@@ -844,11 +944,11 @@ func setBootstrapNodes(ctx *cli.Context, cfg *p2p.Config) {
func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
urls := params.DiscoveryV5Bootnodes
switch {
- case ctx.GlobalIsSet(BootnodesFlag.Name) || ctx.GlobalIsSet(BootnodesV5Flag.Name):
- if ctx.GlobalIsSet(BootnodesV5Flag.Name) {
- urls = splitAndTrim(ctx.GlobalString(BootnodesV5Flag.Name))
+ case ctx.IsSet(BootnodesFlag.Name) || ctx.IsSet(BootnodesV5Flag.Name):
+ if ctx.IsSet(BootnodesV5Flag.Name) {
+ urls = splitAndTrim(ctx.String(BootnodesV5Flag.Name))
} else {
- urls = splitAndTrim(ctx.GlobalString(BootnodesV5Flag.Name))
+ urls = splitAndTrim(ctx.String(BootnodesV5Flag.Name))
}
case cfg.BootstrapNodesV5 != nil:
return // already set, don't apply defaults.
@@ -865,18 +965,21 @@ func setBootstrapNodesV5(ctx *cli.Context, cfg *p2p.Config) {
}
}*/
-// setListenAddress creates a TCP listening address string from set command
-// line flags.
+// setListenAddress creates TCP/UDP listening address strings from set command
+// line flags
func setListenAddress(ctx *cli.Context, cfg *p2p.Config) {
- if ctx.GlobalIsSet(ListenPortFlag.Name) {
- cfg.ListenAddr = fmt.Sprintf(":%d", ctx.GlobalInt(ListenPortFlag.Name))
+ if ctx.IsSet(ListenPortFlag.Name) {
+ cfg.ListenAddr = fmt.Sprintf(":%d", ctx.Int(ListenPortFlag.Name))
+ }
+ if ctx.IsSet(DiscoveryPortFlag.Name) {
+ cfg.DiscAddr = fmt.Sprintf(":%d", ctx.Int(DiscoveryPortFlag.Name))
}
}
// setNAT creates a port mapper from command line flags.
func setNAT(ctx *cli.Context, cfg *p2p.Config) {
- if ctx.GlobalIsSet(NATFlag.Name) {
- natif, err := nat.Parse(ctx.GlobalString(NATFlag.Name))
+ if ctx.IsSet(NATFlag.Name) {
+ natif, err := nat.Parse(ctx.String(NATFlag.Name))
if err != nil {
Fatalf("Option %s: %v", NATFlag.Name, err)
}
@@ -900,93 +1003,71 @@ func SplitAndTrim(input string) (ret []string) {
// setHTTP creates the HTTP RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func setHTTP(ctx *cli.Context, cfg *node.Config) {
- if ctx.GlobalBool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
+ if ctx.Bool(HTTPEnabledFlag.Name) && cfg.HTTPHost == "" {
cfg.HTTPHost = "127.0.0.1"
- if ctx.GlobalIsSet(HTTPListenAddrFlag.Name) {
- cfg.HTTPHost = ctx.GlobalString(HTTPListenAddrFlag.Name)
+ if ctx.IsSet(HTTPListenAddrFlag.Name) {
+ cfg.HTTPHost = ctx.String(HTTPListenAddrFlag.Name)
}
}
- if ctx.GlobalIsSet(HTTPPortFlag.Name) {
- cfg.HTTPPort = ctx.GlobalInt(HTTPPortFlag.Name)
- }
- if ctx.GlobalIsSet(AuthHostFlag.Name) {
- cfg.AuthHost = ctx.GlobalString(AuthHostFlag.Name)
- }
- if ctx.GlobalIsSet(AuthPortFlag.Name) {
- cfg.AuthPort = ctx.GlobalInt(AuthPortFlag.Name)
+ if ctx.IsSet(HTTPPortFlag.Name) {
+ cfg.HTTPPort = ctx.Int(HTTPPortFlag.Name)
}
- if ctx.GlobalIsSet(HTTPCORSDomainFlag.Name) {
- cfg.HTTPCors = SplitAndTrim(ctx.GlobalString(HTTPCORSDomainFlag.Name))
+ if ctx.IsSet(HTTPCORSDomainFlag.Name) {
+ cfg.HTTPCors = SplitAndTrim(ctx.String(HTTPCORSDomainFlag.Name))
}
- if ctx.GlobalIsSet(HTTPApiFlag.Name) {
- cfg.HTTPModules = SplitAndTrim(ctx.GlobalString(HTTPApiFlag.Name))
+ if ctx.IsSet(HTTPApiFlag.Name) {
+ cfg.HTTPModules = SplitAndTrim(ctx.String(HTTPApiFlag.Name))
}
- if ctx.GlobalBool(HTTPEnabledEthCompatibleFlag.Name) {
+ if ctx.Bool(HTTPEnabledEthCompatibleFlag.Name) {
types2.HttpEthCompatible = true
}
- if ctx.GlobalIsSet(HTTPVirtualHostsFlag.Name) {
- cfg.HTTPVirtualHosts = SplitAndTrim(ctx.GlobalString(HTTPVirtualHostsFlag.Name))
+ if ctx.IsSet(HTTPVirtualHostsFlag.Name) {
+ cfg.HTTPVirtualHosts = SplitAndTrim(ctx.String(HTTPVirtualHostsFlag.Name))
+ }
+
+ if ctx.IsSet(HTTPPathPrefixFlag.Name) {
+ cfg.HTTPPathPrefix = ctx.String(HTTPPathPrefixFlag.Name)
}
if ctx.IsSet(AllowUnprotectedTxs.Name) {
cfg.AllowUnprotectedTxs = ctx.Bool(AllowUnprotectedTxs.Name)
}
-
- if ctx.GlobalIsSet(HTTPPathPrefixFlag.Name) {
- cfg.HTTPPathPrefix = ctx.GlobalString(HTTPPathPrefixFlag.Name)
- }
}
// setGraphQL creates the GraphQL listener interface string from the set
// command line flags, returning empty if the GraphQL endpoint is disabled.
func setGraphQL(ctx *cli.Context, cfg *node.Config) {
- if ctx.GlobalIsSet(GraphQLCORSDomainFlag.Name) {
- cfg.GraphQLCors = SplitAndTrim(ctx.GlobalString(GraphQLCORSDomainFlag.Name))
+ if ctx.IsSet(GraphQLCORSDomainFlag.Name) {
+ cfg.GraphQLCors = SplitAndTrim(ctx.String(GraphQLCORSDomainFlag.Name))
}
- if ctx.GlobalIsSet(GraphQLVirtualHostsFlag.Name) {
- cfg.GraphQLVirtualHosts = SplitAndTrim(ctx.GlobalString(GraphQLVirtualHostsFlag.Name))
+ if ctx.IsSet(GraphQLVirtualHostsFlag.Name) {
+ cfg.GraphQLVirtualHosts = SplitAndTrim(ctx.String(GraphQLVirtualHostsFlag.Name))
}
}
// setWS creates the WebSocket RPC listener interface string from the set
// command line flags, returning empty if the HTTP endpoint is disabled.
func setWS(ctx *cli.Context, cfg *node.Config) {
- if ctx.GlobalBool(WSEnabledFlag.Name) && cfg.WSHost == "" {
+ if ctx.Bool(WSEnabledFlag.Name) && cfg.WSHost == "" {
cfg.WSHost = "127.0.0.1"
- if ctx.GlobalIsSet(LegacyWSListenAddrFlag.Name) {
- cfg.WSHost = ctx.GlobalString(LegacyWSListenAddrFlag.Name)
- log.Warn("The flag --wsaddr is deprecated and will be removed in the future, please use --ws.addr")
- }
- if ctx.GlobalIsSet(WSListenAddrFlag.Name) {
- cfg.WSHost = ctx.GlobalString(WSListenAddrFlag.Name)
+ if ctx.IsSet(WSListenAddrFlag.Name) {
+ cfg.WSHost = ctx.String(WSListenAddrFlag.Name)
}
}
- if ctx.GlobalIsSet(LegacyWSPortFlag.Name) {
- cfg.WSPort = ctx.GlobalInt(LegacyWSPortFlag.Name)
- log.Warn("The flag --wsport is deprecated and will be removed in the future, please use --ws.port")
- }
- if ctx.GlobalIsSet(WSPortFlag.Name) {
- cfg.WSPort = ctx.GlobalInt(WSPortFlag.Name)
+ if ctx.IsSet(WSPortFlag.Name) {
+ cfg.WSPort = ctx.Int(WSPortFlag.Name)
}
- if ctx.GlobalIsSet(LegacyWSAllowedOriginsFlag.Name) {
- cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(LegacyWSAllowedOriginsFlag.Name))
- log.Warn("The flag --wsorigins is deprecated and will be removed in the future, please use --ws.origins")
- }
- if ctx.GlobalIsSet(WSAllowedOriginsFlag.Name) {
- cfg.WSOrigins = SplitAndTrim(ctx.GlobalString(WSAllowedOriginsFlag.Name))
+ if ctx.IsSet(WSAllowedOriginsFlag.Name) {
+ cfg.WSOrigins = SplitAndTrim(ctx.String(WSAllowedOriginsFlag.Name))
}
- if ctx.GlobalIsSet(LegacyWSApiFlag.Name) {
- cfg.WSModules = SplitAndTrim(ctx.GlobalString(LegacyWSApiFlag.Name))
- log.Warn("The flag --wsapi is deprecated and will be removed in the future, please use --ws.api")
- }
- if ctx.GlobalIsSet(WSApiFlag.Name) {
- cfg.WSModules = SplitAndTrim(ctx.GlobalString(WSApiFlag.Name))
+ if ctx.IsSet(WSApiFlag.Name) {
+ cfg.WSModules = SplitAndTrim(ctx.String(WSApiFlag.Name))
}
- if ctx.GlobalIsSet(WSPathPrefixFlag.Name) {
- cfg.WSPathPrefix = ctx.GlobalString(WSPathPrefixFlag.Name)
+ if ctx.IsSet(WSPathPrefixFlag.Name) {
+ cfg.WSPathPrefix = ctx.String(WSPathPrefixFlag.Name)
}
}
@@ -995,10 +1076,10 @@ func setWS(ctx *cli.Context, cfg *node.Config) {
func setIPC(ctx *cli.Context, cfg *node.Config) {
CheckExclusive(ctx, IPCDisabledFlag, IPCPathFlag)
switch {
- case ctx.GlobalBool(IPCDisabledFlag.Name):
+ case ctx.Bool(IPCDisabledFlag.Name):
cfg.IPCPath = ""
- case ctx.GlobalIsSet(IPCPathFlag.Name):
- cfg.IPCPath = ctx.GlobalString(IPCPathFlag.Name)
+ case ctx.IsSet(IPCPathFlag.Name):
+ cfg.IPCPath = ctx.String(IPCPathFlag.Name)
}
}
@@ -1059,7 +1140,7 @@ func MakeAddress(ks *keystore.KeyStore, account string) (accounts.Account, error
// MakePasswordList reads password lines from the file specified by the global --password flag.
func MakePasswordList(ctx *cli.Context) []string {
- path := ctx.GlobalString(PasswordFileFlag.Name)
+ path := ctx.String(PasswordFileFlag.Name)
if path == "" {
return nil
}
@@ -1082,12 +1163,12 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
setBootstrapNodes(ctx, cfg)
// setBootstrapNodesV5(ctx, cfg)
- if ctx.GlobalIsSet(MaxConsensusPeersFlag.Name) {
- cfg.MaxConsensusPeers = ctx.GlobalInt(MaxConsensusPeersFlag.Name)
+ if ctx.IsSet(MaxConsensusPeersFlag.Name) {
+ cfg.MaxConsensusPeers = ctx.Int(MaxConsensusPeersFlag.Name)
}
- if ctx.GlobalIsSet(MaxPeersFlag.Name) {
- cfg.MaxPeers = ctx.GlobalInt(MaxPeersFlag.Name)
+ if ctx.IsSet(MaxPeersFlag.Name) {
+ cfg.MaxPeers = ctx.Int(MaxPeersFlag.Name)
}
ethPeers := cfg.MaxPeers
@@ -1098,25 +1179,25 @@ func SetP2PConfig(ctx *cli.Context, cfg *p2p.Config) {
}
log.Info("Maximum peer count", "ETH", ethPeers, "consensusTotal", cfg.MaxConsensusPeers, "total", cfg.MaxPeers)
- if ctx.GlobalIsSet(MaxPendingPeersFlag.Name) {
- cfg.MaxPendingPeers = ctx.GlobalInt(MaxPendingPeersFlag.Name)
+ if ctx.IsSet(MaxPendingPeersFlag.Name) {
+ cfg.MaxPendingPeers = ctx.Int(MaxPendingPeersFlag.Name)
}
- if ctx.GlobalIsSet(NoDiscoverFlag.Name) {
+ if ctx.IsSet(NoDiscoverFlag.Name) {
cfg.NoDiscovery = true
}
// if we're running a light client or server, force enable the v5 peer discovery
// unless it is explicitly disabled with --nodiscover note that explicitly specifying
// --v5disc overrides --nodiscover, in which case the later only disables v4 discovery
- //forceV5Discovery := /*(lightClient || lightServer) && */ !ctx.GlobalBool(NoDiscoverFlag.Name)
- /*if ctx.GlobalIsSet(DiscoveryV5Flag.Name) {
- cfg.DiscoveryV5 = ctx.GlobalBool(DiscoveryV5Flag.Name)
+ //forceV5Discovery := /*(lightClient || lightServer) && */ !ctx.Bool(NoDiscoverFlag.Name)
+ /*if ctx.IsSet(DiscoveryV5Flag.Name) {
+ cfg.DiscoveryV5 = ctx.Bool(DiscoveryV5Flag.Name)
} else if forceV5Discovery {
cfg.DiscoveryV5 = true
}*/
// 没用discoverv5
- if netrestrict := ctx.GlobalString(NetrestrictFlag.Name); netrestrict != "" {
+ if netrestrict := ctx.String(NetrestrictFlag.Name); netrestrict != "" {
list, err := netutil.ParseNetlist(netrestrict)
if err != nil {
Fatalf("Option %q: %v", NetrestrictFlag.Name, err)
@@ -1135,45 +1216,51 @@ func SetNodeConfig(ctx *cli.Context, cfg *node.Config) {
setNodeUserIdent(ctx, cfg)
switch {
- case ctx.GlobalIsSet(DataDirFlag.Name):
- cfg.DataDir = ctx.GlobalString(DataDirFlag.Name)
- case ctx.GlobalBool(TestnetFlag.Name):
+ case ctx.IsSet(DataDirFlag.Name):
+ cfg.DataDir = ctx.String(DataDirFlag.Name)
+ case ctx.Bool(TestnetFlag.Name):
cfg.DataDir = filepath.Join(node.DefaultDataDir(), "testnet")
}
- if ctx.GlobalIsSet(JWTSecretFlag.Name) {
- cfg.JWTSecret = ctx.GlobalString(JWTSecretFlag.Name)
+ if ctx.IsSet(JWTSecretFlag.Name) {
+ cfg.JWTSecret = ctx.String(JWTSecretFlag.Name)
}
- if ctx.GlobalIsSet(KeyStoreDirFlag.Name) {
- cfg.KeyStoreDir = ctx.GlobalString(KeyStoreDirFlag.Name)
+ if ctx.IsSet(KeyStoreDirFlag.Name) {
+ cfg.KeyStoreDir = ctx.String(KeyStoreDirFlag.Name)
}
- if ctx.GlobalIsSet(LightKDFFlag.Name) {
- cfg.UseLightweightKDF = ctx.GlobalBool(LightKDFFlag.Name)
+ if ctx.IsSet(LightKDFFlag.Name) {
+ cfg.UseLightweightKDF = ctx.Bool(LightKDFFlag.Name)
}
- if ctx.GlobalIsSet(InsecureUnlockAllowedFlag.Name) {
- cfg.InsecureUnlockAllowed = ctx.GlobalBool(InsecureUnlockAllowedFlag.Name)
+ if ctx.IsSet(InsecureUnlockAllowedFlag.Name) {
+ cfg.InsecureUnlockAllowed = ctx.Bool(InsecureUnlockAllowedFlag.Name)
}
}
+func SetDataDir(ctx *cli.Context, cfg *node.Config) {
+ switch {
+ case ctx.IsSet(DataDirFlag.Name):
+ cfg.DataDir = ctx.String(DataDirFlag.Name)
+ }
+}
func setGPO(ctx *cli.Context, cfg *gasprice.Config) {
- if ctx.GlobalIsSet(GpoBlocksFlag.Name) {
- cfg.Blocks = ctx.GlobalInt(GpoBlocksFlag.Name)
+ if ctx.IsSet(GpoBlocksFlag.Name) {
+ cfg.Blocks = ctx.Int(GpoBlocksFlag.Name)
}
- if ctx.GlobalIsSet(GpoPercentileFlag.Name) {
- cfg.Percentile = ctx.GlobalInt(GpoPercentileFlag.Name)
+ if ctx.IsSet(GpoPercentileFlag.Name) {
+ cfg.Percentile = ctx.Int(GpoPercentileFlag.Name)
}
- if ctx.GlobalIsSet(GpoMaxGasPriceFlag.Name) {
- cfg.MaxPrice = big.NewInt(ctx.GlobalInt64(GpoMaxGasPriceFlag.Name))
+ if ctx.IsSet(GpoMaxGasPriceFlag.Name) {
+ cfg.MaxPrice = big.NewInt(ctx.Int64(GpoMaxGasPriceFlag.Name))
}
- if ctx.GlobalIsSet(GpoIgnoreGasPriceFlag.Name) {
- cfg.IgnorePrice = big.NewInt(ctx.GlobalInt64(GpoIgnoreGasPriceFlag.Name))
+ if ctx.IsSet(GpoIgnoreGasPriceFlag.Name) {
+ cfg.IgnorePrice = big.NewInt(ctx.Int64(GpoIgnoreGasPriceFlag.Name))
}
}
func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) {
- if ctx.GlobalIsSet(TxPoolLocalsFlag.Name) {
- locals := strings.Split(ctx.GlobalString(TxPoolLocalsFlag.Name), ",")
+ if ctx.IsSet(TxPoolLocalsFlag.Name) {
+ locals := strings.Split(ctx.String(TxPoolLocalsFlag.Name), ",")
for _, account := range locals {
if trimmed := strings.TrimSpace(account); !common.IsBech32Address(trimmed) {
Fatalf("Invalid account in --txpool.locals: %s", trimmed)
@@ -1182,44 +1269,47 @@ func setTxPool(ctx *cli.Context, cfg *core.TxPoolConfig) {
}
}
}
- if ctx.GlobalIsSet(TxPoolNoLocalsFlag.Name) {
- cfg.NoLocals = ctx.GlobalBool(TxPoolNoLocalsFlag.Name)
+ if ctx.IsSet(TxPoolNoLocalsFlag.Name) {
+ cfg.NoLocals = ctx.Bool(TxPoolNoLocalsFlag.Name)
+ }
+ if ctx.IsSet(TxPoolJournalFlag.Name) {
+ cfg.Journal = ctx.String(TxPoolJournalFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolJournalFlag.Name) {
- cfg.Journal = ctx.GlobalString(TxPoolJournalFlag.Name)
+ if ctx.IsSet(TxPoolRejournalFlag.Name) {
+ cfg.Rejournal = ctx.Duration(TxPoolRejournalFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolRejournalFlag.Name) {
- cfg.Rejournal = ctx.GlobalDuration(TxPoolRejournalFlag.Name)
+ if ctx.IsSet(TxPoolPriceLimitFlag.Name) {
+ cfg.PriceLimit = ctx.Uint64(TxPoolPriceLimitFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolPriceBumpFlag.Name) {
- cfg.PriceBump = ctx.GlobalUint64(TxPoolPriceBumpFlag.Name)
+ if ctx.IsSet(TxPoolPriceBumpFlag.Name) {
+ cfg.PriceBump = ctx.Uint64(TxPoolPriceBumpFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolAccountSlotsFlag.Name) {
- cfg.AccountSlots = ctx.GlobalUint64(TxPoolAccountSlotsFlag.Name)
+ if ctx.IsSet(TxPoolAccountSlotsFlag.Name) {
+ cfg.AccountSlots = ctx.Uint64(TxPoolAccountSlotsFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolGlobalSlotsFlag.Name) {
- cfg.GlobalSlots = ctx.GlobalUint64(TxPoolGlobalSlotsFlag.Name)
+ if ctx.IsSet(TxPoolGlobalSlotsFlag.Name) {
+ cfg.GlobalSlots = ctx.Uint64(TxPoolGlobalSlotsFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolAccountQueueFlag.Name) {
- cfg.AccountQueue = ctx.GlobalUint64(TxPoolAccountQueueFlag.Name)
+ if ctx.IsSet(TxPoolAccountQueueFlag.Name) {
+ cfg.AccountQueue = ctx.Uint64(TxPoolAccountQueueFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolGlobalQueueFlag.Name) {
- cfg.GlobalQueue = ctx.GlobalUint64(TxPoolGlobalQueueFlag.Name)
+ if ctx.IsSet(TxPoolGlobalQueueFlag.Name) {
+ cfg.GlobalQueue = ctx.Uint64(TxPoolGlobalQueueFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolGlobalTxCountFlag.Name) {
- cfg.GlobalTxCount = ctx.GlobalUint64(TxPoolGlobalTxCountFlag.Name)
+ if ctx.IsSet(TxPoolGlobalTxCountFlag.Name) {
+ cfg.GlobalTxCount = ctx.Uint64(TxPoolGlobalTxCountFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolLifetimeFlag.Name) {
- cfg.Lifetime = ctx.GlobalDuration(TxPoolLifetimeFlag.Name)
+ if ctx.IsSet(TxPoolLifetimeFlag.Name) {
+ cfg.Lifetime = ctx.Duration(TxPoolLifetimeFlag.Name)
}
- if ctx.GlobalIsSet(TxPoolCacheSizeFlag.Name) {
- cfg.TxCacheSize = ctx.GlobalUint64(TxPoolCacheSizeFlag.Name)
+ if ctx.IsSet(TxPoolCacheSizeFlag.Name) {
+ cfg.TxCacheSize = ctx.Uint64(TxPoolCacheSizeFlag.Name)
}
}
func setMiner(ctx *cli.Context, cfg *miner.Config) {
- if ctx.GlobalIsSet(MinerGasPriceFlag.Name) {
- cfg.GasPrice = GlobalBig(ctx, MinerGasPriceFlag.Name)
+ if ctx.IsSet(MinerGasPriceFlag.Name) {
+ cfg.GasPrice = flags.GlobalBig(ctx, MinerGasPriceFlag.Name)
}
}
@@ -1239,57 +1329,57 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
mem.Total = 2 * 1024 * 1024 * 1024
}
allowance := int(mem.Total / 1024 / 1024 / 3)
- if cache := ctx.GlobalInt(CacheFlag.Name); cache > allowance {
+ if cache := ctx.Int(CacheFlag.Name); cache > allowance {
log.Warn("Sanitizing cache to Go's GC limits", "provided", cache, "updated", allowance)
- ctx.GlobalSet(CacheFlag.Name, strconv.Itoa(allowance))
+ ctx.Set(CacheFlag.Name, strconv.Itoa(allowance))
}
}
// Ensure Go's GC ignores the database cache for trigger percentage
- cache := ctx.GlobalInt(CacheFlag.Name)
+ cache := ctx.Int(CacheFlag.Name)
gogc := math.Max(20, math.Min(100, 100/(float64(cache)/1024)))
log.Debug("Sanitizing Go's GC trigger", "percent", int(gogc))
godebug.SetGCPercent(int(gogc))
- if ctx.GlobalIsSet(CbftWalDisabledFlag.Name) {
+ if ctx.IsSet(CbftWalDisabledFlag.Name) {
cfg.CbftConfig.WalMode = false
}
- if ctx.GlobalIsSet(SyncModeFlag.Name) {
- cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
+ if ctx.IsSet(SyncModeFlag.Name) {
+ cfg.SyncMode = *flags.GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode)
}
- if ctx.GlobalIsSet(NetworkIdFlag.Name) {
- cfg.NetworkId = ctx.GlobalUint64(NetworkIdFlag.Name)
+ if ctx.IsSet(NetworkIdFlag.Name) {
+ cfg.NetworkId = ctx.Uint64(NetworkIdFlag.Name)
}
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheDatabaseFlag.Name) {
- cfg.DatabaseCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheDatabaseFlag.Name) {
+ cfg.DatabaseCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100
}
- if ctx.GlobalIsSet(CacheTrieJournalFlag.Name) {
- cfg.TrieCleanCacheJournal = ctx.GlobalString(CacheTrieJournalFlag.Name)
+ if ctx.IsSet(CacheTrieJournalFlag.Name) {
+ cfg.TrieCleanCacheJournal = ctx.String(CacheTrieJournalFlag.Name)
}
- if ctx.GlobalIsSet(CacheTrieRejournalFlag.Name) {
- cfg.TrieCleanCacheRejournal = ctx.GlobalDuration(CacheTrieRejournalFlag.Name)
+ if ctx.IsSet(CacheTrieRejournalFlag.Name) {
+ cfg.TrieCleanCacheRejournal = ctx.Duration(CacheTrieRejournalFlag.Name)
}
- cfg.DatabaseHandles = MakeDatabaseHandles(ctx.GlobalInt(FDLimitFlag.Name))
- if ctx.GlobalIsSet(AncientFlag.Name) {
- cfg.DatabaseFreezer = ctx.GlobalString(AncientFlag.Name)
+ cfg.DatabaseHandles = MakeDatabaseHandles(ctx.Int(FDLimitFlag.Name))
+ if ctx.IsSet(AncientFlag.Name) {
+ cfg.DatabaseFreezer = ctx.String(AncientFlag.Name)
}
- if ctx.GlobalIsSet(TxLookupLimitFlag.Name) {
- cfg.TxLookupLimit = ctx.GlobalUint64(TxLookupLimitFlag.Name)
+ if ctx.IsSet(TxLookupLimitFlag.Name) {
+ cfg.TxLookupLimit = ctx.Uint64(TxLookupLimitFlag.Name)
}
cfg.NoPruning = true
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) {
- cfg.TrieCleanCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheTrieFlag.Name) {
+ cfg.TrieCleanCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheTrieFlag.Name) / 100
}
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
- cfg.TrieDirtyCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheGCFlag.Name) {
+ cfg.TrieDirtyCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100
}
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheSnapshotFlag.Name) {
- cfg.SnapshotCache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheSnapshotFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheSnapshotFlag.Name) {
+ cfg.SnapshotCache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheSnapshotFlag.Name) / 100
}
- if !ctx.GlobalBool(SnapshotFlag.Name) {
+ if !ctx.Bool(SnapshotFlag.Name) {
// If snap-sync is requested, this flag is also required
if cfg.SyncMode == downloader.SnapSync {
log.Info("Snap sync requested, enabling --snapshot")
@@ -1298,34 +1388,34 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
cfg.SnapshotCache = 0 // Disabled
}
}
- if ctx.GlobalIsSet(CacheTrieDBFlag.Name) {
- cfg.TrieDBCache = ctx.GlobalInt(CacheTrieDBFlag.Name)
+ if ctx.IsSet(CacheTrieDBFlag.Name) {
+ cfg.TrieDBCache = ctx.Int(CacheTrieDBFlag.Name)
}
- if ctx.GlobalIsSet(DocRootFlag.Name) {
- cfg.DocRoot = ctx.GlobalString(DocRootFlag.Name)
+ if ctx.IsSet(DocRootFlag.Name) {
+ cfg.DocRoot = ctx.String(DocRootFlag.Name)
}
- if ctx.GlobalIsSet(RPCGlobalGasCapFlag.Name) {
- cfg.RPCGasCap = ctx.GlobalUint64(RPCGlobalGasCapFlag.Name)
+ if ctx.IsSet(RPCGlobalGasCapFlag.Name) {
+ cfg.RPCGasCap = ctx.Uint64(RPCGlobalGasCapFlag.Name)
}
if cfg.RPCGasCap != 0 {
log.Info("Set global gas cap", "cap", cfg.RPCGasCap)
} else {
log.Info("Global gas cap disabled")
}
- if ctx.GlobalIsSet(RPCGlobalEVMTimeoutFlag.Name) {
- cfg.RPCEVMTimeout = ctx.GlobalDuration(RPCGlobalEVMTimeoutFlag.Name)
+ if ctx.IsSet(RPCGlobalEVMTimeoutFlag.Name) {
+ cfg.RPCEVMTimeout = ctx.Duration(RPCGlobalEVMTimeoutFlag.Name)
}
- if ctx.GlobalIsSet(RPCGlobalTxFeeCapFlag.Name) {
- cfg.RPCTxFeeCap = ctx.GlobalFloat64(RPCGlobalTxFeeCapFlag.Name)
+ if ctx.IsSet(RPCGlobalTxFeeCapFlag.Name) {
+ cfg.RPCTxFeeCap = ctx.Float64(RPCGlobalTxFeeCapFlag.Name)
}
// Override any default configs for hard coded networks.
switch {
// Test NetWork
- case ctx.GlobalBool(TestnetFlag.Name):
- if !ctx.GlobalIsSet(NetworkIdFlag.Name) {
+ case ctx.Bool(TestnetFlag.Name):
+ if !ctx.IsSet(NetworkIdFlag.Name) {
cfg.NetworkId = 2000
}
cfg.Genesis = core.DefaultTestnetGenesisBlock()
@@ -1333,41 +1423,41 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) {
SetDNSDiscoveryDefaults(cfg, params.MainnetGenesisHash)
}
- if ctx.GlobalIsSet(DBNoGCFlag.Name) {
- cfg.DBDisabledGC = ctx.GlobalBool(DBNoGCFlag.Name)
+ if ctx.IsSet(DBNoGCFlag.Name) {
+ cfg.DBDisabledGC = ctx.Bool(DBNoGCFlag.Name)
}
- if ctx.GlobalIsSet(DBGCIntervalFlag.Name) {
- cfg.DBGCInterval = ctx.GlobalUint64(DBGCIntervalFlag.Name)
+ if ctx.IsSet(DBGCIntervalFlag.Name) {
+ cfg.DBGCInterval = ctx.Uint64(DBGCIntervalFlag.Name)
}
- if ctx.GlobalIsSet(DBGCTimeoutFlag.Name) {
- cfg.DBGCTimeout = ctx.GlobalDuration(DBGCTimeoutFlag.Name)
+ if ctx.IsSet(DBGCTimeoutFlag.Name) {
+ cfg.DBGCTimeout = ctx.Duration(DBGCTimeoutFlag.Name)
}
- if ctx.GlobalIsSet(DBGCMptFlag.Name) {
- cfg.DBGCMpt = ctx.GlobalBool(DBGCMptFlag.Name)
+ if ctx.IsSet(DBGCMptFlag.Name) {
+ cfg.DBGCMpt = ctx.Bool(DBGCMptFlag.Name)
}
- if ctx.GlobalIsSet(DBGCBlockFlag.Name) {
- b := ctx.GlobalInt(DBGCBlockFlag.Name)
+ if ctx.IsSet(DBGCBlockFlag.Name) {
+ b := ctx.Int(DBGCBlockFlag.Name)
if b > 0 {
cfg.DBGCBlock = b
}
}
- if ctx.GlobalIsSet(DBValidatorsHistoryFlag.Name) {
- cfg.DBValidatorsHistory = ctx.GlobalBool(DBValidatorsHistoryFlag.Name)
+ if ctx.IsSet(DBValidatorsHistoryFlag.Name) {
+ cfg.DBValidatorsHistory = ctx.Bool(DBValidatorsHistoryFlag.Name)
}
// Read the value from the flag no matter if it's set or not.
- cfg.Preimages = ctx.GlobalBool(CachePreimagesFlag.Name)
+ cfg.Preimages = ctx.Bool(CachePreimagesFlag.Name)
if cfg.DBDisabledGC && !cfg.Preimages {
cfg.Preimages = true
log.Info("Enabling recording of key preimages since archive mode is used")
}
// vm options
- if ctx.GlobalIsSet(VMWasmType.Name) {
- cfg.VMWasmType = ctx.GlobalString(VMWasmType.Name)
+ if ctx.IsSet(VMWasmType.Name) {
+ cfg.VMWasmType = ctx.String(VMWasmType.Name)
}
- if ctx.GlobalIsSet(VmTimeoutDuration.Name) {
- cfg.VmTimeoutDuration = ctx.GlobalUint64(VmTimeoutDuration.Name)
+ if ctx.IsSet(VmTimeoutDuration.Name) {
+ cfg.VmTimeoutDuration = ctx.Uint64(VmTimeoutDuration.Name)
}
}
@@ -1395,8 +1485,8 @@ func SetCbft(ctx *cli.Context, cfg *types.OptionsConfig, nodeCfg *node.Config) {
cfg.NodeID = cfg.Node.IDv0()
}
- if ctx.GlobalIsSet(CbftBlsPriKeyFileFlag.Name) {
- priKey, err := bls.LoadBLS(ctx.GlobalString(CbftBlsPriKeyFileFlag.Name))
+ if ctx.IsSet(CbftBlsPriKeyFileFlag.Name) {
+ priKey, err := bls.LoadBLS(ctx.String(CbftBlsPriKeyFileFlag.Name))
if err != nil {
Fatalf("Failed to load bls key from file: %v", err)
}
@@ -1406,19 +1496,19 @@ func SetCbft(ctx *cli.Context, cfg *types.OptionsConfig, nodeCfg *node.Config) {
}
nodeCfg.P2P.BlsPublicKey = *(cfg.BlsPriKey.GetPublicKey())
- if ctx.GlobalIsSet(CbftWalDisabledFlag.Name) {
- cfg.WalMode = !ctx.GlobalBool(CbftWalDisabledFlag.Name)
+ if ctx.IsSet(CbftWalDisabledFlag.Name) {
+ cfg.WalMode = !ctx.Bool(CbftWalDisabledFlag.Name)
}
- if ctx.GlobalIsSet(CbftPeerMsgQueueSize.Name) {
- cfg.PeerMsgQueueSize = ctx.GlobalUint64(CbftPeerMsgQueueSize.Name)
+ if ctx.IsSet(CbftPeerMsgQueueSize.Name) {
+ cfg.PeerMsgQueueSize = ctx.Uint64(CbftPeerMsgQueueSize.Name)
}
- if ctx.GlobalIsSet(CbftMaxPingLatency.Name) {
- cfg.MaxPingLatency = ctx.GlobalInt64(CbftMaxPingLatency.Name)
+ if ctx.IsSet(CbftMaxPingLatency.Name) {
+ cfg.MaxPingLatency = ctx.Int64(CbftMaxPingLatency.Name)
}
- if ctx.GlobalIsSet(CbftBlacklistDeadlineFlag.Name) {
- cfg.BlacklistDeadline = ctx.GlobalInt64(CbftBlacklistDeadlineFlag.Name)
+ if ctx.IsSet(CbftBlacklistDeadlineFlag.Name) {
+ cfg.BlacklistDeadline = ctx.Int64(CbftBlacklistDeadlineFlag.Name)
}
}
@@ -1467,19 +1557,19 @@ func SetupMetrics(ctx *cli.Context) {
log.Info("Enabling metrics collection")
var (
- enableExport = ctx.GlobalBool(MetricsEnableInfluxDBFlag.Name)
- enableExportV2 = ctx.GlobalBool(MetricsEnableInfluxDBV2Flag.Name)
+ enableExport = ctx.Bool(MetricsEnableInfluxDBFlag.Name)
+ enableExportV2 = ctx.Bool(MetricsEnableInfluxDBV2Flag.Name)
)
if enableExport || enableExportV2 {
CheckExclusive(ctx, MetricsEnableInfluxDBFlag, MetricsEnableInfluxDBV2Flag)
- v1FlagIsSet := ctx.GlobalIsSet(MetricsInfluxDBUsernameFlag.Name) ||
- ctx.GlobalIsSet(MetricsInfluxDBPasswordFlag.Name)
+ v1FlagIsSet := ctx.IsSet(MetricsInfluxDBUsernameFlag.Name) ||
+ ctx.IsSet(MetricsInfluxDBPasswordFlag.Name)
- v2FlagIsSet := ctx.GlobalIsSet(MetricsInfluxDBTokenFlag.Name) ||
- ctx.GlobalIsSet(MetricsInfluxDBOrganizationFlag.Name) ||
- ctx.GlobalIsSet(MetricsInfluxDBBucketFlag.Name)
+ v2FlagIsSet := ctx.IsSet(MetricsInfluxDBTokenFlag.Name) ||
+ ctx.IsSet(MetricsInfluxDBOrganizationFlag.Name) ||
+ ctx.IsSet(MetricsInfluxDBBucketFlag.Name)
if enableExport && v2FlagIsSet {
Fatalf("Flags --influxdb.metrics.organization, --influxdb.metrics.token, --influxdb.metrics.bucket are only available for influxdb-v2")
@@ -1489,32 +1579,32 @@ func SetupMetrics(ctx *cli.Context) {
}
var (
- endpoint = ctx.GlobalString(MetricsInfluxDBEndpointFlag.Name)
- database = ctx.GlobalString(MetricsInfluxDBDatabaseFlag.Name)
- username = ctx.GlobalString(MetricsInfluxDBUsernameFlag.Name)
- password = ctx.GlobalString(MetricsInfluxDBPasswordFlag.Name)
-
- token = ctx.GlobalString(MetricsInfluxDBTokenFlag.Name)
- bucket = ctx.GlobalString(MetricsInfluxDBBucketFlag.Name)
- organization = ctx.GlobalString(MetricsInfluxDBOrganizationFlag.Name)
+ endpoint = ctx.String(MetricsInfluxDBEndpointFlag.Name)
+ database = ctx.String(MetricsInfluxDBDatabaseFlag.Name)
+ username = ctx.String(MetricsInfluxDBUsernameFlag.Name)
+ password = ctx.String(MetricsInfluxDBPasswordFlag.Name)
+
+ token = ctx.String(MetricsInfluxDBTokenFlag.Name)
+ bucket = ctx.String(MetricsInfluxDBBucketFlag.Name)
+ organization = ctx.String(MetricsInfluxDBOrganizationFlag.Name)
)
if enableExport {
- tagsMap := SplitTagsFlag(ctx.GlobalString(MetricsInfluxDBTagsFlag.Name))
+ tagsMap := SplitTagsFlag(ctx.String(MetricsInfluxDBTagsFlag.Name))
log.Info("Enabling metrics export to InfluxDB")
go influxdb.InfluxDBWithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, database, username, password, "platon.", tagsMap)
} else if enableExportV2 {
- tagsMap := SplitTagsFlag(ctx.GlobalString(MetricsInfluxDBTagsFlag.Name))
+ tagsMap := SplitTagsFlag(ctx.String(MetricsInfluxDBTagsFlag.Name))
log.Info("Enabling metrics export to InfluxDB (v2)")
go influxdb.InfluxDBV2WithTags(metrics.DefaultRegistry, 10*time.Second, endpoint, token, bucket, organization, "platon.", tagsMap)
}
- if ctx.GlobalIsSet(MetricsHTTPFlag.Name) {
- address := fmt.Sprintf("%s:%d", ctx.GlobalString(MetricsHTTPFlag.Name), ctx.GlobalInt(MetricsPortFlag.Name))
+ if ctx.IsSet(MetricsHTTPFlag.Name) {
+ address := fmt.Sprintf("%s:%d", ctx.String(MetricsHTTPFlag.Name), ctx.Int(MetricsPortFlag.Name))
log.Info("Enabling stand-alone metrics HTTP endpoint", "address", address)
exp.Setup(address)
}
@@ -1541,20 +1631,20 @@ func SplitTagsFlag(tagsFlag string) map[string]string {
// MakeChainDatabase open an LevelDB using the flags passed to the client and will hard crash if it fails.
func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.Database {
var (
- cache = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheDatabaseFlag.Name) / 100
- handles = MakeDatabaseHandles(ctx.GlobalInt(FDLimitFlag.Name))
+ cache = ctx.Int(CacheFlag.Name) * ctx.Int(CacheDatabaseFlag.Name) / 100
+ handles = MakeDatabaseHandles(ctx.Int(FDLimitFlag.Name))
err error
chainDb ethdb.Database
)
switch {
- case ctx.GlobalIsSet(RemoteDBFlag.Name):
- log.Info("Using remote db", "url", ctx.GlobalString(RemoteDBFlag.Name))
- chainDb, err = remotedb.New(ctx.GlobalString(RemoteDBFlag.Name))
- case ctx.GlobalString(SyncModeFlag.Name) == "light":
+ case ctx.IsSet(RemoteDBFlag.Name):
+ log.Info("Using remote db", "url", ctx.String(RemoteDBFlag.Name))
+ chainDb, err = remotedb.New(ctx.String(RemoteDBFlag.Name))
+ case ctx.String(SyncModeFlag.Name) == "light":
chainDb, err = stack.OpenDatabase("lightchaindata", cache, handles, "", readonly)
default:
- chainDb, err = stack.OpenDatabaseWithFreezer("chaindata", cache, handles, ctx.GlobalString(AncientFlag.Name), "", readonly)
+ chainDb, err = stack.OpenDatabaseWithFreezer("chaindata", cache, handles, ctx.String(AncientFlag.Name), "", readonly)
}
if err != nil {
Fatalf("Could not open database: %v", err)
@@ -1565,7 +1655,7 @@ func MakeChainDatabase(ctx *cli.Context, stack *node.Node, readonly bool) ethdb.
func MakeGenesis(ctx *cli.Context) *core.Genesis {
var genesis *core.Genesis
switch {
- case ctx.GlobalBool(TestnetFlag.Name):
+ case ctx.Bool(TestnetFlag.Name):
genesis = core.DefaultTestnetGenesisBlock()
}
return genesis
@@ -1599,21 +1689,21 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
BlockCacheLimit: ethconfig.Defaults.BlockCacheLimit,
MaxFutureBlocks: ethconfig.Defaults.MaxFutureBlocks,
TriesInMemory: ethconfig.Defaults.TriesInMemory,
- Preimages: ctx.GlobalBool(CachePreimagesFlag.Name),
+ Preimages: ctx.Bool(CachePreimagesFlag.Name),
SnapshotLimit: ethconfig.Defaults.SnapshotCache,
}
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheTrieFlag.Name) {
- cache.TrieCleanLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheTrieFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheTrieFlag.Name) {
+ cache.TrieCleanLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheTrieFlag.Name) / 100
}
- if !ctx.GlobalBool(SnapshotFlag.Name) {
+ if !ctx.Bool(SnapshotFlag.Name) {
cache.SnapshotLimit = 0 // Disabled
}
if ethconfig.Defaults.DBDisabledGC && !cache.Preimages {
cache.Preimages = true
log.Info("Enabling recording of key preimages since archive mode is used")
}
- if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
- cache.TrieDirtyLimit = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
+ if ctx.IsSet(CacheFlag.Name) || ctx.IsSet(CacheGCFlag.Name) {
+ cache.TrieDirtyLimit = ctx.Int(CacheFlag.Name) * ctx.Int(CacheGCFlag.Name) / 100
}
vmcfg := vm.Config{}
@@ -1631,13 +1721,13 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai
// scripts to preload before starting.
func MakeConsolePreloads(ctx *cli.Context) []string {
// Skip preloading if there's nothing to preload
- if ctx.GlobalString(PreloadJSFlag.Name) == "" {
+ if ctx.String(PreloadJSFlag.Name) == "" {
return nil
}
// Otherwise resolve absolute paths and return them
preloads := []string{}
- for _, file := range strings.Split(ctx.GlobalString(PreloadJSFlag.Name), ",") {
+ for _, file := range strings.Split(ctx.String(PreloadJSFlag.Name), ",") {
preloads = append(preloads, strings.TrimSpace(file))
}
return preloads
@@ -1660,7 +1750,7 @@ func MigrateFlags(action func(ctx *cli.Context) error) func(*cli.Context) error
return func(ctx *cli.Context) error {
for _, name := range ctx.FlagNames() {
if ctx.IsSet(name) {
- ctx.GlobalSet(name, ctx.String(name))
+ ctx.Set(name, ctx.String(name))
}
}
return action(ctx)
@@ -1679,13 +1769,13 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
panic(fmt.Sprintf("invalid argument, not cli.Flag type: %T", args[i]))
}
// Check if next arg extends current and expand its name if so
- name := flag.GetName()
+ name := flag.Names()[0]
if i+1 < len(args) {
switch option := args[i+1].(type) {
case string:
// Extended flag check, make sure value set doesn't conflict with passed in option
- if ctx.GlobalString(flag.GetName()) == option {
+ if ctx.String(flag.Names()[0]) == option {
name += "=" + option
set = append(set, "--"+name)
}
@@ -1699,7 +1789,7 @@ func CheckExclusive(ctx *cli.Context, args ...interface{}) {
}
}
// Mark the flag if it's set
- if ctx.GlobalIsSet(flag.GetName()) {
+ if ctx.IsSet(flag.Names()[0]) {
set = append(set, "--"+name)
}
}
diff --git a/cmd/utils/flags_legacy.go b/cmd/utils/flags_legacy.go
index e4edb57cc7..ebb93b5065 100644
--- a/cmd/utils/flags_legacy.go
+++ b/cmd/utils/flags_legacy.go
@@ -18,64 +18,53 @@ package utils
import (
"fmt"
- "github.com/PlatONnetwork/PlatON-Go/eth/ethconfig"
- "gopkg.in/urfave/cli.v1"
-
- "github.com/PlatONnetwork/PlatON-Go/node"
+ "github.com/PlatONnetwork/PlatON-Go/internal/flags"
+ "github.com/urfave/cli/v2"
)
-var ShowDeprecated = cli.Command{
+var ShowDeprecated = &cli.Command{
Action: showDeprecated,
Name: "show-deprecated-flags",
Usage: "Show flags that have been deprecated",
ArgsUsage: " ",
- Category: "MISCELLANEOUS COMMANDS",
Description: "Show flags that have been deprecated and will soon be removed",
}
-var DeprecatedFlags = []cli.Flag{}
+var DeprecatedFlags = []cli.Flag{
+ NoUSBFlag,
+ LegacyWhitelistFlag,
+ LegacyDiscoveryV5Flag,
+}
var (
- LegacyWSListenAddrFlag = cli.StringFlag{
- Name: "wsaddr",
- Usage: "WS-RPC server listening interface (deprecated, use --ws.addr)",
- Value: node.DefaultWSHost,
- }
- LegacyWSPortFlag = cli.IntFlag{
- Name: "wsport",
- Usage: "WS-RPC server listening port (deprecated, use --ws.port)",
- Value: node.DefaultWSPort,
- }
- LegacyWSApiFlag = cli.StringFlag{
- Name: "wsapi",
- Usage: "API's offered over the WS-RPC interface (deprecated, use --ws.api)",
- Value: "",
+ // Deprecated May 2020, shown in aliased flags section
+ NoUSBFlag = &cli.BoolFlag{
+ Name: "nousb",
+ Usage: "Disables monitoring for and managing USB hardware wallets (deprecated)",
+ Category: flags.DeprecatedCategory,
}
- LegacyWSAllowedOriginsFlag = cli.StringFlag{
- Name: "wsorigins",
- Usage: "Origins from which to accept websockets requests (deprecated, use --ws.origins)",
- Value: "",
+ // Deprecated March 2022
+ LegacyWhitelistFlag = &cli.StringFlag{
+ Name: "whitelist",
+ Usage: "Comma separated block number-to-hash mappings to enforce (=) (deprecated in favor of --eth.requiredblocks)",
+ Category: flags.DeprecatedCategory,
}
- LegacyGpoBlocksFlag = cli.IntFlag{
- Name: "gpoblocks",
- Usage: "Number of recent blocks to check for gas prices (deprecated, use --gpo.blocks)",
- Value: ethconfig.Defaults.GPO.Blocks,
- }
- LegacyGpoPercentileFlag = cli.IntFlag{
- Name: "gpopercentile",
- Usage: "Suggested gas price is the given percentile of a set of recent transaction gas prices (deprecated, use --gpo.percentile)",
- Value: ethconfig.Defaults.GPO.Percentile,
+ LegacyDiscoveryV5Flag = &cli.BoolFlag{
+ Name: "v5disc",
+ Usage: "Enables the experimental RLPx V5 (Topic Discovery) mechanism (deprecated, use --discv5 instead)",
+ Category: flags.DeprecatedCategory,
}
)
// showDeprecated displays deprecated flags that will be soon removed from the codebase.
-func showDeprecated(*cli.Context) {
+func showDeprecated(*cli.Context) error {
fmt.Println("--------------------------------------------------------------------")
fmt.Println("The following flags are deprecated and will be removed in the future!")
fmt.Println("--------------------------------------------------------------------")
fmt.Println()
-
for _, flag := range DeprecatedFlags {
fmt.Println(flag.String())
}
+ fmt.Println()
+ return nil
}
diff --git a/cmd/utils/prompt.go b/cmd/utils/prompt.go
index d5f3dca107..c4a7559fbe 100644
--- a/cmd/utils/prompt.go
+++ b/cmd/utils/prompt.go
@@ -1,18 +1,18 @@
// Copyright 2020 The go-ethereum Authors
// This file is part of go-ethereum.
//
-// 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
+// go-ethereum is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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,
+// go-ethereum 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.
+// GNU 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 .
+// You should have received a copy of the GNU General Public License
+// along with go-ethereum. If not, see .
// Package utils contains internal helper functions for go-ethereum commands.
package utils
diff --git a/cmd/utils/prompt_test.go b/cmd/utils/prompt_test.go
index 62ea75a3f6..86ee8b6525 100644
--- a/cmd/utils/prompt_test.go
+++ b/cmd/utils/prompt_test.go
@@ -1,18 +1,18 @@
// Copyright 2020 The go-ethereum Authors
// This file is part of go-ethereum.
//
-// 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
+// go-ethereum is free software: you can redistribute it and/or modify
+// it under the terms of the GNU 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,
+// go-ethereum 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.
+// GNU 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 .
+// You should have received a copy of the GNU General Public License
+// along with go-ethereum. If not, see .
// Package utils contains internal helper functions for go-ethereum commands.
package utils
diff --git a/common/fdlimit/fdlimit_test.go b/common/fdlimit/fdlimit_test.go
index 21362b8463..9fd5e9fc3c 100644
--- a/common/fdlimit/fdlimit_test.go
+++ b/common/fdlimit/fdlimit_test.go
@@ -17,7 +17,6 @@
package fdlimit
import (
- "fmt"
"testing"
)
@@ -30,7 +29,7 @@ func TestFileDescriptorLimits(t *testing.T) {
t.Fatal(err)
}
if hardlimit < target {
- t.Skip(fmt.Sprintf("system limit is less than desired test target: %d < %d", hardlimit, target))
+ t.Skipf("system limit is less than desired test target: %d < %d", hardlimit, target)
}
if limit, err := Current(); err != nil || limit <= 0 {
diff --git a/common/size_test.go b/common/size_test.go
index 0938d483c4..835e3e7d30 100644
--- a/common/size_test.go
+++ b/common/size_test.go
@@ -25,6 +25,8 @@ func TestStorageSizeString(t *testing.T) {
size StorageSize
str string
}{
+ {2839274474874, "2.58 TiB"},
+ {2458492810, "2.29 GiB"},
{2381273, "2.27 MiB"},
{2192, "2.14 KiB"},
{12, "12.00 B"},
@@ -36,3 +38,21 @@ func TestStorageSizeString(t *testing.T) {
}
}
}
+func TestStorageSizeTerminalString(t *testing.T) {
+ tests := []struct {
+ size StorageSize
+ str string
+ }{
+ {2839274474874, "2.58TiB"},
+ {2458492810, "2.29GiB"},
+ {2381273, "2.27MiB"},
+ {2192, "2.14KiB"},
+ {12, "12.00B"},
+ }
+
+ for _, test := range tests {
+ if test.size.TerminalString() != test.str {
+ t.Errorf("%f: got %q, want %q", float64(test.size), test.size.TerminalString(), test.str)
+ }
+ }
+}
diff --git a/console/console.go b/console/console.go
index b8256c0a31..2d07dd2e63 100644
--- a/console/console.go
+++ b/console/console.go
@@ -539,11 +539,6 @@ func countIndents(input string) int {
return indents
}
-// Execute runs the JavaScript file specified as the argument.
-func (c *Console) Execute(path string) error {
- return c.jsre.Exec(path)
-}
-
// Stop cleans up the console and terminates the runtime environment.
func (c *Console) Stop(graceful bool) error {
c.stopOnce.Do(func() {
diff --git a/console/console_test.go b/console/console_test.go
index 461322c6e3..792b19a8d3 100644
--- a/console/console_test.go
+++ b/console/console_test.go
@@ -289,19 +289,6 @@ func TestPreload(t *testing.T) {
}
}
-// Tests that JavaScript scripts can be executes from the configured asset path.
-func TestExecute(t *testing.T) {
- tester := newTester(t, nil)
- defer tester.Close(t)
-
- tester.console.Execute("exec.js")
-
- tester.console.Evaluate("execed")
- if output := tester.output.String(); !strings.Contains(output, "some-executed-string") {
- t.Fatalf("execed variable missing: have %s, want %s", output, "some-executed-string")
- }
-}
-
// Tests that the JavaScript objects returned by statement executions are properly
// pretty printed instead of just displaying "[object]".
func TestPrettyPrint(t *testing.T) {
diff --git a/console/testdata/exec.js b/console/testdata/exec.js
deleted file mode 100644
index 59e34d7c40..0000000000
--- a/console/testdata/exec.js
+++ /dev/null
@@ -1 +0,0 @@
-var execed = "some-executed-string";
diff --git a/core/rawdb/database.go b/core/rawdb/database.go
index 5313e753f4..ae38588c59 100644
--- a/core/rawdb/database.go
+++ b/core/rawdb/database.go
@@ -208,7 +208,7 @@ func NewDatabaseWithFreezer(db ethdb.KeyValueStore, freezer string, namespace st
// are contiguous, otherwise we might end up with a non-functional freezer.
if kvhash, _ := db.Get(headerHashKey(frozen)); len(kvhash) == 0 {
// Subsequent header after the freezer limit is missing from the database.
- // Reject startup is the database has a more recent head.
+ // Reject startup if the database has a more recent head.
if *ReadHeaderNumber(db, ReadHeadHeaderHash(db)) > frozen-1 {
return nil, fmt.Errorf("gap (#%d) in the chain between ancients and leveldb", frozen)
}
diff --git a/core/tx_pool.go b/core/tx_pool.go
index aabbc0de37..3835434a43 100644
--- a/core/tx_pool.go
+++ b/core/tx_pool.go
@@ -203,7 +203,8 @@ type TxPoolConfig struct {
Journal string // Journal of local transactions to survive node restarts
Rejournal time.Duration // Time interval to regenerate the local transaction journal
- PriceBump uint64 // Minimum price bump percentage to replace an already existing transaction (nonce)
+ PriceLimit uint64 // Minimum gas price to enforce for acceptance into the pool
+ PriceBump uint64 // Minimum price bump percentage to replace an already existing transaction (nonce)
AccountSlots uint64 // Number of executable transaction slots guaranteed per account
GlobalSlots uint64 // Maximum number of executable transaction slots for all accounts
@@ -1711,7 +1712,7 @@ func (pool *TxPool) truncatePending() {
pendingRateLimitMeter.Mark(int64(pendingBeforeCap - pending))
}
-// truncateQueue drops the oldes transactions in the queue if the pool is above the global queue limit.
+// truncateQueue drops the oldest transactions in the queue if the pool is above the global queue limit.
func (pool *TxPool) truncateQueue() {
queued := uint64(0)
for _, list := range pool.queue {
diff --git a/eth/api.go b/eth/api.go
index 8dc5e9c5ed..08d3157477 100644
--- a/eth/api.go
+++ b/eth/api.go
@@ -43,17 +43,18 @@ import (
// PrivateMinerAPI provides private RPC methods to control the miner.
// These methods can be abused by external users and must be considered insecure for use by untrusted users.
-type PrivateMinerAPI struct {
+// MinerAPI provides an API to control the miner.
+type MinerAPI struct {
e *Ethereum
}
-// NewPrivateMinerAPI create a new RPC service which controls the miner of this node.
-func NewPrivateMinerAPI(e *Ethereum) *PrivateMinerAPI {
- return &PrivateMinerAPI{e: e}
+// NewMinerAPI create a new MinerAPI instance.
+func NewMinerAPI(e *Ethereum) *MinerAPI {
+ return &MinerAPI{e}
}
// SetGasPrice sets the minimum accepted gas price for the miner.
-func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
+func (api *MinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
api.e.lock.Lock()
api.e.gasPrice = (*big.Int)(&gasPrice)
api.e.lock.Unlock()
@@ -62,21 +63,20 @@ func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
return true
}
-// PrivateAdminAPI is the collection of Ethereum full node-related APIs
-// exposed over the private admin endpoint.
-type PrivateAdminAPI struct {
+// AdminAPI is the collection of Ethereum full node related APIs for node
+// administration.
+type AdminAPI struct {
eth *Ethereum
}
-// NewPrivateAdminAPI creates a new API definition for the full node private
-// admin methods of the Ethereum service.
-func NewPrivateAdminAPI(eth *Ethereum) *PrivateAdminAPI {
- return &PrivateAdminAPI{eth: eth}
+// NewAdminAPI creates a new instance of AdminAPI.
+func NewAdminAPI(eth *Ethereum) *AdminAPI {
+ return &AdminAPI{eth: eth}
}
// ExportChain exports the current blockchain into a local file,
-// or a range of blocks if first and last are non-nil
-func (api *PrivateAdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool, error) {
+// or a range of blocks if first and last are non-nil.
+func (api *AdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool, error) {
if first == nil && last != nil {
return false, errors.New("last cannot be specified without first")
}
@@ -124,7 +124,7 @@ func hasAllBlocks(chain *core.BlockChain, bs []*types.Block) bool {
}
// ImportChain imports a blockchain from a local file.
-func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) {
+func (api *AdminAPI) ImportChain(file string) (bool, error) {
// Make sure the can access the file to import
in, err := os.Open(file)
if err != nil {
@@ -172,20 +172,19 @@ func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) {
return true, nil
}
-// PublicDebugAPI is the collection of Ethereum full node APIs exposed
-// over the public debugging endpoint.
-type PublicDebugAPI struct {
+// DebugAPI is the collection of Ethereum full node APIs for debugging the
+// protocol.
+type DebugAPI struct {
eth *Ethereum
}
-// NewPublicDebugAPI creates a new API definition for the full node-
-// related public debug methods of the Ethereum service.
-func NewPublicDebugAPI(eth *Ethereum) *PublicDebugAPI {
- return &PublicDebugAPI{eth: eth}
+// NewDebugAPI creates a new DebugAPI instance.
+func NewDebugAPI(eth *Ethereum) *DebugAPI {
+ return &DebugAPI{eth: eth}
}
// DumpBlock retrieves the entire state of the database at a given block.
-func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) {
+func (api *DebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) {
opts := &state.DumpConfig{
OnlyWithAddresses: true,
Max: AccountRangeMaxResults, // Sanity limit over RPC
@@ -215,29 +214,17 @@ func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error
}
// EnableDBGC enable database garbage collection.
-func (api *PublicDebugAPI) EnableDBGC() {
+func (api *DebugAPI) EnableDBGC() {
api.eth.BlockChain().EnableDBGC()
}
// DisableDBGC disable database garbage collection.
-func (api *PublicDebugAPI) DisableDBGC() {
+func (api *DebugAPI) DisableDBGC() {
api.eth.BlockChain().DisableDBGC()
}
-// PrivateDebugAPI is the collection of Ethereum full node APIs exposed over
-// the private debugging endpoint.
-type PrivateDebugAPI struct {
- eth *Ethereum
-}
-
-// NewPrivateDebugAPI creates a new API definition for the full node-related
-// private debug methods of the Ethereum service.
-func NewPrivateDebugAPI(eth *Ethereum) *PrivateDebugAPI {
- return &PrivateDebugAPI{eth: eth}
-}
-
// Preimage is a debug API function that returns the preimage for a sha3 hash, if known.
-func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
+func (api *DebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
if preimage := rawdb.ReadPreimage(api.eth.ChainDb(), hash); preimage != nil {
return preimage, nil
}
@@ -252,8 +239,8 @@ type BadBlockArgs struct {
}
// GetBadBlocks returns a list of the last 'bad blocks' that the client has seen on the network
-// and returns them as a JSON list of block-hashes
-func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) {
+// and returns them as a JSON list of block hashes.
+func (api *DebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, error) {
var (
err error
blocks = rawdb.ReadAllBadBlocks(api.eth.chainDb)
@@ -294,7 +281,7 @@ type AccountRangeResult struct {
const AccountRangeMaxResults = 256
// AccountRange enumerates all accounts in the given block and start point in paging request
-func (api *PrivateDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start hexutil.Bytes, maxResults int, nocode, nostorage, incompletes bool) (state.IteratorDump, error) {
+func (api *DebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start hexutil.Bytes, maxResults int, nocode, nostorage, incompletes bool) (state.IteratorDump, error) {
var stateDb *state.StateDB
var err error
@@ -359,7 +346,7 @@ type storageEntry struct {
}
// StorageRangeAt returns the storage at the given block height and transaction index.
-func (api *PrivateDebugAPI) StorageRangeAt(blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) {
+func (api *DebugAPI) StorageRangeAt(blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) {
// Retrieve the block
block := api.eth.blockchain.GetBlockByHash(blockHash)
if block == nil {
@@ -404,7 +391,7 @@ func storageRangeAt(st state.Trie, start []byte, maxResult int) (StorageRangeRes
// code hash, or storage hash.
//
// With one parameter, returns the list of accounts modified in the specified block.
-func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error) {
+func (api *DebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([]common.Address, error) {
var startBlock, endBlock *types.Block
startBlock = api.eth.blockchain.GetBlockByNumber(startNum)
@@ -432,7 +419,7 @@ func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum
// code hash, or storage hash.
//
// With one parameter, returns the list of accounts modified in the specified block.
-func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error) {
+func (api *DebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([]common.Address, error) {
var startBlock, endBlock *types.Block
startBlock = api.eth.blockchain.GetBlockByHash(startHash)
if startBlock == nil {
@@ -454,7 +441,7 @@ func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, end
return api.getModifiedAccounts(startBlock, endBlock)
}
-func (api *PrivateDebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]common.Address, error) {
+func (api *DebugAPI) getModifiedAccounts(startBlock, endBlock *types.Block) ([]common.Address, error) {
if startBlock.Number().Uint64() >= endBlock.Number().Uint64() {
return nil, fmt.Errorf("start block height (%d) must be less than end block height (%d)", startBlock.Number().Uint64(), endBlock.Number().Uint64())
}
@@ -487,7 +474,7 @@ func (api *PrivateDebugAPI) getModifiedAccounts(startBlock, endBlock *types.Bloc
// of the next block.
// The (from, to) parameters are the sequence of blocks to search, which can go
// either forwards or backwards
-func (api *PrivateDebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64, error) {
+func (api *DebugAPI) GetAccessibleState(from, to rpc.BlockNumber) (uint64, error) {
db := api.eth.ChainDb()
var pivot uint64
if p := rawdb.ReadLastPivotNumber(db); p != nil {
diff --git a/eth/backend.go b/eth/backend.go
index 29a0192cf8..84ece7634f 100644
--- a/eth/backend.go
+++ b/eth/backend.go
@@ -98,7 +98,7 @@ type Ethereum struct {
miner *miner.Miner
gasPrice *big.Int
networkID uint64
- netRPCService *ethapi.PublicNetAPI
+ netRPCService *ethapi.NetAPI
p2pServer *p2p.Server
@@ -445,7 +445,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
return nil, err
}
// Start the RPC service
- eth.netRPCService = ethapi.NewPublicNetAPI(eth.p2pServer, config.NetworkId)
+ eth.netRPCService = ethapi.NewNetAPI(eth.p2pServer, config.NetworkId)
// Register the backend on the node
stack.RegisterAPIs(eth.APIs())
@@ -492,31 +492,23 @@ func (s *Ethereum) APIs() []rpc.API {
{
Namespace: "platon",
Version: "1.0",
- Service: downloader.NewPublicDownloaderAPI(s.handler.downloader, s.eventMux),
- Public: true,
+ Service: downloader.NewDownloaderAPI(s.handler.downloader, s.eventMux),
}, {
Namespace: "miner",
Version: "1.0",
- Service: NewPrivateMinerAPI(s),
- Public: false,
+ Service: NewMinerAPI(s),
}, {
Namespace: "platon",
Version: "1.0",
- Service: filters.NewPublicFilterAPI(s.APIBackend, false, 5*time.Minute),
- Public: true,
+ Service: filters.NewFilterAPI(s.APIBackend, false, 5*time.Minute),
}, {
Namespace: "admin",
Version: "1.0",
- Service: NewPrivateAdminAPI(s),
+ Service: NewAdminAPI(s),
}, {
Namespace: "debug",
Version: "1.0",
- Service: NewPublicDebugAPI(s),
- Public: true,
- }, {
- Namespace: "debug",
- Version: "1.0",
- Service: NewPrivateDebugAPI(s),
+ Service: NewDebugAPI(s),
}, {
Namespace: "debug",
Version: "1.0",
@@ -525,13 +517,11 @@ func (s *Ethereum) APIs() []rpc.API {
Namespace: "net",
Version: "1.0",
Service: s.netRPCService,
- Public: true,
},
{
Namespace: "txgen",
Version: "1.0",
Service: NewTxGenAPI(s),
- Public: true,
},
}...)
}
diff --git a/eth/downloader/api.go b/eth/downloader/api.go
index 0319bf7f88..d9bb2338e0 100644
--- a/eth/downloader/api.go
+++ b/eth/downloader/api.go
@@ -25,21 +25,21 @@ import (
"github.com/PlatONnetwork/PlatON-Go/rpc"
)
-// PublicDownloaderAPI provides an API which gives information about the current synchronisation status.
+// DownloaderAPI provides an API which gives information about the current synchronisation status.
// It offers only methods that operates on data that can be available to anyone without security risks.
-type PublicDownloaderAPI struct {
+type DownloaderAPI struct {
d *Downloader
mux *event.TypeMux
installSyncSubscription chan chan interface{}
uninstallSyncSubscription chan *uninstallSyncSubscriptionRequest
}
-// NewPublicDownloaderAPI create a new PublicDownloaderAPI. The API has an internal event loop that
+// NewDownloaderAPI create a new DownloaderAPI. The API has an internal event loop that
// listens for events from the downloader through the global event mux. In case it receives one of
// these events it broadcasts it to all syncing subscriptions that are installed through the
// installSyncSubscription channel.
-func NewPublicDownloaderAPI(d *Downloader, m *event.TypeMux) *PublicDownloaderAPI {
- api := &PublicDownloaderAPI{
+func NewDownloaderAPI(d *Downloader, m *event.TypeMux) *DownloaderAPI {
+ api := &DownloaderAPI{
d: d,
mux: m,
installSyncSubscription: make(chan chan interface{}),
@@ -53,7 +53,7 @@ func NewPublicDownloaderAPI(d *Downloader, m *event.TypeMux) *PublicDownloaderAP
// eventLoop runs a loop until the event mux closes. It will install and uninstall new
// sync subscriptions and broadcasts sync status updates to the installed sync subscriptions.
-func (api *PublicDownloaderAPI) eventLoop() {
+func (api *DownloaderAPI) eventLoop() {
var (
sub = api.mux.Subscribe(StartEvent{}, DoneEvent{}, FailedEvent{})
syncSubscriptions = make(map[chan interface{}]struct{})
@@ -90,7 +90,7 @@ func (api *PublicDownloaderAPI) eventLoop() {
}
// Syncing provides information when this nodes starts synchronising with the Ethereum network and when it's finished.
-func (api *PublicDownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error) {
+func (api *DownloaderAPI) Syncing(ctx context.Context) (*rpc.Subscription, error) {
notifier, supported := rpc.NotifierFromContext(ctx)
if !supported {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
@@ -133,9 +133,9 @@ type uninstallSyncSubscriptionRequest struct {
// SyncStatusSubscription represents a syncing subscription.
type SyncStatusSubscription struct {
- api *PublicDownloaderAPI // register subscription in event loop of this api instance
- c chan interface{} // channel where events are broadcasted to
- unsubOnce sync.Once // make sure unsubscribe logic is executed once
+ api *DownloaderAPI // register subscription in event loop of this api instance
+ c chan interface{} // channel where events are broadcasted to
+ unsubOnce sync.Once // make sure unsubscribe logic is executed once
}
// Unsubscribe uninstalls the subscription from the DownloadAPI event loop.
@@ -160,7 +160,7 @@ func (s *SyncStatusSubscription) Unsubscribe() {
// SubscribeSyncStatus creates a subscription that will broadcast new synchronisation updates.
// The given channel must receive interface values, the result can either.
-func (api *PublicDownloaderAPI) SubscribeSyncStatus(status chan interface{}) *SyncStatusSubscription {
+func (api *DownloaderAPI) SubscribeSyncStatus(status chan interface{}) *SyncStatusSubscription {
api.installSyncSubscription <- status
return &SyncStatusSubscription{api: api, c: status}
}
diff --git a/eth/filters/api.go b/eth/filters/api.go
index 068033041c..c0f22fbf63 100644
--- a/eth/filters/api.go
+++ b/eth/filters/api.go
@@ -43,9 +43,9 @@ type filter struct {
s *Subscription // associated subscription in event system
}
-// PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
+// FilterAPI offers support to create and manage filters. This will allow external clients to retrieve various
// information related to the Ethereum protocol such als blocks, transactions and logs.
-type PublicFilterAPI struct {
+type FilterAPI struct {
backend Backend
events *EventSystem
filtersMu sync.Mutex
@@ -53,9 +53,9 @@ type PublicFilterAPI struct {
timeout time.Duration
}
-// NewPublicFilterAPI returns a new PublicFilterAPI instance.
-func NewPublicFilterAPI(backend Backend, lightMode bool, timeout time.Duration) *PublicFilterAPI {
- api := &PublicFilterAPI{
+// NewFilterAPI returns a new FilterAPI instance.
+func NewFilterAPI(backend Backend, lightMode bool, timeout time.Duration) *FilterAPI {
+ api := &FilterAPI{
backend: backend,
events: NewEventSystem(backend, lightMode),
filters: make(map[rpc.ID]*filter),
@@ -68,7 +68,7 @@ func NewPublicFilterAPI(backend Backend, lightMode bool, timeout time.Duration)
// timeoutLoop runs every 5 minutes and deletes filters that have not been recently used.
// Tt is started when the api is created.
-func (api *PublicFilterAPI) timeoutLoop(timeout time.Duration) {
+func (api *FilterAPI) timeoutLoop(timeout time.Duration) {
var toUninstall []*Subscription
ticker := time.NewTicker(timeout)
defer ticker.Stop()
@@ -101,7 +101,7 @@ func (api *PublicFilterAPI) timeoutLoop(timeout time.Duration) {
//
// It is part of the filter package because this filter can be used through the
// `eth_getFilterChanges` polling method that is also used for log filters.
-func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
+func (api *FilterAPI) NewPendingTransactionFilter() rpc.ID {
var (
pendingTxs = make(chan []common.Hash)
pendingTxSub = api.events.SubscribePendingTxs(pendingTxs)
@@ -134,7 +134,7 @@ func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID {
// NewPendingTransactions creates a subscription that is triggered each time a transaction
// enters the transaction pool and was signed from one of the transactions this nodes manages.
-func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
+func (api *FilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Subscription, error) {
notifier, supported := rpc.NotifierFromContext(ctx)
if !supported {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
@@ -169,7 +169,7 @@ func (api *PublicFilterAPI) NewPendingTransactions(ctx context.Context) (*rpc.Su
// NewBlockFilter creates a filter that fetches blocks that are imported into the chain.
// It is part of the filter package since polling goes with eth_getFilterChanges.
-func (api *PublicFilterAPI) NewBlockFilter() rpc.ID {
+func (api *FilterAPI) NewBlockFilter() rpc.ID {
var (
headers = make(chan *types.Header)
headerSub = api.events.SubscribeNewHeads(headers)
@@ -201,7 +201,7 @@ func (api *PublicFilterAPI) NewBlockFilter() rpc.ID {
}
// NewHeads send a notification each time a new (header) block is appended to the chain.
-func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
+func (api *FilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, error) {
notifier, supported := rpc.NotifierFromContext(ctx)
if !supported {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
@@ -231,7 +231,7 @@ func (api *PublicFilterAPI) NewHeads(ctx context.Context) (*rpc.Subscription, er
}
// Logs creates a subscription that fires for all new log that match the given filter criteria.
-func (api *PublicFilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subscription, error) {
+func (api *FilterAPI) Logs(ctx context.Context, crit FilterCriteria) (*rpc.Subscription, error) {
notifier, supported := rpc.NotifierFromContext(ctx)
if !supported {
return &rpc.Subscription{}, rpc.ErrNotificationsUnsupported
@@ -284,7 +284,7 @@ type FilterCriteria ethereum.FilterQuery
// again but with the removed property set to true.
//
// In case "fromBlock" > "toBlock" an error is returned.
-func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
+func (api *FilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
logs := make(chan []*types.Log)
logsSub, err := api.events.SubscribeLogs(ethereum.FilterQuery(crit), logs)
if err != nil {
@@ -317,7 +317,7 @@ func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) {
}
// GetLogs returns logs matching the given argument that are stored within the state.
-func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
+func (api *FilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([]*types.Log, error) {
var filter *Filter
if crit.BlockHash != nil {
// Block filter requested, construct a single-shot filter
@@ -344,7 +344,7 @@ func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([
}
// UninstallFilter removes the filter with the given filter id.
-func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool {
+func (api *FilterAPI) UninstallFilter(id rpc.ID) bool {
api.filtersMu.Lock()
f, found := api.filters[id]
if found {
@@ -360,7 +360,7 @@ func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool {
// GetFilterLogs returns the logs for the filter with the given id.
// If the filter could not be found an empty array of logs is returned.
-func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error) {
+func (api *FilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*types.Log, error) {
api.filtersMu.Lock()
f, found := api.filters[id]
api.filtersMu.Unlock()
@@ -399,7 +399,7 @@ func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([]*ty
//
// For pending transaction and block filters the result is []common.Hash.
// (pending)Log filters return []Log.
-func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
+func (api *FilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) {
api.filtersMu.Lock()
defer api.filtersMu.Unlock()
diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go
index 094a162b6b..fb34d935d2 100644
--- a/eth/filters/filter_system_test.go
+++ b/eth/filters/filter_system_test.go
@@ -173,7 +173,7 @@ func TestBlockSubscription(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
genesis = (&core.Genesis{BaseFee: big.NewInt(params.InitialBaseFee)}).MustCommit(db)
//ctx = node.NewServiceContext(&node.Config{DataDir: ""}, nil, new(event.TypeMux), nil)
@@ -228,7 +228,7 @@ func TestPendingTxFilter(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
transactions = []*types.Transaction{
types.NewTransaction(0, common.MustBech32ToAddress("lax1k720t6st5w2ffn5r5gfll7a8gfu40yngyvr9yv"), new(big.Int), 0, new(big.Int), nil),
@@ -283,7 +283,7 @@ func TestLogFilterCreation(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
testCases = []struct {
crit FilterCriteria
@@ -330,7 +330,7 @@ func TestInvalidLogFilterCreation(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
)
// different situations where log filter creation should fail.
@@ -352,7 +352,7 @@ func TestInvalidGetLogsRequest(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
blockHash = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111")
)
@@ -377,7 +377,7 @@ func TestLogFilter(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
firstAddr = common.MustBech32ToAddress("lax1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3fw0wpq")
secondAddr = common.MustBech32ToAddress("lax1yg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zxn2gfh")
@@ -491,7 +491,7 @@ func TestPendingLogsSubscription(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, deadline)
+ api = NewFilterAPI(backend, false, deadline)
firstAddr = common.MustBech32ToAddress("lax1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3fw0wpq")
secondAddr = common.MustBech32ToAddress("lax1yg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zxn2gfh")
@@ -675,7 +675,7 @@ func TestPendingTxFilterDeadlock(t *testing.T) {
var (
db = rawdb.NewMemoryDatabase()
backend = &testBackend{db: db}
- api = NewPublicFilterAPI(backend, false, timeout)
+ api = NewFilterAPI(backend, false, timeout)
done = make(chan struct{})
)
diff --git a/eth/handler.go b/eth/handler.go
index 87d6513d8d..335e25405d 100644
--- a/eth/handler.go
+++ b/eth/handler.go
@@ -226,7 +226,7 @@ func newHandler(config *handlerConfig) (*handler, error) {
}
// runEthPeer registers an eth peer into the joint eth/snap peerset, adds it to
-// various subsistems and starts handling messages.
+// various subsystems and starts handling messages.
func (h *handler) runEthPeer(peer *eth.Peer, handler eth.Handler) error {
// If the peer has a `snap` extension, wait for it to connect so we can have
// a uniform initialization/teardown mechanism
diff --git a/eth/tracers/api.go b/eth/tracers/api.go
index 2af79e4dee..98f0bc1f0d 100644
--- a/eth/tracers/api.go
+++ b/eth/tracers/api.go
@@ -919,7 +919,6 @@ func APIs(backend Backend) []rpc.API {
Namespace: "debug",
Version: "1.0",
Service: NewAPI(backend),
- Public: false,
},
}
}
diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go
index 7e8fbbb959..6e849dc668 100644
--- a/eth/tracers/js/goja.go
+++ b/eth/tracers/js/goja.go
@@ -55,11 +55,7 @@ type fromBufFn = func(vm *goja.Runtime, buf goja.Value, allowString bool) ([]byt
func toBuf(vm *goja.Runtime, bufType goja.Value, val []byte) (goja.Value, error) {
// bufType is usually Uint8Array. This is equivalent to `new Uint8Array(val)` in JS.
- res, err := vm.New(bufType, vm.ToValue(val))
- if err != nil {
- return nil, err
- }
- return vm.ToValue(res), nil
+ return vm.New(bufType, vm.ToValue(vm.NewArrayBuffer(val)))
}
func fromBuf(vm *goja.Runtime, bufType goja.Value, buf goja.Value, allowString bool) ([]byte, error) {
@@ -81,10 +77,7 @@ func fromBuf(vm *goja.Runtime, bufType goja.Value, buf goja.Value, allowString b
if !obj.Get("constructor").SameAs(bufType) {
break
}
- var b []byte
- if err := vm.ExportTo(buf, &b); err != nil {
- return nil, err
- }
+ b := obj.Get("buffer").Export().(goja.ArrayBuffer).Bytes()
return b, nil
}
return nil, fmt.Errorf("invalid buffer type")
@@ -766,7 +759,7 @@ func (co *contractObj) GetValue() goja.Value {
}
func (co *contractObj) GetInput() goja.Value {
- input := co.contract.Input
+ input := common.CopyBytes(co.contract.Input)
res, err := co.toBuf(co.vm, input)
if err != nil {
co.vm.Interrupt(err)
diff --git a/go.mod b/go.mod
index bf260950e8..1a86883d01 100644
--- a/go.mod
+++ b/go.mod
@@ -61,7 +61,6 @@ require (
golang.org/x/tools v0.8.0
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
- gopkg.in/urfave/cli.v1 v1.20.0
gotest.tools v2.2.0+incompatible
gotest.tools/v3 v3.4.0 // indirect
)
@@ -70,7 +69,10 @@ require (
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/golang-jwt/jwt/v4 v4.5.0
+ github.com/herumi/bls v1.37.0
github.com/influxdata/influxdb-client-go/v2 v2.12.3
+ github.com/karalabe/usb v0.0.2
+ github.com/urfave/cli/v2 v2.24.1
golang.org/x/net v0.17.0
)
@@ -78,6 +80,7 @@ require (
github.com/AlayaNetwork/Alaya-Go v0.16.2 // indirect
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
github.com/cespare/xxhash/v2 v2.1.1 // indirect
+ github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect
github.com/edsrzf/mmap-go v1.0.1-0.20190108065903-904c4ced31cd // indirect
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
@@ -96,9 +99,11 @@ require (
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
+ github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.6.0 // indirect
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc // indirect
+ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/mod v0.10.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
diff --git a/go.sum b/go.sum
index 087f555e9b..298871291a 100644
--- a/go.sum
+++ b/go.sum
@@ -4,6 +4,7 @@ github.com/AlayaNetwork/graphql-go v1.2.1-0.20211227063951-8d66eefcb4e3 h1:bkL6x
github.com/AlayaNetwork/graphql-go v1.2.1-0.20211227063951-8d66eefcb4e3/go.mod h1:RHF+g+4wWGXz6ICiHRyomjpcdRi+vt7SAzXGzuXXxPk=
github.com/Azure/azure-pipeline-go v0.0.0-20180607212504-7571e8eb0876/go.mod h1:XA1kFWRVhSK+KNFiOhfv83Fv8L9achrP7OxIzeTn1Yg=
github.com/Azure/azure-storage-blob-go v0.0.0-20180712005634-eaae161d9d5e/go.mod h1:x2mtS6O3mnMEZOJp7d7oldh8IvatBrMfReiyQ+cKgKY=
+github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/PlatONnetwork/wagon v0.6.1-0.20201026015350-67507c2a7b96 h1:BA5xEQQrv82VdaxUoAZeGi/G/UQ3z6z+eNe2rijhhpg=
github.com/PlatONnetwork/wagon v0.6.1-0.20201026015350-67507c2a7b96/go.mod h1:zPWloKR2Ep7uqrhyLyE483NCxlAlQnbPsQUJXWN6bVM=
@@ -41,6 +42,8 @@ github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko=
github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc=
github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=
+github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4=
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -141,6 +144,8 @@ github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/herumi/bls v1.37.0 h1:EKPaFujxWsxSMlfN1NeR9GTfVOeAsAaNRGbdBfn9lBE=
+github.com/herumi/bls v1.37.0/go.mod h1:CnmR5QZ/QBnBE8Z55O+OtmUc6ICUdrOW9fwSRQwz5Bo=
github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao=
github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA=
github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
@@ -171,6 +176,8 @@ github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4d
github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/karalabe/hid v0.0.0-20170821103837-f00545f9f374 h1:qWVzfdrfgIeyHoUq3uICwVa0xGUVXq+LNNBixlXFWBo=
github.com/karalabe/hid v0.0.0-20170821103837-f00545f9f374/go.mod h1:YvbcH+3Wo6XPs9nkgTY3u19KXLauXW+J5nB7hEHuX0A=
+github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4=
+github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU=
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515 h1:T+h1c/A9Gawja4Y9mFVWj2vyii2bbUNDw3kt9VxK2EY=
@@ -277,6 +284,8 @@ github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00/go.mod h1:gFx+x8UowdsKA9Ac
github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik=
github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU=
github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521/go.mod h1:RvLn4FgxWubrpZHtQLnOf6EwhN2hEMusxZOhcW9H3UQ=
+github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/shirou/gopsutil v2.20.5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1:Bn1aCHHRnjv4Bl16T8rcaFjYSrGrIZvpiGO6P3Q4GpU=
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA=
@@ -308,9 +317,13 @@ github.com/tklauser/numcpus v0.6.0 h1:kebhY2Qt+3U6RNK7UqpYNA+tJ23IBEGKkB7JQBfDYm
github.com/tklauser/numcpus v0.6.0/go.mod h1:FEZLMke0lhOUG6w2JadTzp0a+Nl8PF/GFkQ5UVIcaL4=
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc h1:RTUQlKzoZZVG3umWNzOYeFecQLIh+dbxXvJp1zPQJTI=
github.com/twitchyliquid64/golang-asm v0.0.0-20190126203739-365674df15fc/go.mod h1:NoCfSFWosfqMqmmD7hApkirIK9ozpHjxRnRxs1l413A=
+github.com/urfave/cli/v2 v2.24.1 h1:/QYYr7g0EhwXEML8jO+8OYt5trPnLHS0p3mrgExJ5NU=
+github.com/urfave/cli/v2 v2.24.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
+github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
+github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
@@ -457,7 +470,6 @@ gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200316214253-d7b0ff38cac9/go.mod h1:uAJ
gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
-gopkg.in/urfave/cli.v1 v1.20.0 h1:NdAVW6RYxDif9DhDHaAortIu956m2c0v+09AZBPTbE0=
gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/internal/debug/flags.go b/internal/debug/flags.go
index 523a85d969..c928f2ebe8 100644
--- a/internal/debug/flags.go
+++ b/internal/debug/flags.go
@@ -18,6 +18,7 @@ package debug
import (
"fmt"
+ "github.com/PlatONnetwork/PlatON-Go/internal/flags"
"github.com/mattn/go-isatty"
"io"
"net/http"
@@ -30,71 +31,83 @@ import (
"github.com/PlatONnetwork/PlatON-Go/metrics/exp"
"github.com/fjl/memsize/memsizeui"
"github.com/mattn/go-colorable"
- "gopkg.in/urfave/cli.v1"
+ "github.com/urfave/cli/v2"
)
var Memsize memsizeui.Handler
var (
- verbosityFlag = cli.IntFlag{
- Name: "verbosity",
- Usage: "Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail",
- Value: 3,
- }
- vmoduleFlag = cli.StringFlag{
- Name: "vmodule",
- Usage: "Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)",
- Value: "",
- }
- logjsonFlag = cli.BoolFlag{
- Name: "log.json",
- Usage: "Format logs with JSON",
- }
- backtraceAtFlag = cli.StringFlag{
- Name: "log.backtrace",
- Usage: "Request a stack trace at a specific logging statement (e.g. \"block.go:271\")",
- Value: "",
- }
- debugFlag = cli.BoolFlag{
- Name: "log.debug",
- Usage: "Prepends log messages with call-site location (file and line number)",
- }
- pprofFlag = cli.BoolFlag{
- Name: "pprof",
- Usage: "Enable the pprof HTTP server",
- }
- pprofPortFlag = cli.IntFlag{
- Name: "pprof.port",
- Usage: "pprof HTTP server listening port",
- Value: 6060,
- }
- pprofAddrFlag = cli.StringFlag{
- Name: "pprof.addr",
- Usage: "pprof HTTP server listening interface",
- Value: "127.0.0.1",
- }
- memprofilerateFlag = cli.IntFlag{
- Name: "pprof.memprofilerate",
- Usage: "Turn on memory profiling with the given rate",
- Value: runtime.MemProfileRate,
- }
- blockprofilerateFlag = cli.IntFlag{
- Name: "pprof.blockprofilerate",
- Usage: "Turn on block profiling with the given rate",
- }
- cpuprofileFlag = cli.StringFlag{
- Name: "pprof.cpuprofile",
- Usage: "Write CPU profile to the given file",
- }
- traceFlag = cli.StringFlag{
- Name: "trace",
- Usage: "Write execution trace to the given file",
- }
-
- wasmLogFileFlag = cli.StringFlag{
- Name: "wasmlog",
- Usage: "output wasm contract log to file",
- Value: "",
+ verbosityFlag = &cli.IntFlag{
+ Name: "verbosity",
+ Usage: "Logging verbosity: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail",
+ Value: 3,
+ Category: flags.LoggingCategory,
+ }
+ vmoduleFlag = &cli.StringFlag{
+ Name: "vmodule",
+ Usage: "Per-module verbosity: comma-separated list of = (e.g. eth/*=5,p2p=4)",
+ Value: "",
+ Category: flags.LoggingCategory,
+ }
+ logjsonFlag = &cli.BoolFlag{
+ Name: "log.json",
+ Usage: "Format logs with JSON",
+ Category: flags.LoggingCategory,
+ }
+ backtraceAtFlag = &cli.StringFlag{
+ Name: "log.backtrace",
+ Usage: "Request a stack trace at a specific logging statement (e.g. \"block.go:271\")",
+ Value: "",
+ Category: flags.LoggingCategory,
+ }
+ debugFlag = &cli.BoolFlag{
+ Name: "log.debug",
+ Usage: "Prepends log messages with call-site location (file and line number)",
+ Category: flags.LoggingCategory,
+ }
+ pprofFlag = &cli.BoolFlag{
+ Name: "pprof",
+ Usage: "Enable the pprof HTTP server",
+ Category: flags.LoggingCategory,
+ }
+ pprofPortFlag = &cli.IntFlag{
+ Name: "pprof.port",
+ Usage: "pprof HTTP server listening port",
+ Value: 6060,
+ Category: flags.LoggingCategory,
+ }
+ pprofAddrFlag = &cli.StringFlag{
+ Name: "pprof.addr",
+ Usage: "pprof HTTP server listening interface",
+ Value: "127.0.0.1",
+ Category: flags.LoggingCategory,
+ }
+ memprofilerateFlag = &cli.IntFlag{
+ Name: "pprof.memprofilerate",
+ Usage: "Turn on memory profiling with the given rate",
+ Value: runtime.MemProfileRate,
+ Category: flags.LoggingCategory,
+ }
+ blockprofilerateFlag = &cli.IntFlag{
+ Name: "pprof.blockprofilerate",
+ Usage: "Turn on block profiling with the given rate",
+ Category: flags.LoggingCategory,
+ }
+ cpuprofileFlag = &cli.StringFlag{
+ Name: "pprof.cpuprofile",
+ Usage: "Write CPU profile to the given file",
+ Category: flags.LoggingCategory,
+ }
+ traceFlag = &cli.StringFlag{
+ Name: "trace",
+ Usage: "Write execution trace to the given file",
+ Category: flags.LoggingCategory,
+ }
+ wasmLogFileFlag = &cli.StringFlag{
+ Name: "wasmlog",
+ Usage: "output wasm contract log to file",
+ Value: "",
+ Category: flags.LoggingCategory,
}
)
@@ -128,7 +141,7 @@ func init() {
func Setup(ctx *cli.Context) error {
var ostream log.Handler
output := io.Writer(os.Stderr)
- if ctx.GlobalBool(logjsonFlag.Name) {
+ if ctx.Bool(logjsonFlag.Name) {
ostream = log.StreamHandler(output, log.JSONFormat())
} else {
usecolor := (isatty.IsTerminal(os.Stderr.Fd()) || isatty.IsCygwinTerminal(os.Stderr.Fd())) && os.Getenv("TERM") != "dumb"
@@ -140,60 +153,60 @@ func Setup(ctx *cli.Context) error {
glogger.SetHandler(ostream)
// logging
- verbosity := ctx.GlobalInt(verbosityFlag.Name)
+ verbosity := ctx.Int(verbosityFlag.Name)
glogger.Verbosity(log.Lvl(verbosity))
- vmodule := ctx.GlobalString(vmoduleFlag.Name)
+ vmodule := ctx.String(vmoduleFlag.Name)
glogger.Vmodule(vmodule)
- debug := ctx.GlobalBool(debugFlag.Name)
- if ctx.GlobalIsSet(debugFlag.Name) {
- debug = ctx.GlobalBool(debugFlag.Name)
+ debug := ctx.Bool(debugFlag.Name)
+ if ctx.IsSet(debugFlag.Name) {
+ debug = ctx.Bool(debugFlag.Name)
}
log.PrintOrigins(debug)
- backtrace := ctx.GlobalString(backtraceAtFlag.Name)
+ backtrace := ctx.String(backtraceAtFlag.Name)
glogger.BacktraceAt(backtrace)
log.Root().SetHandler(glogger)
// profiling, tracing
runtime.MemProfileRate = memprofilerateFlag.Value
- if ctx.GlobalIsSet(memprofilerateFlag.Name) {
- runtime.MemProfileRate = ctx.GlobalInt(memprofilerateFlag.Name)
+ if ctx.IsSet(memprofilerateFlag.Name) {
+ runtime.MemProfileRate = ctx.Int(memprofilerateFlag.Name)
}
- blockProfileRate := ctx.GlobalInt(blockprofilerateFlag.Name)
+ blockProfileRate := ctx.Int(blockprofilerateFlag.Name)
Handler.SetBlockProfileRate(blockProfileRate)
- if traceFile := ctx.GlobalString(traceFlag.Name); traceFile != "" {
+ if traceFile := ctx.String(traceFlag.Name); traceFile != "" {
if err := Handler.StartGoTrace(traceFile); err != nil {
return err
}
}
- if cpuFile := ctx.GlobalString(cpuprofileFlag.Name); cpuFile != "" {
+ if cpuFile := ctx.String(cpuprofileFlag.Name); cpuFile != "" {
if err := Handler.StartCPUProfile(cpuFile); err != nil {
return err
}
}
// pprof server
- if ctx.GlobalBool(pprofFlag.Name) {
- listenHost := ctx.GlobalString(pprofAddrFlag.Name)
+ if ctx.Bool(pprofFlag.Name) {
+ listenHost := ctx.String(pprofAddrFlag.Name)
- port := ctx.GlobalInt(pprofPortFlag.Name)
+ port := ctx.Int(pprofPortFlag.Name)
address := fmt.Sprintf("%s:%d", listenHost, port)
// This context value ("metrics.addr") represents the utils.MetricsHTTPFlag.Name.
// It cannot be imported because it will cause a cyclical dependency.
- StartPProf(address, !ctx.GlobalIsSet("metrics.addr"))
+ StartPProf(address, !ctx.IsSet("metrics.addr"))
}
return nil
}
func SetupWasmLog(ctx *cli.Context) error {
- log.SetWasmLogLevel(log.Lvl(ctx.GlobalInt(verbosityFlag.Name)))
- wasmFileName := ctx.GlobalString(wasmLogFileFlag.Name)
+ log.SetWasmLogLevel(log.Lvl(ctx.Int(verbosityFlag.Name)))
+ wasmFileName := ctx.String(wasmLogFileFlag.Name)
if wasmFileName == "" {
log.WasmRoot().SetHandler(log.Root().GetHandler())
diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go
index 9ff9e5a994..077fbe38dc 100644
--- a/internal/ethapi/api.go
+++ b/internal/ethapi/api.go
@@ -51,19 +51,19 @@ import (
"github.com/davecgh/go-spew/spew"
)
-// PublicEthereumAPI provides an API to access Ethereum related information.
+// EthereumAPI provides an API to access Ethereum related information.
// It offers only methods that operate on public data that is freely available to anyone.
-type PublicEthereumAPI struct {
+type EthereumAPI struct {
b Backend
}
-// NewPublicEthereumAPI creates a new Ethereum protocol API.
-func NewPublicEthereumAPI(b Backend) *PublicEthereumAPI {
- return &PublicEthereumAPI{b}
+// NewEthereumAPI creates a new Ethereum protocol API.
+func NewEthereumAPI(b Backend) *EthereumAPI {
+ return &EthereumAPI{b}
}
// GasPrice returns a suggestion for a gas price for legacy transactions.
-func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
+func (s *EthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) {
tipcap, err := s.b.SuggestGasTipCap(ctx)
if err != nil {
return nil, err
@@ -75,7 +75,7 @@ func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error)
}
// MaxPriorityFeePerGas returns a suggestion for a gas tip cap for dynamic transactions.
-func (s *PublicEthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error) {
+func (s *EthereumAPI) MaxPriorityFeePerGas(ctx context.Context) (*hexutil.Big, error) {
tipcap, err := s.b.SuggestGasTipCap(ctx)
if err != nil {
return nil, err
@@ -90,7 +90,7 @@ type feeHistoryResult struct {
GasUsedRatio []float64 `json:"gasUsedRatio"`
}
-func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error) {
+func (s *EthereumAPI) FeeHistory(ctx context.Context, blockCount rpc.DecimalOrHex, lastBlock rpc.BlockNumber, rewardPercentiles []float64) (*feeHistoryResult, error) {
oldest, reward, baseFee, gasUsed, err := s.b.FeeHistory(ctx, int(blockCount), lastBlock, rewardPercentiles)
if err != nil {
return nil, err
@@ -124,7 +124,7 @@ func (s *PublicEthereumAPI) FeeHistory(ctx context.Context, blockCount rpc.Decim
// - highestBlock: block number of the highest block header this node has received from peers
// - pulledStates: number of state entries processed until now
// - knownStates: number of known state entries that still need to be pulled
-func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
+func (s *EthereumAPI) Syncing() (interface{}, error) {
progress := s.b.SyncProgress()
// Return not syncing if the synchronisation already completed
@@ -151,18 +151,18 @@ func (s *PublicEthereumAPI) Syncing() (interface{}, error) {
}, nil
}
-// PublicTxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.
-type PublicTxPoolAPI struct {
+// TxPoolAPI offers and API for the transaction pool. It only operates on data that is non confidential.
+type TxPoolAPI struct {
b Backend
}
-// NewPublicTxPoolAPI creates a new tx pool service that gives information about the transaction pool.
-func NewPublicTxPoolAPI(b Backend) *PublicTxPoolAPI {
- return &PublicTxPoolAPI{b}
+// NewTxPoolAPI creates a new tx pool service that gives information about the transaction pool.
+func NewTxPoolAPI(b Backend) *TxPoolAPI {
+ return &TxPoolAPI{b}
}
// Content returns the transactions contained within the transaction pool.
-func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
+func (s *TxPoolAPI) Content() map[string]map[string]map[string]*RPCTransaction {
content := map[string]map[string]map[string]*RPCTransaction{
"pending": make(map[string]map[string]*RPCTransaction),
"queued": make(map[string]map[string]*RPCTransaction),
@@ -189,7 +189,7 @@ func (s *PublicTxPoolAPI) Content() map[string]map[string]map[string]*RPCTransac
}
// ContentFrom returns the transactions contained within the transaction pool.
-func (s *PublicTxPoolAPI) ContentFrom(addr common.Address) map[string]map[string]*RPCTransaction {
+func (s *TxPoolAPI) ContentFrom(addr common.Address) map[string]map[string]*RPCTransaction {
content := make(map[string]map[string]*RPCTransaction, 2)
pending, queue := s.b.TxPoolContentFrom(addr)
curHeader := s.b.CurrentHeader()
@@ -212,7 +212,7 @@ func (s *PublicTxPoolAPI) ContentFrom(addr common.Address) map[string]map[string
}
// Status returns the number of pending and queued transaction in the pool.
-func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint {
+func (s *TxPoolAPI) Status() map[string]hexutil.Uint {
pending, queue := s.b.Stats()
return map[string]hexutil.Uint{
"pending": hexutil.Uint(pending),
@@ -222,7 +222,7 @@ func (s *PublicTxPoolAPI) Status() map[string]hexutil.Uint {
// Inspect retrieves the content of the transaction pool and flattens it into an
// easily inspectable list.
-func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string {
+func (s *TxPoolAPI) Inspect() map[string]map[string]map[string]string {
content := map[string]map[string]map[string]string{
"pending": make(map[string]map[string]string),
"queued": make(map[string]map[string]string),
@@ -255,34 +255,34 @@ func (s *PublicTxPoolAPI) Inspect() map[string]map[string]map[string]string {
return content
}
-// PublicAccountAPI provides an API to access accounts managed by this node.
+// EthereumAccountAPI provides an API to access accounts managed by this node.
// It offers only methods that can retrieve accounts.
-type PublicAccountAPI struct {
+type EthereumAccountAPI struct {
am *accounts.Manager
}
-// NewPublicAccountAPI creates a new PublicAccountAPI.
-func NewPublicAccountAPI(am *accounts.Manager) *PublicAccountAPI {
- return &PublicAccountAPI{am: am}
+// NewEthereumAccountAPI creates a new EthereumAccountAPI.
+func NewEthereumAccountAPI(am *accounts.Manager) *EthereumAccountAPI {
+ return &EthereumAccountAPI{am: am}
}
// Accounts returns the collection of accounts this node manages
-func (s *PublicAccountAPI) Accounts() []common.Address {
+func (s *EthereumAccountAPI) Accounts() []common.Address {
return s.am.Accounts()
}
-// PrivateAccountAPI provides an API to access accounts managed by this node.
+// PersonalAccountAPI provides an API to access accounts managed by this node.
// It offers methods to create, (un)lock en list accounts. Some methods accept
// passwords and are therefore considered private by default.
-type PrivateAccountAPI struct {
+type PersonalAccountAPI struct {
am *accounts.Manager
nonceLock *AddrLocker
b Backend
}
-// NewPrivateAccountAPI create a new PrivateAccountAPI.
-func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI {
- return &PrivateAccountAPI{
+// NewPersonalAccountAPI create a new PersonalAccountAPI.
+func NewPersonalAccountAPI(b Backend, nonceLock *AddrLocker) *PersonalAccountAPI {
+ return &PersonalAccountAPI{
am: b.AccountManager(),
nonceLock: nonceLock,
b: b,
@@ -290,7 +290,7 @@ func NewPrivateAccountAPI(b Backend, nonceLock *AddrLocker) *PrivateAccountAPI {
}
// listAccounts will return a list of addresses for accounts this node manages.
-func (s *PrivateAccountAPI) ListAccounts() []common.Address {
+func (s *PersonalAccountAPI) ListAccounts() []common.Address {
return s.am.Accounts()
}
@@ -304,7 +304,7 @@ type rawWallet struct {
}
// ListWallets will return a list of wallets this node manages.
-func (s *PrivateAccountAPI) ListWallets() []rawWallet {
+func (s *PersonalAccountAPI) ListWallets() []rawWallet {
wallets := make([]rawWallet, 0) // return [] instead of nil if empty
for _, wallet := range s.am.Wallets() {
status, failure := wallet.Status()
@@ -326,7 +326,7 @@ func (s *PrivateAccountAPI) ListWallets() []rawWallet {
// connection and attempting to authenticate via the provided passphrase. Note,
// the method may return an extra challenge requiring a second open (e.g. the
// Trezor PIN matrix challenge).
-func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error {
+func (s *PersonalAccountAPI) OpenWallet(url string, passphrase *string) error {
wallet, err := s.am.Wallet(url)
if err != nil {
return err
@@ -340,7 +340,7 @@ func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error {
// DeriveAccount requests a HD wallet to derive a new account, optionally pinning
// it for later reuse.
-//func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) {
+//func (s *PersonalAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) {
// wallet, err := s.am.Wallet(url)
// if err != nil {
// return accounts.Account{}, err
@@ -356,7 +356,7 @@ func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error {
//}
// NewAccount will create a new account and returns the address for the new account.
-func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) {
+func (s *PersonalAccountAPI) NewAccount(password string) (common.Address, error) {
ks, err := fetchKeystore(s.am)
if err != nil {
return common.Address{}, err
@@ -381,7 +381,7 @@ func fetchKeystore(am *accounts.Manager) (*keystore.KeyStore, error) {
// ImportRawKey stores the given hex encoded ECDSA key into the key directory,
// encrypting it with the passphrase.
-func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) {
+func (s *PersonalAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) {
key, err := crypto.HexToECDSA(privkey)
if err != nil {
return common.Address{}, err
@@ -397,7 +397,7 @@ func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (commo
// UnlockAccount will unlock the account associated with the given address with
// the given password for duration seconds. If duration is nil it will use a
// default of 300 seconds. It returns an indication if the account was unlocked.
-func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Address, password string, duration *uint64) (bool, error) {
+func (s *PersonalAccountAPI) UnlockAccount(ctx context.Context, addr common.Address, password string, duration *uint64) (bool, error) {
// When the API is exposed by external RPC(http, ws etc), unless the user
// explicitly specifies to allow the insecure account unlocking, otherwise
// it is disabled.
@@ -426,7 +426,7 @@ func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Addre
}
// LockAccount will lock the account associated with the given address when it's unlocked.
-func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool {
+func (s *PersonalAccountAPI) LockAccount(addr common.Address) bool {
if ks, err := fetchKeystore(s.am); err == nil {
return ks.Lock(addr) == nil
}
@@ -436,7 +436,7 @@ func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool {
// signTransaction sets defaults and signs the given transaction
// NOTE: the caller needs to ensure that the nonceLock is held, if applicable,
// and release it after the transaction has been submitted to the tx pool
-func (s *PrivateAccountAPI) signTransaction(ctx context.Context, args *TransactionArgs, passwd string) (*types.Transaction, error) {
+func (s *PersonalAccountAPI) signTransaction(ctx context.Context, args *TransactionArgs, passwd string) (*types.Transaction, error) {
// Look up the wallet containing the requested signer
account := accounts.Account{Address: args.from()}
wallet, err := s.am.Find(account)
@@ -455,7 +455,7 @@ func (s *PrivateAccountAPI) signTransaction(ctx context.Context, args *Transacti
// SendTransaction will create a transaction from the given arguments and
// tries to sign it with the key associated with args.From. If the given
// passwd isn't able to decrypt the key it fails.
-func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) {
+func (s *PersonalAccountAPI) SendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) {
if args.Nonce == nil {
// Hold the addresse's mutex around signing to prevent concurrent assignment of
// the same nonce to multiple accounts.
@@ -474,7 +474,7 @@ func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args Transactio
// tries to sign it with the key associated with args.From. If the given passwd isn't
// able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast
// to other nodes
-func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args TransactionArgs, passwd string) (*SignTransactionResult, error) {
+func (s *PersonalAccountAPI) SignTransaction(ctx context.Context, args TransactionArgs, passwd string) (*SignTransactionResult, error) {
// No need to obtain the noncelock mutex, since we won't be sending this
// tx into the transaction pool, but right back to the user
if args.From == nil {
@@ -528,7 +528,7 @@ func signHash(data []byte) []byte {
// The key used to calculate the signature is decrypted with the given password.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign
-func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) {
+func (s *PersonalAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) {
// Look up the wallet containing the requested signer
account := accounts.Account{Address: addr}
@@ -537,7 +537,7 @@ func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr c
return nil, err
}
// Assemble sign the data with the wallet
- signature, err := wallet.SignHashWithPassphrase(account, passwd, signHash(data))
+ signature, err := wallet.SignTextWithPassphrase(account, passwd, signHash(data))
if err != nil {
log.Warn("Failed data sign attempt", "address", addr, "err", err)
return nil, err
@@ -556,7 +556,7 @@ func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr c
// the V value must be 27 or 28 for legacy reasons.
//
// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover
-func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) {
+func (s *PersonalAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) {
if len(sig) != crypto.SignatureLength {
return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength)
}
@@ -572,30 +572,29 @@ func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Byt
return crypto.PubkeyToAddress(*rpk), nil
}
-// SignAndSendTransaction was renamed to SendTransaction. This method is deprecated
-// and will be removed in the future. It primary goal is to give clients time to update.
-func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args TransactionArgs, passwd string) (common.Hash, error) {
- return s.SendTransaction(ctx, args, passwd)
-}
-
-// PublicBlockChainAPI provides an API to access the Ethereum blockchain.
+// BlockChainAPI provides an API to access the Ethereum blockchain.
// It offers only methods that operate on public data that is freely available to anyone.
-type PublicBlockChainAPI struct {
+type BlockChainAPI struct {
b Backend
}
-// NewPublicBlockChainAPI creates a new Ethereum blockchain API.
-func NewPublicBlockChainAPI(b Backend) *PublicBlockChainAPI {
- return &PublicBlockChainAPI{b}
+// NewBlockChainAPI creates a new Ethereum blockchain API.
+func NewBlockChainAPI(b Backend) *BlockChainAPI {
+ return &BlockChainAPI{b}
}
// ChainId is the PIP-7 replay-protection chain id for the current chain config.
-func (s *PublicBlockChainAPI) ChainId() (*hexutil.Big, error) {
- return (*hexutil.Big)(s.b.ChainConfig().PIP7ChainID), nil
+//
+// Note, this method does not conform to EIP-695 because the configured chain ID is always
+// returned, regardless of the current head block. We used to return an error when the chain
+// wasn't synced up to a block where EIP-155 is enabled, but this behavior caused issues
+// in CL clients.
+func (s *BlockChainAPI) ChainId() *hexutil.Big {
+ return (*hexutil.Big)(s.b.ChainConfig().ChainID)
}
// BlockNumber returns the block number of the chain head.
-func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 {
+func (s *BlockChainAPI) BlockNumber() hexutil.Uint64 {
header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) // latest header should always be available
return hexutil.Uint64(header.Number.Uint64())
}
@@ -603,7 +602,7 @@ func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 {
// GetBalance returns the amount of von for the given address in the state of the
// given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta
// block numbers are also allowed.
-func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) {
+func (s *BlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) {
state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
if state == nil || err != nil {
return nil, err
@@ -612,7 +611,7 @@ func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Add
return (*hexutil.Big)(state.GetBalance(address)), state.Error()
}
-func (s *PublicBlockChainAPI) GetAddressHrp() string {
+func (s *BlockChainAPI) GetAddressHrp() string {
stored := rawdb.ReadCanonicalHash(s.b.ChainDb(), 0)
chainConfig := rawdb.ReadChainConfig(s.b.ChainDb(), stored)
if chainConfig == nil || chainConfig.AddressHRP == "" {
@@ -639,7 +638,7 @@ type StorageResult struct {
}
// GetProof returns the Merkle-proof for a given account and optionally some storage keys.
-func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) {
+func (s *BlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys []string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) {
state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
if state == nil || err != nil {
return nil, err
@@ -700,7 +699,7 @@ func toHexSlice(b [][]byte) []string {
// GetHeaderByNumber returns the requested canonical block header.
// * When blockNr is -1 the chain head is returned.
// * When blockNr is -2 the pending chain head is returned.
-func (s *PublicBlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error) {
+func (s *BlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (map[string]interface{}, error) {
header, err := s.b.HeaderByNumber(ctx, number)
if header != nil && err == nil {
response := s.rpcMarshalHeader(header)
@@ -716,7 +715,7 @@ func (s *PublicBlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.
}
// GetHeaderByHash returns the requested header by hash.
-func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{} {
+func (s *BlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) map[string]interface{} {
header, _ := s.b.HeaderByHash(ctx, hash)
if header != nil {
return s.rpcMarshalHeader(header)
@@ -729,7 +728,7 @@ func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.H
// - When blockNr is -2 the pending chain head is returned.
// - When fullTx is true all transactions in the block are returned, otherwise
// only the transaction hash is returned.
-func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) {
+func (s *BlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (map[string]interface{}, error) {
block, err := s.b.BlockByNumber(ctx, number)
if block != nil && err == nil {
response, err := s.rpcMarshalBlock(block, true, fullTx)
@@ -746,7 +745,7 @@ func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.B
// GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full
// detail, otherwise only the transaction hash is returned.
-func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error) {
+func (s *BlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (map[string]interface{}, error) {
block, err := s.b.BlockByHash(ctx, hash)
if block != nil {
return s.rpcMarshalBlock(block, true, fullTx)
@@ -755,7 +754,7 @@ func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Ha
}
// GetBlockQuorumCertByHash returns the requested block QuorumCert.
-func (s *PublicBlockChainAPI) GetBlockQuorumCertByHash(ctx context.Context, hashes []common.Hash) ([]map[string]interface{}, error) {
+func (s *BlockChainAPI) GetBlockQuorumCertByHash(ctx context.Context, hashes []common.Hash) ([]map[string]interface{}, error) {
m := make([]map[string]interface{}, 0, len(hashes))
for _, hash := range hashes {
block, err := s.b.BlockByHash(ctx, hash)
@@ -770,7 +769,7 @@ func (s *PublicBlockChainAPI) GetBlockQuorumCertByHash(ctx context.Context, hash
}
// GetCode returns the code stored at the given address in the state for the given block number.
-func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
+func (s *BlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
if state == nil || err != nil {
return nil, err
@@ -783,7 +782,7 @@ func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Addres
// GetStorageAt returns the storage from the state at the given address, key and
// block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block
// numbers are also allowed.
-func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
+func (s *BlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) {
state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash)
if state == nil || err != nil {
return nil, err
@@ -942,7 +941,7 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash
//
// Note, this function doesn't make and changes in the state/blockchain and is
// useful to execute and retrieve values.
-func (s *PublicBlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
+func (s *BlockChainAPI) Call(ctx context.Context, args TransactionArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *StateOverride) (hexutil.Bytes, error) {
result, err := DoCall(ctx, s.b, args, blockNrOrHash, overrides, s.b.RPCEVMTimeout(), s.b.RPCGasCap())
if err != nil {
return nil, err
@@ -1081,7 +1080,7 @@ func DoEstimateGas(ctx context.Context, b Backend, args TransactionArgs, blockNr
// EstimateGas returns an estimate of the amount of gas needed to execute the
// given transaction against the current pending block.
-func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
+func (s *BlockChainAPI) EstimateGas(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) {
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
if blockNrOrHash != nil {
bNrOrHash = *blockNrOrHash
@@ -1190,7 +1189,7 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param
// rpcMarshalHeader uses the generalized output filler, then adds the total difficulty field, which requires
// a `PublicBlockchainAPI`.
-func (s *PublicBlockChainAPI) rpcMarshalHeader(header *types.Header) map[string]interface{} {
+func (s *BlockChainAPI) rpcMarshalHeader(header *types.Header) map[string]interface{} {
ethCompatible := types.HttpEthCompatible
fields := RPCMarshalHeader(header, ethCompatible)
if ethCompatible {
@@ -1201,7 +1200,7 @@ func (s *PublicBlockChainAPI) rpcMarshalHeader(header *types.Header) map[string]
// rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires
// a `PublicBlockchainAPI`.
-func (s *PublicBlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
+func (s *BlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) {
fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig())
if err != nil {
return nil, err
@@ -1214,7 +1213,7 @@ func (s *PublicBlockChainAPI) rpcMarshalBlock(b *types.Block, inclTx bool, fullT
// rpcMarshalBlockQuorumCert uses the generalized output filler, then adds the QuorumCert field, which requires
// a `PublicBlockchainAPI`.
-func (s *PublicBlockChainAPI) rpcMarshalBlockQuorumCert(b *types.Block) (map[string]interface{}, error) {
+func (s *BlockChainAPI) rpcMarshalBlockQuorumCert(b *types.Block) (map[string]interface{}, error) {
_, qc, err := ctypes.DecodeExtra(b.ExtraData())
if err != nil {
return nil, err
@@ -1283,6 +1282,11 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber
result.TransactionIndex = (*hexutil.Uint64)(&index)
}
switch tx.Type() {
+ case types.LegacyTxType:
+ // if a legacy transaction has an EIP-155 chain id, include it explicitly
+ if id := tx.ChainId(); id.Sign() == 0 {
+ result.ChainID = (*hexutil.Big)(id)
+ }
case types.AccessListTxType:
al := tx.AccessList()
result.Accesses = &al
@@ -1356,7 +1360,7 @@ type accessListResult struct {
// CreateAccessList creates a EIP-2930 type AccessList for the given transaction.
// Reexec and BlockNrOrHash can be specified to create the accessList on top of a certain state.
-func (s *PublicBlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
+func (s *BlockChainAPI) CreateAccessList(ctx context.Context, args TransactionArgs, blockNrOrHash *rpc.BlockNumberOrHash) (*accessListResult, error) {
bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber)
if blockNrOrHash != nil {
bNrOrHash = *blockNrOrHash
@@ -1444,19 +1448,19 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
}
}
-// PublicTransactionPoolAPI exposes methods for the RPC interface
-type PublicTransactionPoolAPI struct {
+// TransactionAPI exposes methods for reading and creating transaction data.
+type TransactionAPI struct {
b Backend
nonceLock *AddrLocker
}
-// NewPublicTransactionPoolAPI creates a new RPC service with methods specific for the transaction pool.
-func NewPublicTransactionPoolAPI(b Backend, nonceLock *AddrLocker) *PublicTransactionPoolAPI {
- return &PublicTransactionPoolAPI{b, nonceLock}
+// NewTransactionAPI creates a new RPC service with methods specific for the transaction pool.
+func NewTransactionAPI(b Backend, nonceLock *AddrLocker) *TransactionAPI {
+ return &TransactionAPI{b, nonceLock}
}
// GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number.
-func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
+func (s *TransactionAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint {
if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
n := hexutil.Uint(len(block.Transactions()))
return &n
@@ -1465,7 +1469,7 @@ func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.
}
// GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash.
-func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
+func (s *TransactionAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint {
if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
n := hexutil.Uint(len(block.Transactions()))
return &n
@@ -1474,7 +1478,7 @@ func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Co
}
// GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index.
-func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction {
+func (s *TransactionAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction {
if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig())
}
@@ -1482,7 +1486,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx conte
}
// GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index.
-func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction {
+func (s *TransactionAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction {
if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig())
}
@@ -1490,7 +1494,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context
}
// GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index.
-func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes {
+func (s *TransactionAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes {
if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil {
return newRPCRawTransactionFromBlockIndex(block, uint64(index))
}
@@ -1498,7 +1502,7 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx co
}
// GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index.
-func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes {
+func (s *TransactionAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes {
if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil {
return newRPCRawTransactionFromBlockIndex(block, uint64(index))
}
@@ -1506,7 +1510,7 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx cont
}
// GetTransactionCount returns the number of transactions the given address has sent for the given block number
-func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error) {
+func (s *TransactionAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error) {
// Ask transaction pool for the nonce which includes pending transactions
if blockNr, ok := blockNrOrHash.Number(); ok && blockNr == rpc.PendingBlockNumber {
nonce, err := s.b.GetPoolNonce(ctx, address)
@@ -1526,7 +1530,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, addr
}
// GetTransactionCount returns the number of transactions the given address has sent for the given block number
-func (s *PublicTransactionPoolAPI) GetPoolNonce(ctx context.Context, address common.Address) (*hexutil.Uint64, error) {
+func (s *TransactionAPI) GetPoolNonce(ctx context.Context, address common.Address) (*hexutil.Uint64, error) {
nonce, err := s.b.GetPoolNonce(ctx, address)
@@ -1534,7 +1538,7 @@ func (s *PublicTransactionPoolAPI) GetPoolNonce(ctx context.Context, address com
}
// GetTransactionByHash returns the transaction for the given hash
-func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error) {
+func (s *TransactionAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error) {
// Try to return an already finalized transaction
tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash)
if err != nil {
@@ -1557,7 +1561,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, has
}
// GetRawTransactionByHash returns the bytes of the transaction for the given hash.
-func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
+func (s *TransactionAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) {
// Retrieve a finalized transaction, or a pooled otherwise
tx, _, _, _, err := s.b.GetTransaction(ctx, hash)
if err != nil {
@@ -1574,9 +1578,11 @@ func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context,
}
// GetTransactionReceipt returns the transaction receipt for the given transaction hash.
-func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) {
+func (s *TransactionAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map[string]interface{}, error) {
tx, blockHash, blockNumber, index := rawdb.ReadTransaction(s.b.ChainDb(), hash)
if tx == nil {
+ // When the transaction doesn't exist, the RPC method should return JSON null
+ // as per specification.
return nil, nil
}
receipts, err := s.b.GetReceipts(ctx, blockHash)
@@ -1630,7 +1636,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
}
// sign is a helper function that signs a transaction with the private key of the given address.
-func (s *PublicTransactionPoolAPI) sign(addr common.Address, tx *types.Transaction) (*types.Transaction, error) {
+func (s *TransactionAPI) sign(addr common.Address, tx *types.Transaction) (*types.Transaction, error) {
// Look up the wallet containing the requested signer
account := accounts.Account{Address: addr}
@@ -1674,7 +1680,7 @@ func SubmitTransaction(ctx context.Context, b Backend, tx *types.Transaction) (c
// SendTransaction creates a transaction for the given argument, sign it and submit it to the
// transaction pool.
-func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error) {
+func (s *TransactionAPI) SendTransaction(ctx context.Context, args TransactionArgs) (common.Hash, error) {
// Look up the wallet containing the requested signer
account := accounts.Account{Address: args.from()}
@@ -1707,7 +1713,7 @@ func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args Tra
// FillTransaction fills the defaults (nonce, gas, gasPrice or 1559 fields)
// on a given unsigned transaction, and returns it to the caller for further
// processing (signing + broadcast).
-func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error) {
+func (s *TransactionAPI) FillTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error) {
// Set some sanity defaults and terminate on failure
if err := args.setDefaults(ctx, s.b); err != nil {
return nil, err
@@ -1723,7 +1729,7 @@ func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args Tra
// SendRawTransaction will add the signed transaction to the transaction pool.
// The sender is responsible for signing the transaction and using the correct nonce.
-func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error) {
+func (s *TransactionAPI) SendRawTransaction(ctx context.Context, input hexutil.Bytes) (common.Hash, error) {
tx := new(types.Transaction)
if err := tx.UnmarshalBinary(input); err != nil {
return common.Hash{}, err
@@ -1740,7 +1746,7 @@ func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, input
// The account associated with addr must be unlocked.
//
// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign
-func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
+func (s *TransactionAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error) {
// Look up the wallet containing the requested signer
account := accounts.Account{Address: addr}
@@ -1749,7 +1755,7 @@ func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes)
return nil, err
}
// Sign the requested hash with the wallet
- signature, err := wallet.SignHash(account, signHash(data))
+ signature, err := wallet.SignText(account, signHash(data))
if err == nil {
signature[64] += 27 // Transform V from 0/1 to 27/28 according to the yellow paper
}
@@ -1765,7 +1771,7 @@ type SignTransactionResult struct {
// SignTransaction will sign the given transaction with the from account.
// The node needs to have the private key of the account corresponding with
// the given from address and it needs to be unlocked.
-func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error) {
+func (s *TransactionAPI) SignTransaction(ctx context.Context, args TransactionArgs) (*SignTransactionResult, error) {
if args.Gas == nil {
return nil, fmt.Errorf("gas not specified")
}
@@ -1796,7 +1802,7 @@ func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args Tra
// PendingTransactions returns the transactions that are in the transaction pool
// and have a from address that is one of the accounts this node manages.
-func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, error) {
+func (s *TransactionAPI) PendingTransactions() ([]*RPCTransaction, error) {
pending, err := s.b.GetPoolTransactions()
if err != nil {
return nil, err
@@ -1818,7 +1824,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactions() ([]*RPCTransaction, err
return transactions, nil
}
-func (s *PublicTransactionPoolAPI) PendingTransactionsLength() int {
+func (s *TransactionAPI) PendingTransactionsLength() int {
pending, err := s.b.GetPoolTransactions()
if err != nil {
return -1
@@ -1828,7 +1834,7 @@ func (s *PublicTransactionPoolAPI) PendingTransactionsLength() int {
// Resend accepts an existing transaction and a new gas price and limit. It will remove
// the given transaction from the pool and reinsert it with the new gas price and limit.
-func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) {
+func (s *TransactionAPI) Resend(ctx context.Context, sendArgs TransactionArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) {
if sendArgs.Nonce == nil {
return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec")
}
@@ -1879,20 +1885,20 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs Transact
return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash())
}
-// PublicDebugAPI is the collection of Ethereum APIs exposed over the public
-// debugging endpoint.
-type PublicDebugAPI struct {
+// DebugAPI is the collection of Ethereum APIs exposed over the debugging
+// namespace.
+type DebugAPI struct {
b Backend
}
-// NewPublicDebugAPI creates a new API definition for the public debug methods
+// NewDebugAPI creates a new API definition for the public debug methods
// of the Ethereum service.
-func NewPublicDebugAPI(b Backend) *PublicDebugAPI {
- return &PublicDebugAPI{b: b}
+func NewDebugAPI(b Backend) *DebugAPI {
+ return &DebugAPI{b: b}
}
// GetHeaderRlp retrieves the RLP encoded for of a single header.
-func (api *PublicDebugAPI) GetHeaderRlp(ctx context.Context, number uint64) (hexutil.Bytes, error) {
+func (api *DebugAPI) GetHeaderRlp(ctx context.Context, number uint64) (hexutil.Bytes, error) {
header, _ := api.b.HeaderByNumber(ctx, rpc.BlockNumber(number))
if header == nil {
return nil, fmt.Errorf("header #%d not found", number)
@@ -1901,7 +1907,7 @@ func (api *PublicDebugAPI) GetHeaderRlp(ctx context.Context, number uint64) (hex
}
// GetBlockRlp retrieves the RLP encoded for of a single block.
-func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexutil.Bytes, error) {
+func (api *DebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexutil.Bytes, error) {
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
if block == nil {
return nil, fmt.Errorf("block #%d not found", number)
@@ -1910,7 +1916,7 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (hexu
}
// GetRawReceipts retrieves the binary-encoded raw receipts of a single block.
-func (api *PublicDebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error) {
+func (api *DebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc.BlockNumberOrHash) ([]hexutil.Bytes, error) {
var hash common.Hash
if h, ok := blockNrOrHash.Hash(); ok {
hash = h
@@ -1937,7 +1943,7 @@ func (api *PublicDebugAPI) GetRawReceipts(ctx context.Context, blockNrOrHash rpc
}
// PrintBlock retrieves a block and returns its pretty printed form.
-func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
+func (api *DebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) {
block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number))
if block == nil {
return "", fmt.Errorf("block #%d not found", number)
@@ -1945,20 +1951,8 @@ func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (strin
return spew.Sdump(block), nil
}
-// PrivateDebugAPI is the collection of Ethereum APIs exposed over the private
-// debugging endpoint.
-type PrivateDebugAPI struct {
- b Backend
-}
-
-// NewPrivateDebugAPI creates a new API definition for the private debug methods
-// of the Ethereum service.
-func NewPrivateDebugAPI(b Backend) *PrivateDebugAPI {
- return &PrivateDebugAPI{b: b}
-}
-
// ChaindbProperty returns leveldb properties of the key-value database.
-func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error) {
+func (api *DebugAPI) ChaindbProperty(property string) (string, error) {
if property == "" {
property = "leveldb.stats"
} else if !strings.HasPrefix(property, "leveldb.") {
@@ -1969,7 +1963,7 @@ func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error) {
// ChaindbCompact flattens the entire key-value database into a single level,
// removing all unused slots and merging all keys.
-func (api *PrivateDebugAPI) ChaindbCompact() error {
+func (api *DebugAPI) ChaindbCompact() error {
for b := byte(0); b < 255; b++ {
log.Info("Compacting chain database", "range", fmt.Sprintf("0x%0.2X-0x%0.2X", b, b+1))
if err := api.b.ChainDb().Compact([]byte{b}, []byte{b + 1}); err != nil {
@@ -1981,33 +1975,33 @@ func (api *PrivateDebugAPI) ChaindbCompact() error {
}
// SetHead rewinds the head of the blockchain to a previous block.
-//func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64) {
+//func (api *DebugAPI) SetHead(number hexutil.Uint64) {
// api.b.SetHead(uint64(number))
//}
-// PublicNetAPI offers network related RPC methods
-type PublicNetAPI struct {
+// NetAPI offers network related RPC methods
+type NetAPI struct {
net *p2p.Server
networkVersion uint64
}
-// NewPublicNetAPI creates a new net API instance.
-func NewPublicNetAPI(net *p2p.Server, networkVersion uint64) *PublicNetAPI {
- return &PublicNetAPI{net, networkVersion}
+// NewNetAPI creates a new net API instance.
+func NewNetAPI(net *p2p.Server, networkVersion uint64) *NetAPI {
+ return &NetAPI{net, networkVersion}
}
// Listening returns an indication if the node is listening for network connections.
-func (s *PublicNetAPI) Listening() bool {
+func (s *NetAPI) Listening() bool {
return true // always listening
}
// PeerCount returns the number of connected peers
-func (s *PublicNetAPI) PeerCount() hexutil.Uint {
+func (s *NetAPI) PeerCount() hexutil.Uint {
return hexutil.Uint(s.net.PeerCount())
}
// Version returns the current ethereum protocol version.
-func (s *PublicNetAPI) Version() string {
+func (s *NetAPI) Version() string {
return fmt.Sprintf("%d", s.networkVersion)
}
diff --git a/internal/ethapi/backend.go b/internal/ethapi/backend.go
index 3630106458..8283efe8db 100644
--- a/internal/ethapi/backend.go
+++ b/internal/ethapi/backend.go
@@ -102,42 +102,31 @@ func GetAPIs(apiBackend Backend) []rpc.API {
{
Namespace: "platon",
Version: "1.0",
- Service: NewPublicEthereumAPI(apiBackend),
- Public: true,
+ Service: NewEthereumAPI(apiBackend),
}, {
Namespace: "platon",
Version: "1.0",
- Service: NewPublicBlockChainAPI(apiBackend),
- Public: true,
+ Service: NewBlockChainAPI(apiBackend),
}, {
Namespace: "platon",
Version: "1.0",
- Service: NewPublicTransactionPoolAPI(apiBackend, nonceLock),
- Public: true,
+ Service: NewTransactionAPI(apiBackend, nonceLock),
}, {
Namespace: "txpool",
Version: "1.0",
- Service: NewPublicTxPoolAPI(apiBackend),
- Public: true,
+ Service: NewTxPoolAPI(apiBackend),
}, {
Namespace: "debug",
Version: "1.0",
- Service: NewPublicDebugAPI(apiBackend),
- Public: true,
- }, {
- Namespace: "debug",
- Version: "1.0",
- Service: NewPrivateDebugAPI(apiBackend),
+ Service: NewDebugAPI(apiBackend),
}, {
Namespace: "platon",
Version: "1.0",
- Service: NewPublicAccountAPI(apiBackend.AccountManager()),
- Public: true,
+ Service: NewEthereumAccountAPI(apiBackend.AccountManager()),
}, {
Namespace: "personal",
Version: "1.0",
- Service: NewPrivateAccountAPI(apiBackend, nonceLock),
- Public: false,
+ Service: NewPersonalAccountAPI(apiBackend, nonceLock),
},
}
}
diff --git a/internal/ethapi/dbapi.go b/internal/ethapi/dbapi.go
index 9438ae2843..7c238bc154 100644
--- a/internal/ethapi/dbapi.go
+++ b/internal/ethapi/dbapi.go
@@ -22,7 +22,7 @@ import (
)
// DbGet returns the raw value of a key stored in the database.
-func (api *PrivateDebugAPI) DbGet(key string) (hexutil.Bytes, error) {
+func (api *DebugAPI) DbGet(key string) (hexutil.Bytes, error) {
blob, err := common.ParseHexOrString(key)
if err != nil {
return nil, err
@@ -32,12 +32,12 @@ func (api *PrivateDebugAPI) DbGet(key string) (hexutil.Bytes, error) {
// DbAncient retrieves an ancient binary blob from the append-only immutable files.
// It is a mapping to the `AncientReaderOp.Ancient` method
-func (api *PrivateDebugAPI) DbAncient(kind string, number uint64) (hexutil.Bytes, error) {
+func (api *DebugAPI) DbAncient(kind string, number uint64) (hexutil.Bytes, error) {
return api.b.ChainDb().Ancient(kind, number)
}
// DbAncients returns the ancient item numbers in the ancient store.
// It is a mapping to the `AncientReaderOp.Ancients` method
-func (api *PrivateDebugAPI) DbAncients() (uint64, error) {
+func (api *DebugAPI) DbAncients() (uint64, error) {
return api.b.ChainDb().Ancients()
}
diff --git a/internal/flags/categories.go b/internal/flags/categories.go
new file mode 100644
index 0000000000..455fee3815
--- /dev/null
+++ b/internal/flags/categories.go
@@ -0,0 +1,46 @@
+// Copyright 2022 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 .
+
+package flags
+
+import "github.com/urfave/cli/v2"
+
+const (
+ EthCategory = "PlatON"
+ LightCategory = "LIGHT CLIENT"
+ DevCategory = "DEVELOPER CHAIN"
+ StateCategory = "STATE HISTORY MANAGEMENT"
+ TxPoolCategory = "TRANSACTION POOL (EVM)"
+ BlobPoolCategory = "TRANSACTION POOL (BLOB)"
+ PerfCategory = "PERFORMANCE TUNING"
+ AccountCategory = "ACCOUNT"
+ APICategory = "API AND CONSOLE"
+ NetworkingCategory = "NETWORKING"
+ MinerCategory = "MINER"
+ GasPriceCategory = "GAS PRICE ORACLE"
+ VMCategory = "VIRTUAL MACHINE"
+ LoggingCategory = "LOGGING AND DEBUGGING"
+ MetricsCategory = "METRICS AND STATS"
+ MiscCategory = "MISC"
+ CbftCategory = "GISKARD"
+ DbCategory = "DB"
+ DeprecatedCategory = "ALIASED (deprecated)"
+)
+
+func init() {
+ cli.HelpFlag.(*cli.BoolFlag).Category = MiscCategory
+ cli.VersionFlag.(*cli.BoolFlag).Category = MiscCategory
+}
diff --git a/internal/flags/flags.go b/internal/flags/flags.go
new file mode 100644
index 0000000000..c38dc8850e
--- /dev/null
+++ b/internal/flags/flags.go
@@ -0,0 +1,344 @@
+// Copyright 2015 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 .
+
+package flags
+
+import (
+ "encoding"
+ "errors"
+ "flag"
+ "math/big"
+ "os"
+ "os/user"
+ "path/filepath"
+ "strings"
+
+ "github.com/PlatONnetwork/PlatON-Go/common/math"
+ "github.com/urfave/cli/v2"
+)
+
+// DirectoryString is custom type which is registered in the flags library which cli uses for
+// argument parsing. This allows us to expand Value to an absolute path when
+// the argument is parsed
+type DirectoryString string
+
+func (s *DirectoryString) String() string {
+ return string(*s)
+}
+
+func (s *DirectoryString) Set(value string) error {
+ *s = DirectoryString(expandPath(value))
+ return nil
+}
+
+var (
+ _ cli.Flag = (*DirectoryFlag)(nil)
+ _ cli.RequiredFlag = (*DirectoryFlag)(nil)
+ _ cli.VisibleFlag = (*DirectoryFlag)(nil)
+ _ cli.DocGenerationFlag = (*DirectoryFlag)(nil)
+ _ cli.CategorizableFlag = (*DirectoryFlag)(nil)
+)
+
+// DirectoryFlag is custom cli.Flag type which expand the received string to an absolute path.
+// e.g. ~/.ethereum -> /home/username/.ethereum
+type DirectoryFlag struct {
+ Name string
+
+ Category string
+ DefaultText string
+ Usage string
+
+ Required bool
+ Hidden bool
+ HasBeenSet bool
+
+ Value DirectoryString
+
+ Aliases []string
+}
+
+// For cli.Flag:
+
+func (f *DirectoryFlag) Names() []string { return append([]string{f.Name}, f.Aliases...) }
+func (f *DirectoryFlag) IsSet() bool { return f.HasBeenSet }
+func (f *DirectoryFlag) String() string { return cli.FlagStringer(f) }
+
+// Apply called by cli library, grabs variable from environment (if in env)
+// and adds variable to flag set for parsing.
+func (f *DirectoryFlag) Apply(set *flag.FlagSet) error {
+ eachName(f, func(name string) {
+ set.Var(&f.Value, f.Name, f.Usage)
+ })
+ return nil
+}
+
+// For cli.RequiredFlag:
+
+func (f *DirectoryFlag) IsRequired() bool { return f.Required }
+
+// For cli.VisibleFlag:
+
+func (f *DirectoryFlag) IsVisible() bool { return !f.Hidden }
+
+// For cli.CategorizableFlag:
+
+func (f *DirectoryFlag) GetCategory() string { return f.Category }
+
+// For cli.DocGenerationFlag:
+
+func (f *DirectoryFlag) TakesValue() bool { return true }
+func (f *DirectoryFlag) GetUsage() string { return f.Usage }
+func (f *DirectoryFlag) GetValue() string { return f.Value.String() }
+func (f *DirectoryFlag) GetEnvVars() []string { return nil } // env not supported
+
+func (f *DirectoryFlag) GetDefaultText() string {
+ if f.DefaultText != "" {
+ return f.DefaultText
+ }
+ return f.GetValue()
+}
+
+type TextMarshaler interface {
+ encoding.TextMarshaler
+ encoding.TextUnmarshaler
+}
+
+// textMarshalerVal turns a TextMarshaler into a flag.Value
+type textMarshalerVal struct {
+ v TextMarshaler
+}
+
+func (v textMarshalerVal) String() string {
+ if v.v == nil {
+ return ""
+ }
+ text, _ := v.v.MarshalText()
+ return string(text)
+}
+
+func (v textMarshalerVal) Set(s string) error {
+ return v.v.UnmarshalText([]byte(s))
+}
+
+var (
+ _ cli.Flag = (*TextMarshalerFlag)(nil)
+ _ cli.RequiredFlag = (*TextMarshalerFlag)(nil)
+ _ cli.VisibleFlag = (*TextMarshalerFlag)(nil)
+ _ cli.DocGenerationFlag = (*TextMarshalerFlag)(nil)
+ _ cli.CategorizableFlag = (*TextMarshalerFlag)(nil)
+)
+
+// TextMarshalerFlag wraps a TextMarshaler value.
+type TextMarshalerFlag struct {
+ Name string
+
+ Category string
+ DefaultText string
+ Usage string
+
+ Required bool
+ Hidden bool
+ HasBeenSet bool
+
+ Value TextMarshaler
+
+ Aliases []string
+}
+
+// For cli.Flag:
+
+func (f *TextMarshalerFlag) Names() []string { return append([]string{f.Name}, f.Aliases...) }
+func (f *TextMarshalerFlag) IsSet() bool { return f.HasBeenSet }
+func (f *TextMarshalerFlag) String() string { return cli.FlagStringer(f) }
+
+func (f *TextMarshalerFlag) Apply(set *flag.FlagSet) error {
+ eachName(f, func(name string) {
+ set.Var(textMarshalerVal{f.Value}, f.Name, f.Usage)
+ })
+ return nil
+}
+
+// For cli.RequiredFlag:
+
+func (f *TextMarshalerFlag) IsRequired() bool { return f.Required }
+
+// For cli.VisibleFlag:
+
+func (f *TextMarshalerFlag) IsVisible() bool { return !f.Hidden }
+
+// For cli.CategorizableFlag:
+
+func (f *TextMarshalerFlag) GetCategory() string { return f.Category }
+
+// For cli.DocGenerationFlag:
+
+func (f *TextMarshalerFlag) TakesValue() bool { return true }
+func (f *TextMarshalerFlag) GetUsage() string { return f.Usage }
+func (f *TextMarshalerFlag) GetEnvVars() []string { return nil } // env not supported
+
+func (f *TextMarshalerFlag) GetValue() string {
+ t, err := f.Value.MarshalText()
+ if err != nil {
+ return "(ERR: " + err.Error() + ")"
+ }
+ return string(t)
+}
+
+func (f *TextMarshalerFlag) GetDefaultText() string {
+ if f.DefaultText != "" {
+ return f.DefaultText
+ }
+ return f.GetValue()
+}
+
+// GlobalTextMarshaler returns the value of a TextMarshalerFlag from the global flag set.
+func GlobalTextMarshaler(ctx *cli.Context, name string) TextMarshaler {
+ val := ctx.Generic(name)
+ if val == nil {
+ return nil
+ }
+ return val.(textMarshalerVal).v
+}
+
+var (
+ _ cli.Flag = (*BigFlag)(nil)
+ _ cli.RequiredFlag = (*BigFlag)(nil)
+ _ cli.VisibleFlag = (*BigFlag)(nil)
+ _ cli.DocGenerationFlag = (*BigFlag)(nil)
+ _ cli.CategorizableFlag = (*BigFlag)(nil)
+)
+
+// BigFlag is a command line flag that accepts 256 bit big integers in decimal or
+// hexadecimal syntax.
+type BigFlag struct {
+ Name string
+
+ Category string
+ DefaultText string
+ Usage string
+
+ Required bool
+ Hidden bool
+ HasBeenSet bool
+
+ Value *big.Int
+
+ Aliases []string
+}
+
+// For cli.Flag:
+
+func (f *BigFlag) Names() []string { return append([]string{f.Name}, f.Aliases...) }
+func (f *BigFlag) IsSet() bool { return f.HasBeenSet }
+func (f *BigFlag) String() string { return cli.FlagStringer(f) }
+
+func (f *BigFlag) Apply(set *flag.FlagSet) error {
+ eachName(f, func(name string) {
+ f.Value = new(big.Int)
+ set.Var((*bigValue)(f.Value), f.Name, f.Usage)
+ })
+
+ return nil
+}
+
+// For cli.RequiredFlag:
+
+func (f *BigFlag) IsRequired() bool { return f.Required }
+
+// For cli.VisibleFlag:
+
+func (f *BigFlag) IsVisible() bool { return !f.Hidden }
+
+// For cli.CategorizableFlag:
+
+func (f *BigFlag) GetCategory() string { return f.Category }
+
+// For cli.DocGenerationFlag:
+
+func (f *BigFlag) TakesValue() bool { return true }
+func (f *BigFlag) GetUsage() string { return f.Usage }
+func (f *BigFlag) GetValue() string { return f.Value.String() }
+func (f *BigFlag) GetEnvVars() []string { return nil } // env not supported
+
+func (f *BigFlag) GetDefaultText() string {
+ if f.DefaultText != "" {
+ return f.DefaultText
+ }
+ return f.GetValue()
+}
+
+// bigValue turns *big.Int into a flag.Value
+type bigValue big.Int
+
+func (b *bigValue) String() string {
+ if b == nil {
+ return ""
+ }
+ return (*big.Int)(b).String()
+}
+
+func (b *bigValue) Set(s string) error {
+ intVal, ok := math.ParseBig256(s)
+ if !ok {
+ return errors.New("invalid integer syntax")
+ }
+ *b = (bigValue)(*intVal)
+ return nil
+}
+
+// GlobalBig returns the value of a BigFlag from the global flag set.
+func GlobalBig(ctx *cli.Context, name string) *big.Int {
+ val := ctx.Generic(name)
+ if val == nil {
+ return nil
+ }
+ return (*big.Int)(val.(*bigValue))
+}
+
+// Expands a file path
+// 1. replace tilde with users home dir
+// 2. expands embedded environment variables
+// 3. cleans the path, e.g. /a/b/../c -> /a/c
+// Note, it has limitations, e.g. ~someuser/tmp will not be expanded
+func expandPath(p string) string {
+ // Named pipes are not file paths on windows, ignore
+ if strings.HasPrefix(p, `\\.\pipe`) {
+ return p
+ }
+ if strings.HasPrefix(p, "~/") || strings.HasPrefix(p, "~\\") {
+ if home := HomeDir(); home != "" {
+ p = home + p[1:]
+ }
+ }
+ return filepath.Clean(os.ExpandEnv(p))
+}
+
+func HomeDir() string {
+ if home := os.Getenv("HOME"); home != "" {
+ return home
+ }
+ if usr, err := user.Current(); err == nil {
+ return usr.HomeDir
+ }
+ return ""
+}
+
+func eachName(f cli.Flag, fn func(string)) {
+ for _, name := range f.Names() {
+ name = strings.Trim(name, " ")
+ fn(name)
+ }
+}
diff --git a/internal/flags/flags_test.go b/internal/flags/flags_test.go
new file mode 100644
index 0000000000..681586b46c
--- /dev/null
+++ b/internal/flags/flags_test.go
@@ -0,0 +1,61 @@
+// Copyright 2015 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 .
+
+package flags
+
+import (
+ "os"
+ "os/user"
+ "runtime"
+ "testing"
+)
+
+func TestPathExpansion(t *testing.T) {
+ user, _ := user.Current()
+ var tests map[string]string
+
+ if runtime.GOOS == "windows" {
+ tests = map[string]string{
+ `/home/someuser/tmp`: `\home\someuser\tmp`,
+ `~/tmp`: user.HomeDir + `\tmp`,
+ `~thisOtherUser/b/`: `~thisOtherUser\b`,
+ `$DDDXXX/a/b`: `\tmp\a\b`,
+ `/a/b/`: `\a\b`,
+ `C:\Documents\Newsletters\`: `C:\Documents\Newsletters`,
+ `C:\`: `C:\`,
+ `\\.\pipe\\pipe\geth621383`: `\\.\pipe\\pipe\geth621383`,
+ }
+ } else {
+ tests = map[string]string{
+ `/home/someuser/tmp`: `/home/someuser/tmp`,
+ `~/tmp`: user.HomeDir + `/tmp`,
+ `~thisOtherUser/b/`: `~thisOtherUser/b`,
+ `$DDDXXX/a/b`: `/tmp/a/b`,
+ `/a/b/`: `/a/b`,
+ `C:\Documents\Newsletters\`: `C:\Documents\Newsletters\`,
+ `C:\`: `C:\`,
+ `\\.\pipe\\pipe\geth621383`: `\\.\pipe\\pipe\geth621383`,
+ }
+ }
+
+ os.Setenv(`DDDXXX`, `/tmp`)
+ for test, expected := range tests {
+ got := expandPath(test)
+ if got != expected {
+ t.Errorf(`test %s, got %s, expected %s\n`, test, got, expected)
+ }
+ }
+}
diff --git a/internal/flags/helpers.go b/internal/flags/helpers.go
index ee219bb158..05470fd1a5 100644
--- a/internal/flags/helpers.go
+++ b/internal/flags/helpers.go
@@ -1,153 +1,176 @@
// Copyright 2020 The go-ethereum Authors
-// This file is part of go-ethereum.
+// This file is part of the go-ethereum library.
//
-// go-ethereum is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
+// 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.
//
-// go-ethereum is distributed in the hope that it will be useful,
+// 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 General Public License for more details.
+// GNU Lesser General Public License for more details.
//
-// You should have received a copy of the GNU General Public License
-// along with go-ethereum. If not, see .
+// You should have received a copy of the GNU Lesser General Public License
+// along with the go-ethereum library. If not, see .
package flags
import (
- "os"
- "path/filepath"
-
- cli "gopkg.in/urfave/cli.v1"
+ "fmt"
+ "strings"
"github.com/PlatONnetwork/PlatON-Go/params"
+ "github.com/urfave/cli/v2"
)
-var (
- CommandHelpTemplate = `{{.cmd.Name}}{{if .cmd.Subcommands}} command{{end}}{{if .cmd.Flags}} [command options]{{end}} {{.cmd.ArgsUsage}}
-{{if .cmd.Description}}{{.cmd.Description}}
-{{end}}{{if .cmd.Subcommands}}
-SUBCOMMANDS:
- {{range .cmd.Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
- {{end}}{{end}}{{if .categorizedFlags}}
-{{range $idx, $categorized := .categorizedFlags}}{{$categorized.Name}} OPTIONS:
-{{range $categorized.Flags}}{{"\t"}}{{.}}
-{{end}}
-{{end}}{{end}}`
-
- OriginCommandHelpTemplate = `{{.Name}}{{if .Subcommands}} command{{end}}{{if .Flags}} [command options]{{end}} {{.ArgsUsage}}
-{{if .Description}}{{.Description}}
-{{end}}{{if .Subcommands}}
-SUBCOMMANDS:
- {{range .Subcommands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
- {{end}}{{end}}{{if .Flags}}
-OPTIONS:
-{{range $.Flags}} {{.}}
-{{end}}
-{{end}}`
-
- // AppHelpTemplate is the test template for the default, global app help topic.
- AppHelpTemplate = `NAME:
- {{.App.Name}} - {{.App.Usage}}
-
- Copyright 2013-2021 The PlatON-Go Authors
-
-USAGE:
- {{.App.HelpName}} [options]{{if .App.Commands}} [command] [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}}
- {{if .App.Version}}
-VERSION:
- {{.App.Version}}
- {{end}}{{if len .App.Authors}}
-AUTHOR(S):
- {{range .App.Authors}}{{ . }}{{end}}
- {{end}}{{if .App.Commands}}
-COMMANDS:
- {{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
- {{end}}{{end}}{{if .FlagGroups}}
-{{range .FlagGroups}}{{.Name}} OPTIONS:
- {{range .Flags}}{{.}}
- {{end}}
-{{end}}{{end}}{{if .App.Copyright }}
-COPYRIGHT:
- {{.App.Copyright}}
- {{end}}
-`
- // ClefAppHelpTemplate is the template for the default, global app help topic.
- ClefAppHelpTemplate = `NAME:
- {{.App.Name}} - {{.App.Usage}}
-
- Copyright 2013-2021 The PlatON-Go Authors
-
-USAGE:
- {{.App.HelpName}} [options]{{if .App.Commands}} command [command options]{{end}} {{if .App.ArgsUsage}}{{.App.ArgsUsage}}{{else}}[arguments...]{{end}}
- {{if .App.Version}}
-COMMANDS:
- {{range .App.Commands}}{{join .Names ", "}}{{ "\t" }}{{.Usage}}
- {{end}}{{end}}{{if .FlagGroups}}
-{{range .FlagGroups}}{{.Name}} OPTIONS:
- {{range .Flags}}{{.}}
- {{end}}
-{{end}}{{end}}{{if .App.Copyright }}
-COPYRIGHT:
- {{.App.Copyright}}
- {{end}}
-`
-)
+// NewApp creates an app with sane defaults.
+func NewApp(gitCommit, gitDate, usage string) *cli.App {
+ app := cli.NewApp()
+ app.EnableBashCompletion = true
+ app.Version = params.VersionWithCommit(gitCommit, gitDate)
+ app.Usage = usage
+ app.Copyright = "Copyright 2013-2023 The PlatON-Go Authors"
+ app.Before = func(ctx *cli.Context) error {
+ MigrateGlobalFlags(ctx)
+ return nil
+ }
+ return app
+}
+
+var migrationApplied = map[*cli.Command]struct{}{}
+
+// MigrateGlobalFlags makes all global flag values available in the
+// context. This should be called as early as possible in app.Before.
+//
+// Example:
+//
+// geth account new --keystore /tmp/mykeystore --lightkdf
+//
+// is equivalent after calling this method with:
+//
+// geth --keystore /tmp/mykeystore --lightkdf account new
+//
+// i.e. in the subcommand Action function of 'account new', ctx.Bool("lightkdf)
+// will return true even if --lightkdf is set as a global option.
+//
+// This function may become unnecessary when https://github.com/urfave/cli/pull/1245 is merged.
+func MigrateGlobalFlags(ctx *cli.Context) {
+ var iterate func(cs []*cli.Command, fn func(*cli.Command))
+ iterate = func(cs []*cli.Command, fn func(*cli.Command)) {
+ for _, cmd := range cs {
+ if _, ok := migrationApplied[cmd]; ok {
+ continue
+ }
+ migrationApplied[cmd] = struct{}{}
+ fn(cmd)
+ iterate(cmd.Subcommands, fn)
+ }
+ }
-// HelpData is a one shot struct to pass to the usage template
-type HelpData struct {
- App interface{}
- FlagGroups []FlagGroup
+ // This iterates over all commands and wraps their action function.
+ iterate(ctx.App.Commands, func(cmd *cli.Command) {
+ action := cmd.Action
+ cmd.Action = func(ctx *cli.Context) error {
+ doMigrateFlags(ctx)
+ return action(ctx)
+ }
+ })
}
-// FlagGroup is a collection of flags belonging to a single topic.
-type FlagGroup struct {
- Name string
- Flags []cli.Flag
+func doMigrateFlags(ctx *cli.Context) {
+ for _, name := range ctx.FlagNames() {
+ for _, parent := range ctx.Lineage()[1:] {
+ if parent.IsSet(name) {
+ ctx.Set(name, parent.String(name))
+ break
+ }
+ }
+ }
}
-// byCategory sorts an array of FlagGroup by Name in the order
-// defined in AppHelpFlagGroups.
-type ByCategory []FlagGroup
+func init() {
+ cli.FlagStringer = FlagString
+}
-func (a ByCategory) Len() int { return len(a) }
-func (a ByCategory) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
-func (a ByCategory) Less(i, j int) bool {
- iCat, jCat := a[i].Name, a[j].Name
- iIdx, jIdx := len(a), len(a) // ensure non categorized flags come last
+// FlagString prints a single flag in help.
+func FlagString(f cli.Flag) string {
+ df, ok := f.(cli.DocGenerationFlag)
+ if !ok {
+ return ""
+ }
- for i, group := range a {
- if iCat == group.Name {
- iIdx = i
- }
- if jCat == group.Name {
- jIdx = i
- }
+ needsPlaceholder := df.TakesValue()
+ placeholder := ""
+ if needsPlaceholder {
+ placeholder = "value"
}
- return iIdx < jIdx
+ namesText := pad(cli.FlagNamePrefixer(df.Names(), placeholder), 30)
+
+ defaultValueString := ""
+ if s := df.GetDefaultText(); s != "" {
+ defaultValueString = " (default: " + s + ")"
+ }
+
+ usage := strings.TrimSpace(df.GetUsage())
+ envHint := strings.TrimSpace(cli.FlagEnvHinter(df.GetEnvVars(), ""))
+ if len(envHint) > 0 {
+ usage += " " + envHint
+ }
+
+ usage = wordWrap(usage, 80)
+ usage = indent(usage, 10)
+
+ return fmt.Sprintf("\n %s%s\n%s", namesText, defaultValueString, usage)
+}
+
+func pad(s string, length int) string {
+ if len(s) < length {
+ s += strings.Repeat(" ", length-len(s))
+ }
+ return s
}
-func FlagCategory(flag cli.Flag, flagGroups []FlagGroup) string {
- for _, category := range flagGroups {
- for _, flg := range category.Flags {
- if flg.GetName() == flag.GetName() {
- return category.Name
+func indent(s string, nspace int) string {
+ ind := strings.Repeat(" ", nspace)
+ return ind + strings.ReplaceAll(s, "\n", "\n"+ind)
+}
+
+func wordWrap(s string, width int) string {
+ var (
+ output strings.Builder
+ lineLength = 0
+ )
+
+ for {
+ sp := strings.IndexByte(s, ' ')
+ var word string
+ if sp == -1 {
+ word = s
+ } else {
+ word = s[:sp]
+ }
+ wlen := len(word)
+ over := lineLength+wlen >= width
+ if over {
+ output.WriteByte('\n')
+ lineLength = 0
+ } else {
+ if lineLength != 0 {
+ output.WriteByte(' ')
+ lineLength++
}
}
+
+ output.WriteString(word)
+ lineLength += wlen
+
+ if sp == -1 {
+ break
+ }
+ s = s[wlen+1:]
}
- return "MISC"
-}
-// NewApp creates an app with sane defaults.
-func NewApp(gitCommit, gitDate, usage string) *cli.App {
- app := cli.NewApp()
- app.Name = filepath.Base(os.Args[0])
- app.Author = ""
- app.Email = ""
- app.Version = params.VersionWithCommit(gitCommit, gitDate)
- app.Usage = usage
- return app
+ return output.String()
}
diff --git a/internal/version/vcs.go b/internal/version/vcs.go
new file mode 100644
index 0000000000..21de8946e8
--- /dev/null
+++ b/internal/version/vcs.go
@@ -0,0 +1,52 @@
+// Copyright 2022 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 .
+
+package version
+
+import (
+ "runtime/debug"
+ "time"
+)
+
+// In go 1.18 and beyond, the go tool embeds VCS information into the build.
+
+const (
+ govcsTimeLayout = "2006-01-02T15:04:05Z"
+ ourTimeLayout = "20060102"
+)
+
+// buildInfoVCS returns VCS information of the build.
+func buildInfoVCS(info *debug.BuildInfo) (s VCSInfo, ok bool) {
+ for _, v := range info.Settings {
+ switch v.Key {
+ case "vcs.revision":
+ s.Commit = v.Value
+ case "vcs.modified":
+ if v.Value == "true" {
+ s.Dirty = true
+ }
+ case "vcs.time":
+ t, err := time.Parse(govcsTimeLayout, v.Value)
+ if err == nil {
+ s.Date = t.Format(ourTimeLayout)
+ }
+ }
+ }
+ if s.Commit != "" && s.Date != "" {
+ ok = true
+ }
+ return
+}
diff --git a/internal/version/version.go b/internal/version/version.go
new file mode 100644
index 0000000000..97e3c46c54
--- /dev/null
+++ b/internal/version/version.go
@@ -0,0 +1,141 @@
+// Copyright 2022 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 .
+
+// Package version implements reading of build version information.
+package version
+
+import (
+ "fmt"
+ "runtime"
+ "runtime/debug"
+ "strings"
+
+ "github.com/PlatONnetwork/PlatON-Go/params"
+)
+
+const ourPath = "github.com/PlatONnetwork/PlatON-Go" // Path to our module
+
+// These variables are set at build-time by the linker when the build is
+// done by build/ci.go.
+var gitCommit, gitDate string
+
+// VCSInfo represents the git repository state.
+type VCSInfo struct {
+ Commit string // head commit hash
+ Date string // commit time in YYYYMMDD format
+ Dirty bool
+}
+
+// VCS returns version control information of the current executable.
+func VCS() (VCSInfo, bool) {
+ if gitCommit != "" {
+ // Use information set by the build script if present.
+ return VCSInfo{Commit: gitCommit, Date: gitDate}, true
+ }
+ if buildInfo, ok := debug.ReadBuildInfo(); ok {
+ if buildInfo.Main.Path == ourPath {
+ return buildInfoVCS(buildInfo)
+ }
+ }
+ return VCSInfo{}, false
+}
+
+// ClientName creates a software name/version identifier according to common
+// conventions in the Ethereum p2p network.
+func ClientName(clientIdentifier string) string {
+ git, _ := VCS()
+ return fmt.Sprintf("%s/v%v/%v-%v/%v",
+ strings.Title(clientIdentifier),
+ params.VersionWithCommit(git.Commit, git.Date),
+ runtime.GOOS, runtime.GOARCH,
+ runtime.Version(),
+ )
+}
+
+// runtimeInfo returns build and platform information about the current binary.
+//
+// If the package that is currently executing is a prefixed by our go-ethereum
+// module path, it will print out commit and date VCS information. Otherwise,
+// it will assume it's imported by a third-party and will return the imported
+// version and whether it was replaced by another module.
+func Info() (version, vcs string) {
+ version = params.VersionWithMeta
+ buildInfo, ok := debug.ReadBuildInfo()
+ if !ok {
+ return version, ""
+ }
+ version = versionInfo(buildInfo)
+ if status, ok := VCS(); ok {
+ modified := ""
+ if status.Dirty {
+ modified = " (dirty)"
+ }
+ commit := status.Commit
+ if len(commit) > 8 {
+ commit = commit[:8]
+ }
+ vcs = commit + "-" + status.Date + modified
+ }
+ return version, vcs
+}
+
+// versionInfo returns version information for the currently executing
+// implementation.
+//
+// Depending on how the code is instantiated, it returns different amounts of
+// information. If it is unable to determine which module is related to our
+// package it falls back to the hardcoded values in the params package.
+func versionInfo(info *debug.BuildInfo) string {
+ // If the main package is from our repo, prefix version with "geth".
+ if strings.HasPrefix(info.Path, ourPath) {
+ return fmt.Sprintf("geth %s", info.Main.Version)
+ }
+ // Not our main package, so explicitly print out the module path and
+ // version.
+ var version string
+ if info.Main.Path != "" && info.Main.Version != "" {
+ // These can be empty when invoked with "go run".
+ version = fmt.Sprintf("%s@%s ", info.Main.Path, info.Main.Version)
+ }
+ mod := findModule(info, ourPath)
+ if mod == nil {
+ // If our module path wasn't imported, it's unclear which
+ // version of our code they are running. Fallback to hardcoded
+ // version.
+ return version + fmt.Sprintf("geth %s", params.VersionWithMeta)
+ }
+ // Our package is a dependency for the main module. Return path and
+ // version data for both.
+ version += fmt.Sprintf("%s@%s", mod.Path, mod.Version)
+ if mod.Replace != nil {
+ // If our package was replaced by something else, also note that.
+ version += fmt.Sprintf(" (replaced by %s@%s)", mod.Replace.Path, mod.Replace.Version)
+ }
+ return version
+}
+
+// findModule returns the module at path.
+func findModule(info *debug.BuildInfo, path string) *debug.Module {
+ if info.Path == ourPath {
+ return &info.Main
+ }
+ for _, mod := range info.Deps {
+ if mod.Path == path {
+ return mod
+ }
+ }
+ return nil
+}
diff --git a/node/api.go b/node/api.go
index 4384ee924a..309f7fe11b 100644
--- a/node/api.go
+++ b/node/api.go
@@ -39,12 +39,7 @@ func (n *Node) apis() []rpc.API {
{
Namespace: "admin",
Version: "1.0",
- Service: &privateAdminAPI{n},
- }, {
- Namespace: "admin",
- Version: "1.0",
- Service: &publicAdminAPI{n},
- Public: true,
+ Service: &adminAPI{n},
}, {
Namespace: "debug",
Version: "1.0",
@@ -52,21 +47,20 @@ func (n *Node) apis() []rpc.API {
}, {
Namespace: "web3",
Version: "1.0",
- Service: &publicWeb3API{n},
- Public: true,
+ Service: &web3API{n},
},
}
}
-// privateAdminAPI is the collection of administrative API methods exposed only
+// adminAPI is the collection of administrative API methods exposed only
// over a secure RPC channel.
-type privateAdminAPI struct {
+type adminAPI struct {
node *Node // Node interfaced by this API
}
// AddPeer requests connecting to a remote node, and also maintaining the new
// connection at all times, even reconnecting if it is lost.
-func (api *privateAdminAPI) AddPeer(url string) (bool, error) {
+func (api *adminAPI) AddPeer(url string) (bool, error) {
// Make sure the server is running, fail otherwise
server := api.node.Server()
if server == nil {
@@ -82,7 +76,7 @@ func (api *privateAdminAPI) AddPeer(url string) (bool, error) {
}
// RemovePeer disconnects from a remote node if the connection exists
-func (api *privateAdminAPI) RemovePeer(url string) (bool, error) {
+func (api *adminAPI) RemovePeer(url string) (bool, error) {
// Make sure the server is running, fail otherwise
server := api.node.Server()
if server == nil {
@@ -99,7 +93,7 @@ func (api *privateAdminAPI) RemovePeer(url string) (bool, error) {
// PeerEvents creates an RPC subscription which receives peer events from the
// node's p2p.Server
-func (api *privateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error) {
+func (api *adminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription, error) {
// Make sure the server is running, fail otherwise
server := api.node.Server()
if server == nil {
@@ -136,7 +130,7 @@ func (api *privateAdminAPI) PeerEvents(ctx context.Context) (*rpc.Subscription,
}
// StartHTTP starts the HTTP RPC API server.
-func (api *privateAdminAPI) StartHTTP(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
+func (api *adminAPI) StartHTTP(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
api.node.lock.Lock()
defer api.node.lock.Unlock()
@@ -191,26 +185,26 @@ func (api *privateAdminAPI) StartHTTP(host *string, port *int, cors *string, api
// StartRPC starts the HTTP RPC API server.
// Deprecated: use StartHTTP instead.
-func (api *privateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
+func (api *adminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) {
log.Warn("Deprecation warning", "method", "admin.StartRPC", "use-instead", "admin.StartHTTP")
return api.StartHTTP(host, port, cors, apis, vhosts)
}
// StopHTTP shuts down the HTTP server.
-func (api *privateAdminAPI) StopHTTP() (bool, error) {
+func (api *adminAPI) StopHTTP() (bool, error) {
api.node.http.stop()
return true, nil
}
// StopRPC shuts down the HTTP server.
// Deprecated: use StopHTTP instead.
-func (api *privateAdminAPI) StopRPC() (bool, error) {
+func (api *adminAPI) StopRPC() (bool, error) {
log.Warn("Deprecation warning", "method", "admin.StopRPC", "use-instead", "admin.StopHTTP")
return api.StopHTTP()
}
// StartWS starts the websocket RPC API server.
-func (api *privateAdminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error) {
+func (api *adminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error) {
api.node.lock.Lock()
defer api.node.lock.Unlock()
@@ -262,21 +256,15 @@ func (api *privateAdminAPI) StartWS(host *string, port *int, allowedOrigins *str
}
// StopWS terminates all WebSocket servers.
-func (api *privateAdminAPI) StopWS() (bool, error) {
+func (api *adminAPI) StopWS() (bool, error) {
api.node.http.stopWS()
api.node.ws.stop()
return true, nil
}
-// publicAdminAPI is the collection of administrative API methods exposed over
-// both secure and unsecure RPC channels.
-type publicAdminAPI struct {
- node *Node // Node interfaced by this API
-}
-
// Peers retrieves all the information we know about each individual peer at the
// protocol granularity.
-func (api *publicAdminAPI) Peers() ([]*p2p.PeerInfo, error) {
+func (api *adminAPI) Peers() ([]*p2p.PeerInfo, error) {
server := api.node.Server()
if server == nil {
return nil, ErrNodeStopped
@@ -286,7 +274,7 @@ func (api *publicAdminAPI) Peers() ([]*p2p.PeerInfo, error) {
// NodeInfo retrieves all the information we know about the host node at the
// protocol granularity.
-func (api *publicAdminAPI) NodeInfo() (*p2p.NodeInfo, error) {
+func (api *adminAPI) NodeInfo() (*p2p.NodeInfo, error) {
server := api.node.Server()
if server == nil {
return nil, ErrNodeStopped
@@ -295,11 +283,11 @@ func (api *publicAdminAPI) NodeInfo() (*p2p.NodeInfo, error) {
}
// Datadir retrieves the current data directory the node is using.
-func (api *publicAdminAPI) Datadir() string {
+func (api *adminAPI) Datadir() string {
return api.node.DataDir()
}
-func (api *publicAdminAPI) GetProgramVersion() (*params.ProgramVersion, error) {
+func (api *adminAPI) GetProgramVersion() (*params.ProgramVersion, error) {
programVersion := uint32(params.VersionMajor<<16 | params.VersionMinor<<8 | params.VersionPatch)
sig, err := GetCryptoHandler().Sign(programVersion)
if err != nil {
@@ -308,18 +296,18 @@ func (api *publicAdminAPI) GetProgramVersion() (*params.ProgramVersion, error) {
return ¶ms.ProgramVersion{Version: programVersion, Sign: hexutil.Encode(sig)}, nil
}
-// publicWeb3API offers helper utils
-type publicWeb3API struct {
+// web3API offers helper utils
+type web3API struct {
stack *Node
}
// ClientVersion returns the node name
-func (s *publicWeb3API) ClientVersion() string {
+func (s *web3API) ClientVersion() string {
return s.stack.Server().Name
}
// Sha3 applies the ethereum sha3 implementation on the input.
// It assumes the input is hex encoded.
-func (s *publicWeb3API) Sha3(input hexutil.Bytes) hexutil.Bytes {
+func (s *web3API) Sha3(input hexutil.Bytes) hexutil.Bytes {
return crypto.Keccak256(input)
}
diff --git a/node/api_test.go b/node/api_test.go
index 1e69719cab..bd1e021404 100644
--- a/node/api_test.go
+++ b/node/api_test.go
@@ -36,7 +36,7 @@ func TestStartRPC(t *testing.T) {
type test struct {
name string
cfg Config
- fn func(*testing.T, *Node, *privateAdminAPI)
+ fn func(*testing.T, *Node, *adminAPI)
// Checks. These run after the node is configured and all API calls have been made.
wantReachable bool // whether the HTTP server should be reachable at all
@@ -49,7 +49,7 @@ func TestStartRPC(t *testing.T) {
{
name: "all off",
cfg: Config{},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
},
wantReachable: false,
wantHandlers: false,
@@ -59,7 +59,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc enabled through config",
cfg: Config{HTTPHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
},
wantReachable: true,
wantHandlers: true,
@@ -69,7 +69,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc enabled through API",
cfg: Config{},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
assert.NoError(t, err)
},
@@ -81,7 +81,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc start again after failure",
cfg: Config{},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
// Listen on a random port.
listener, err := net.Listen("tcp", "127.0.0.1:0")
if err != nil {
@@ -109,7 +109,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc stopped through API",
cfg: Config{HTTPHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopHTTP()
assert.NoError(t, err)
},
@@ -121,7 +121,7 @@ func TestStartRPC(t *testing.T) {
{
name: "rpc stopped twice",
cfg: Config{HTTPHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopHTTP()
assert.NoError(t, err)
@@ -144,7 +144,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled through API",
cfg: Config{},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartWS(sp("127.0.0.1"), ip(0), nil, nil)
assert.NoError(t, err)
},
@@ -156,7 +156,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws stopped through API",
cfg: Config{WSHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopWS()
assert.NoError(t, err)
},
@@ -168,7 +168,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws stopped twice",
cfg: Config{WSHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StopWS()
assert.NoError(t, err)
@@ -183,7 +183,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled after RPC",
cfg: Config{HTTPHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
wsport := n.http.port
_, err := api.StartWS(sp("127.0.0.1"), ip(wsport), nil, nil)
assert.NoError(t, err)
@@ -196,7 +196,7 @@ func TestStartRPC(t *testing.T) {
{
name: "ws enabled after RPC then stopped",
cfg: Config{HTTPHost: "127.0.0.1"},
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
wsport := n.http.port
_, err := api.StartWS(sp("127.0.0.1"), ip(wsport), nil, nil)
assert.NoError(t, err)
@@ -211,7 +211,7 @@ func TestStartRPC(t *testing.T) {
},
{
name: "rpc stopped with ws enabled",
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartHTTP(sp("127.0.0.1"), ip(0), nil, nil, nil)
assert.NoError(t, err)
@@ -229,7 +229,7 @@ func TestStartRPC(t *testing.T) {
},
{
name: "rpc enabled after ws",
- fn: func(t *testing.T, n *Node, api *privateAdminAPI) {
+ fn: func(t *testing.T, n *Node, api *adminAPI) {
_, err := api.StartWS(sp("127.0.0.1"), ip(0), nil, nil)
assert.NoError(t, err)
@@ -272,7 +272,7 @@ func TestStartRPC(t *testing.T) {
// Run the API call hook.
if test.fn != nil {
- test.fn(t, stack, &privateAdminAPI{stack})
+ test.fn(t, stack, &adminAPI{stack})
}
// Check if the HTTP endpoints are available.
diff --git a/node/rpcstack.go b/node/rpcstack.go
index f2542718b5..beec48a623 100644
--- a/node/rpcstack.go
+++ b/node/rpcstack.go
@@ -282,7 +282,7 @@ func (h *httpServer) enableRPC(apis []rpc.API, config httpConfig) error {
// Create RPC server and handler.
srv := rpc.NewServer()
- if err := RegisterApis(apis, config.Modules, srv, false); err != nil {
+ if err := RegisterApis(apis, config.Modules, srv); err != nil {
return err
}
h.httpConfig = config
@@ -314,7 +314,7 @@ func (h *httpServer) enableWS(apis []rpc.API, config wsConfig) error {
// Create RPC server and handler.
srv := rpc.NewServer()
- if err := RegisterApis(apis, config.Modules, srv, false); err != nil {
+ if err := RegisterApis(apis, config.Modules, srv); err != nil {
return err
}
h.wsConfig = config
@@ -530,7 +530,7 @@ func (is *ipcServer) stop() error {
// RegisterApis checks the given modules' availability, generates an allowlist based on the allowed modules,
// and then registers all of the APIs exposed by the services.
-func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll bool) error {
+func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server) error {
if bad, available := checkModuleAvailability(modules, apis); len(bad) > 0 {
log.Error("Unavailable modules in HTTP API list", "unavailable", bad, "available", available)
}
@@ -541,7 +541,7 @@ func RegisterApis(apis []rpc.API, modules []string, srv *rpc.Server, exposeAll b
}
// Register all the APIs exposed by the services
for _, api := range apis {
- if exposeAll || allowList[api.Namespace] || (len(allowList) == 0 && api.Public) {
+ if allowList[api.Namespace] || (len(allowList) == 0) {
if err := srv.RegisterName(api.Namespace, api.Service); err != nil {
return err
}
diff --git a/node/rpcstack_test.go b/node/rpcstack_test.go
index f31fa0c307..88cb1e43b0 100644
--- a/node/rpcstack_test.go
+++ b/node/rpcstack_test.go
@@ -315,60 +315,105 @@ func TestJWT(t *testing.T) {
ss, _ := jwt.NewWithClaims(method, testClaim(input)).SignedString(secret)
return ss
}
- expOk := []string{
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() + 4})),
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() - 4})),
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{
- "iat": time.Now().Unix(),
- "exp": time.Now().Unix() + 2,
- })),
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{
- "iat": time.Now().Unix(),
- "bar": "baz",
- })),
- }
- expFail := []string{
- // future
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() + 6})),
- // stale
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() - 6})),
- // wrong algo
- fmt.Sprintf("Bearer %v", issueToken(secret, jwt.SigningMethodHS512, testClaim{"iat": time.Now().Unix() + 4})),
- // expired
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix(), "exp": time.Now().Unix()})),
- // missing mandatory iat
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{})),
- // wrong secret
- fmt.Sprintf("Bearer %v", issueToken([]byte("wrong"), nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer %v", issueToken([]byte{}, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer %v", issueToken(nil, nil, testClaim{"iat": time.Now().Unix()})),
- // Various malformed syntax
- fmt.Sprintf("%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer: %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer:%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer\t%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- fmt.Sprintf("Bearer \t%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()})),
- }
srv := createAndStartServer(t, &httpConfig{jwtSecret: []byte("secret")},
true, &wsConfig{Origins: []string{"*"}, jwtSecret: []byte("secret")})
wsUrl := fmt.Sprintf("ws://%v", srv.listenAddr())
htUrl := fmt.Sprintf("http://%v", srv.listenAddr())
- for i, token := range expOk {
+ expOk := []func() string{
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() + 4}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() - 4}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{
+ "iat": time.Now().Unix(),
+ "exp": time.Now().Unix() + 2,
+ }))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{
+ "iat": time.Now().Unix(),
+ "bar": "baz",
+ }))
+ },
+ }
+ for i, tokenFn := range expOk {
+ token := tokenFn()
if err := wsRequest(t, wsUrl, "Authorization", token); err != nil {
t.Errorf("test %d-ws, token '%v': expected ok, got %v", i, token, err)
}
+ token = tokenFn()
if resp := rpcRequest(t, htUrl, "Authorization", token); resp.StatusCode != 200 {
t.Errorf("test %d-http, token '%v': expected ok, got %v", i, token, resp.StatusCode)
}
}
- for i, token := range expFail {
+
+ expFail := []func() string{
+ // future
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() + 6}))
+ },
+ // stale
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix() - 6}))
+ },
+ // wrong algo
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, jwt.SigningMethodHS512, testClaim{"iat": time.Now().Unix() + 4}))
+ },
+ // expired
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix(), "exp": time.Now().Unix()}))
+ },
+ // missing mandatory iat
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{}))
+ },
+ // wrong secret
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken([]byte("wrong"), nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken([]byte{}, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(nil, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ // Various malformed syntax
+ func() string {
+ return fmt.Sprintf("%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("bearer %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer: %v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer:%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer\t%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ func() string {
+ return fmt.Sprintf("Bearer \t%v", issueToken(secret, nil, testClaim{"iat": time.Now().Unix()}))
+ },
+ }
+ for i, tokenFn := range expFail {
+ token := tokenFn()
if err := wsRequest(t, wsUrl, "Authorization", token); err == nil {
t.Errorf("tc %d-ws, token '%v': expected not to allow, got ok", i, token)
}
+ token = tokenFn()
if resp := rpcRequest(t, htUrl, "Authorization", token); resp.StatusCode != 403 {
t.Errorf("tc %d-http, token '%v': expected not to allow, got %v", i, token, resp.StatusCode)
}
diff --git a/node/utils_test.go b/node/utils_test.go
index f18a6e284e..9048776641 100644
--- a/node/utils_test.go
+++ b/node/utils_test.go
@@ -100,12 +100,10 @@ func (f *FullService) APIs() []rpc.API {
{
Namespace: "debug",
Version: "1.0",
- Public: true,
},
{
Namespace: "net",
Version: "1.0",
- Public: true,
},
}
}
diff --git a/p2p/server.go b/p2p/server.go
index 77c08a3fdf..2201382f30 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -151,6 +151,10 @@ type Config struct {
// the server is started.
ListenAddr string
+ // If DiscAddr is set to a non-nil value, the server will use ListenAddr
+ // for TCP and DiscAddr for the UDP discovery protocol.
+ DiscAddr string
+
// If set to a non-nil value, the given NAT port mapper
// is used to make the listening port available to the
// Internet.
@@ -593,7 +597,15 @@ func (srv *Server) setupDiscovery() error {
return nil
}
- addr, err := net.ResolveUDPAddr("udp", srv.ListenAddr)
+ listenAddr := srv.ListenAddr
+
+ // Use an alternate listening address for UDP if
+ // a custom discovery address is configured.
+ if srv.DiscAddr != "" {
+ listenAddr = srv.DiscAddr
+ }
+
+ addr, err := net.ResolveUDPAddr("udp", listenAddr)
if err != nil {
return err
}
diff --git a/rpc/subscription_test.go b/rpc/subscription_test.go
index 18a6962ed8..9b2144af13 100644
--- a/rpc/subscription_test.go
+++ b/rpc/subscription_test.go
@@ -48,7 +48,7 @@ func TestNewID(t *testing.T) {
func TestSubscriptions(t *testing.T) {
var (
- namespaces = []string{"platon", "shh", "bzz"}
+ namespaces = []string{"platon", "bzz"}
service = ¬ificationTestService{}
subCount = len(namespaces)
notificationCount = 3
diff --git a/rpc/types.go b/rpc/types.go
index 9b076c79d6..e735a6f4b6 100644
--- a/rpc/types.go
+++ b/rpc/types.go
@@ -34,7 +34,7 @@ type API struct {
Namespace string // namespace under which the rpc methods of Service are exposed
Version string // api version for DApp's
Service interface{} // receiver instance which holds the methods
- Public bool // indication if the methods must be considered safe for public use
+ Public bool // deprecated - this field is no longer used, but retained for compatibility
Authenticated bool // whether the api should only be available behind authentication.
}
diff --git a/tests/fuzzers/rlp/rlp_fuzzer.go b/tests/fuzzers/rlp/rlp_fuzzer.go
index 0b9904ca79..bdd05af674 100644
--- a/tests/fuzzers/rlp/rlp_fuzzer.go
+++ b/tests/fuzzers/rlp/rlp_fuzzer.go
@@ -36,6 +36,12 @@ func decodeEncode(input []byte, val interface{}, i int) {
}
func Fuzz(input []byte) int {
+ if len(input) == 0 {
+ return 0
+ }
+ if len(input) > 500*1024 {
+ return 0
+ }
var i int
{
if len(input) > 0 {
diff --git a/trie/database.go b/trie/database.go
index a4c14bb18f..e2c1008562 100644
--- a/trie/database.go
+++ b/trie/database.go
@@ -1010,7 +1010,7 @@ func (c *cleaner) Put(key []byte, rlp []byte) error {
delete(c.db.dirties, hash)
c.db.dirtiesSize -= common.StorageSize(common.HashLength + int(node.size))
if node.children != nil {
- c.db.dirtiesSize -= common.StorageSize(cachedNodeChildrenSize + len(node.children)*(common.HashLength+2))
+ c.db.childrenSize -= common.StorageSize(cachedNodeChildrenSize + len(node.children)*(common.HashLength+2))
}
}