Commit Graph

56 Commits

Author SHA1 Message Date
Alex Prut
ef84da8481
all: remove unneeded parentheses (#21921)
* remove uneeded convertion type

* remove redundant type in composite literal

* omit explicit type where implicit

* remove unused redundant parenthesis

* remove redundant import alias duktape
2021-02-02 11:32:44 +02:00
Pascal Dierich
566cb4c5f0
accounts/keystore: add missing function doc for SignText (#21914)
Co-authored-by: Pascal Dierich <pascal@pascaldierich.com>
2020-11-30 09:03:24 +01:00
Alex Prut
810f9e057d
all: remove redundant conversions and import names (#21903) 2020-11-25 21:00:23 +01:00
Marius van der Wijden
1fed223483
accounts/keystore: fix flaky test (#21703)
* accounts/keystore: add timeout to test to prevent failure on travis

The TestWalletNotifications test sporadically fails on travis.
This is because we shutdown the event collection before all events are received.
Adding a small timeout (10 milliseconds) allows the collector to be scheduled
and to consume all pending events before we shut it down.

* accounts/keystore: added newlines back in

* accounts/keystore: properly fix the walletNotifications test
2020-10-13 19:46:43 +02:00
mr_franklin
c37e68e7c1
all: replace RWMutex with Mutex in places where RLock is not used (#21622) 2020-10-13 10:58:41 +02:00
Pau
d5c267fd30
accounts/keystore: fix typo in error message (#21200) 2020-06-09 10:23:42 +02:00
Péter Szilágyi
b1b75f0089
accounts/keystore, cmd/faucet: return old account to allow unlock 2020-06-04 10:57:21 +03:00
Péter Szilágyi
469b8739eb
acounts/keystore, cmd/faucet: fix faucet double import, fix twitter url 2020-06-04 08:59:26 +03:00
Marius van der Wijden
38aab0aa83
accounts/keystore: fix double import race (#20915)
* accounts/keystore: fix race in Import/ImportECDSA

* accounts/keystore: added import/export tests

* cmd/geth: improved TestAccountImport test

* accounts/keystore: added import/export tests

* accounts/keystore: fixed naming

* accounts/keystore: fixed typo

* accounts/keystore: use mutex instead of rwmutex

* accounts: use errors instead of fmt
2020-04-22 12:52:29 +03:00
Guillaume Ballet
8c1e8de839
accounts/keystore: fix staticcheck warnings (#20373)
* accounts/keystore: fix staticcheck warnings

* review feedback
2019-11-25 14:39:55 +01:00
SjonHortensius
36994e4e0b all: replace passPHRASE with passWORD in user interactions (#19932)
* Ref #19906 - replace passPHRASE with passWORD in any user interactions

this skips doccomments and variablenames to minimize impact. It does
however include a rename of the `ethkey` `changepassphrase` parameter

* console: fix JavaScript error capitalization
2019-08-12 12:00:38 +03:00
Martin Holst Swende
2046d66fe5
accounts/keystore: fix #19707, avoid keyword as variable name 2019-06-18 09:46:56 +02:00
Jeremy Schlatter
a184ab7a61 accounts/keystore: enable fallback for darwin,!cgo (#19614)
Without this, accounts/keystore fails to build for Darwin with
CGO_ENABLED=0.
2019-05-27 12:28:06 +02:00
Kurkó Mihály
107c67d74e accounts, cmd, internal, signer: add note about backing up the keystore (#19432)
* accounts: add note about backing up the keystore

* cmd, accounts: move the printout to accountCreate

* internal, signer: add info when new account is created via rpc

* cmd, internal, signer: split logs

* cmd/geth: make account new output a bit more verbose
2019-05-07 15:49:51 +03:00
Péter Szilágyi
ae7344d799
accounts: switch Ledger derivation path to canonical one 2019-04-10 13:09:08 +03:00
Matthew Halpern
15eee47ebf accounts: prefer nil slices over zero-length slices (#19079) 2019-03-06 12:30:39 +02:00
Guillaume Ballet
9c7e65c435 accounts: fix typos from the SignData merge (#19119) 2019-02-19 10:33:42 +02:00
Paul Berg
572baae10a signer, clef: implement EIP191/712 (#17789)
* Named functions and defined a basic EIP191 content type list

* Written basic content type functions

* Added ecRecover method in the clef api

* Updated the extapi changelog and addded indications in the README

* Changed the version of the external API

* Added tests for 0x45

* Implementing UnmarshalJSON() for TypedData

* Working on TypedData

* Solved the auditlog issue

* Changed method to signTypedData

* Changed mimes and implemented the 'encodeType' function for EIP-712

* Polished docstrings, ran goimports and swapped fmt.Errorf with errors.New where possible

* Drafted recursive encodeData

* Ran goimports and gofmt

* Drafted first version of EIP-712, including tests

* Temporarily switched to using common.Address in tests

* Drafted text/validator and and rewritten []byte as hexutil.Bytes

* Solved stringified address encoding issue

* Changed the property type required by signData from bytes to interface{}

* Fixed bugs in 'data/typed' signs

* Brought legal warning back after temporarily disabling it for development

* Added example RPC calls for account_signData and account_signTypedData

* Named functions and defined a basic EIP191 content type list

* Written basic content type functions

* Added ecRecover method in the clef api

* Updated the extapi changelog and addded indications in the README

* Added tests for 0x45

* Implementing UnmarshalJSON() for TypedData

* Working on TypedData

* Solved the auditlog issue

* Changed method to signTypedData

* Changed mimes and implemented the 'encodeType' function for EIP-712

* Polished docstrings, ran goimports and swapped fmt.Errorf with errors.New where possible

* Drafted recursive encodeData

* Ran goimports and gofmt

* Drafted first version of EIP-712, including tests

* Temporarily switched to using common.Address in tests

* Drafted text/validator and and rewritten []byte as hexutil.Bytes

* Solved stringified address encoding issue

* Changed the property type required by signData from bytes to interface{}

* Fixed bugs in 'data/typed' signs

* Brought legal warning back after temporarily disabling it for development

* Added example RPC calls for account_signData and account_signTypedData

* Polished and fixed PR

* Polished and fixed PR

* Solved malformed data panics and also wrote tests

* Solved malformed data panics and also wrote tests

* Added alphabetical sorting to type dependencies

* Added alphabetical sorting to type dependencies

* Added pretty print to data/typed UI

* Added pretty print to data/typed UI

* signer: more tests for typed data

* signer: more tests for typed data

* Fixed TestMalformedData4 errors and renamed IsValid to Validate

* Fixed TestMalformedData4 errors and renamed IsValid to Validate

* Fixed more new failing tests and deanonymised some functions

* Fixed more new failing tests and deanonymised some functions

* Added types to EIP712 output in cliui

* Added types to EIP712 output in cliui

* Fixed regexp issues

* Fixed regexp issues

* Added pseudo-failing test

* Added pseudo-failing test

* Fixed false positive test

* Fixed false positive test

* Added PrettyPrint method

* Added PrettyPrint method

* signer: refactor formatting and UI

* signer: make ui use new message format for signing

* Fixed breaking changes

* Fixed rules_test failing test

* Added extra regexp for reference types

* signer: more hard types

* Fixed failing test, formatted files

* signer: use golang/x keccak

* Fixed goimports error

* clef, signer: address some review concerns

* Implemented latest recommendations

* Fixed comments and uintint256 issue

* accounts, signer: fix mimetypes, add interface to sign data with passphrase

* signer, accounts: remove duplicated code, pass hash preimages to signing

* signer: prevent panic in type assertions, make cliui print rawdata as quotable-safe

* signer: linter fixes, remove deprecated crypto dependency

* accounts: fix goimport
2019-02-06 08:30:49 +01:00
Martin Holst Swende
43e8efe895
accounts, eth, clique, signer: support for external signer API (#18079)
* accounts, eth, clique: implement external backend + move sighash calc to backend

* signer: implement account_Version on external API

* accounts/external: enable ipc, add copyright

* accounts, internal, signer: formatting

* node: go fmt

* flags: disallow --dev in combo with --externalsigner

* accounts: remove clique-specific signing method, replace with more generic

* accounts, consensus: formatting + fix error in tests

* signer/core: remove (test-) import cycle

* clique: remove unused import

* accounts: remove CliqueHash and avoid dependency on package crypto

* consensus/clique: unduplicate header encoding
2019-02-05 11:23:57 +01:00
Jeremy Schlatter
aca588a8e4 accounts/keystore: small code simplification (#18394) 2019-01-07 10:35:44 +02:00
Jeremy Schlatter
072c95fb74 accounts/keystore: fix comment typo (#18395) 2019-01-05 21:27:57 +01:00
Wenbiao Zheng
32d35c9c08 accounts/keystore: delete the redundant keystore in filename (#17930)
* accounts/keystore: reduce file name length

* accounts/keystore: reduce code line width
2018-11-29 12:04:56 +02:00
Martin Holst Swende
d5c7a6056a
cmd/clef: encrypt the master seed on disk (#17704)
* cmd/clef: encrypt master seed of clef

Signed-off-by: YaoZengzeng <yaozengzeng@zju.edu.cn>

* keystore: refactor for external use of encryption

* clef: utilize keystore encryption, check flags correctly

* clef: validate master password

* clef: add json wrapping around encrypted master seed
2018-10-09 11:05:41 +02:00
Martin Holst Swende
6f004c46d5 accounts/keystore: double-check keystore file after creation (#17348) 2018-09-19 18:08:38 +02:00
Roc Yu
70176cda0e accounts/keystore: rename skipKeyFile to nonKeyFile to better reveal the function purpose (#17290) 2018-08-03 10:25:17 +03:00
Péter Szilágyi
d9575e92fc crypto/secp256k1: remove external LGPL dependencies (#17239) 2018-07-26 13:33:13 +02:00
Ralph Caraveo III
5d30be412b all: switch out defunct set library to different one (#16873)
* keystore, ethash, eth, miner, rpc, whisperv6: tech debt with now defunct set.

* whisperv5: swap out gopkg.in/fatih/set.v0 with supported set
2018-07-16 10:54:19 +03:00
Wenbiao Zheng
c95e4a80d1 accounts/keystore: assign schema as const instead of var (#16985) 2018-06-14 17:24:35 +03:00
GagziW
541f299fbb accounts: changed if-else blocks to conform with golint (#16654) 2018-05-03 11:37:56 +03:00
Armin
afc2039f22 accounts/keystore: Improved error message
* Fix for #15668
2017-12-18 12:28:34 +01:00
Péter Szilágyi
0981d2e566
Merge pull request #15498 from nonsense/account_cache_modtime_test_fix
accounts/keystore: change modtime for test case files to be bigger than 1sec.
2017-11-24 16:21:39 +02:00
Martin Holst Swende
bedf6f40af cmd/geth: make geth account new faster with many keys (#15529) 2017-11-20 17:39:53 +01:00
Martin Holst Swende
e2b3a23663
accounts/keystore: Ignore initial trigger of rescan-event 2017-11-20 12:35:30 +01:00
Péter Szilágyi
6810674de9
accounts/keystore: lock file cache during scan, minor polish 2017-11-20 12:21:52 +02:00
Anton Evangelatov
b64525694b accounts/keystore: comments above time.Sleep 2017-11-16 15:01:02 +01:00
Anton Evangelatov
448abb61eb accounts/keystore: change modtime for test cases to be bigger than 1sec. 2017-11-16 14:17:28 +01:00
Martin Holst Swende
88b1db7288 accounts/keystore: scan key directory without locks held (#15171)
The accountCache contains a file cache, and remembers from
scan to scan what files were present earlier. Thus, whenever
there's a change, the scan phase only bothers processing new
and removed files.
2017-10-09 12:40:50 +02:00
Péter Szilágyi
5d9ac49c7e
accounts: refactor API for generalized USB wallets 2017-08-09 13:26:07 +03:00
Péter Szilágyi
db568a61e2
accounts, console, internal: support trezor hardware wallet 2017-08-09 11:30:17 +03:00
Egon Elbre
7c74e166b0 accounts: fix megacheck warnings (#14903)
* accounts: fix megacheck warnings

* accounts: don't modify abi in favor of full cleanup
2017-08-07 14:11:15 +03:00
Felix Lange
225de7ca0a tests: update tests and implement general state tests (#14734)
Tests are now included as a submodule. This should make updating easier
and removes ~60MB of JSON data from the working copy.

State tests are replaced by General State Tests, which run the same test
with multiple fork configurations.

With the new test runner, consensus tests are run as subtests by walking
json files. Many hex issues have been fixed upstream since the last
update and most custom parsing code is replaced by existing JSON hex
types. Tests can now be marked as 'expected failures', ensuring that
fixes for those tests will trigger an update to test configuration. The
new test runner also supports parallel execution and the -short flag.
2017-07-11 13:49:14 +02:00
Péter Szilágyi
72dd51e25a
accounts/keystore, crypto: don't enforce key checks on existing keyfiles 2017-06-01 11:11:06 +03:00
Péter Szilágyi
aa73420207
accounts/keystore, crypto: enforce 256 bit keys on import 2017-05-23 14:58:03 +03:00
Felix Lange
0cc492f815 all: update license information 2017-04-14 10:29:00 +02:00
Péter Szilágyi
94c71c171f Merge pull request #3723 from karalabe/logger-updates-2
Logger updates
2017-02-28 16:55:37 +02:00
Felix Lange
5f7826270c all: unify big.Int zero checks, use common/math in more places (#3716)
* common/math: optimize PaddedBigBytes, use it more

name              old time/op    new time/op    delta
PaddedBigBytes-8    71.1ns ± 5%    46.1ns ± 1%  -35.15%  (p=0.000 n=20+19)

name              old alloc/op   new alloc/op   delta
PaddedBigBytes-8     48.0B ± 0%     32.0B ± 0%  -33.33%  (p=0.000 n=20+20)

* all: unify big.Int zero checks

Various checks were in use. This commit replaces them all with Int.Sign,
which is cheaper and less code.

eg templates:

    func before(x *big.Int) bool { return x.BitLen() == 0 }
    func after(x *big.Int) bool  { return x.Sign() == 0 }

    func before(x *big.Int) bool { return x.BitLen() > 0 }
    func after(x *big.Int) bool  { return x.Sign() != 0 }

    func before(x *big.Int) int { return x.Cmp(common.Big0) }
    func after(x *big.Int) int  { return x.Sign() }

* common/math, crypto/secp256k1: make ReadBits public in package math
2017-02-28 15:09:11 +01:00
Péter Szilágyi
e588e0ca2b
all: next batch of log polishes to contextual versions 2017-02-28 15:03:20 +02:00
Péter Szilágyi
46eea4d105
accounts, eth/downloader: use "err" instead of "error" in logs 2017-02-27 13:17:58 +02:00
Péter Szilágyi
23a5d64fd0
accounts, cmd: port packages over to the new logging system 2017-02-23 12:16:46 +02:00
Péter Szilágyi
d4fd06c3dc
all: blidly swap out glog to our log15, logs need rework 2017-02-23 12:16:44 +02:00