Commit Graph

116 Commits

Author SHA1 Message Date
Lindlof
4c15d58007
internal/ethapi, signer/core: fix documentation-links (#28979)
fix: management api links
2024-02-13 10:14:18 +01:00
Dimitris Apostolou
8fd43c8013
all: fix typos in comments (#28881) 2024-02-05 22:16:32 +01:00
Taeguk Kwon
09e0208029
accounts,signer: fix typos in comments (#28730) 2023-12-28 11:46:51 +01:00
jwasinger
28e7371701
all: replace log15 with slog (#28187)
This PR replaces Geth's logger package (a fork of [log15](https://github.com/inconshreveable/log15)) with an implementation using slog, a logging library included as part of the Go standard library as of Go1.21.

Main changes are as follows:
* removes any log handlers that were unused in the Geth codebase.
* Json, logfmt, and terminal formatters are now slog handlers.
* Verbosity level constants are changed to match slog constant values.  Internal translation is done to make this opaque to the user and backwards compatible with existing `--verbosity` and `--vmodule` options.
* `--log.backtraceat` and `--log.debug` are removed.

The external-facing API is largely the same as the existing Geth logger.  Logger method signatures remain unchanged.

A small semantic difference is that a `Handler` can only be set once per `Logger` and not changed dynamically.  This just means that a new logger must be instantiated every time the handler of the root logger is changed.

----
For users of the `go-ethereum/log` module. If you were using this module for your own project, you will need to change the initialization. If you previously did 
```golang
log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stderr, log.TerminalFormat(true))))
```
You now instead need to do 
```golang
log.SetDefault(log.NewLogger(log.NewTerminalHandlerWithLevel(os.Stderr, log.LevelInfo, true)))
```
See more about reasoning here: https://github.com/ethereum/go-ethereum/issues/28558#issuecomment-1820606613
2023-11-29 08:33:50 +01:00
Håvard Anda Estensen
77cb21da2c
signer: run tests in parallel (#28536)
marks tests as parallel-safe in package signer
2023-11-20 08:20:59 +01:00
Felix Lange
9b46986edc
all: use rlp.DecodeBytes instead of rlp.Decode where possible (#27994) 2023-08-24 11:47:42 +03:00
John Chase
ab0e0f3517
signer/core: show helptext when clef rejects signing (#27538)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-07-06 03:50:44 -04:00
Delweng
dd25a4f5ab
les, signer, light: replace noarg fmt.Errorf with errors.New (#27336)
Signed-off-by: jsvisa <delweng@gmail.com>
2023-05-25 02:51:13 -04:00
s7v7nislands
ffda2c64c4
rpc: use atomic types (#27214)
rpc: use atomic type
2023-05-04 04:54:45 -04:00
Taeguk Kwon
bedf2856d1
signer/core: rename testdata files (#27063)
Sets a meaningful name on test-files
2023-04-17 10:36:47 -04:00
rjl493456442
94457cce07
cmd, miner, signer: avoid panic if keystore is not available (#27039)
* cmd, miner, singer: avoid panic if keystore is not available

* cmd/geth: print warning instead of panic
2023-04-03 05:08:06 -04:00
Daniel Fernandes
02796f6bee
signer/core: accept all solidity primitive types for EIP-712 signing (#26770)
Accept all primitive types in Solidity for EIP-712 from intN, uintN, intN[], uintN[] for N as 0 to 256 in multiples of 8

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2023-03-08 02:48:53 -05:00
Martin Holst Swende
4f4a25d79f
signer/core: don't require capital lettered reference types (#26462) 2023-01-20 12:01:33 +02:00
Martin Holst Swende
502fa829a6
signer/core: handle gnosis safe problem with missing chain id (#26309)
This PR adds a check that the safetxhash that we sign corresponds to the one that is expected by the input. If it differs, it tries again with the configured chainid.
2022-12-14 04:33:57 -05:00
Martin Holst Swende
6a4e05c93a
signer: enable typed data signing from signer rpc (#26241)
This PR should makes it easier to sign EIP-712 typed data via the accounts.Wallet API, by using the mimetype for typed data. 

Co-authored-by: nasdf <keenan.nemetz@gmail.com>
2022-11-25 09:13:45 +01:00
6xiaowu9
e76813eb13
signer/core/apitypes: deep convert types in slice (#26203) 2022-11-24 11:45:20 +01:00
Joseph Cook
6685f88455
cmd/clef: only print first N accounts on startup (#26128)
PR #26082 added account listing to OnSignerStartup but did not consider the case where a user has a large number of accounts which would be annoying to display.

This PR updates showAccounts() so that if there are more than 20 accounts available the user sees the first 20 displayed in the console followed by: First 20 accounts listed (N more available).

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-08 21:17:12 +01:00
Joseph Cook
55a92fa0a4
cmd/clef: list accounts at startup (#26082)
Reports accounts known to Clef during startup, after master seed is provided by the user.
2022-11-07 16:41:36 +01:00
Obtuse7772
6d55908347
signer/core/apitypes: support more input types for eip-712 encoding (#26074)
* apitypes: synchronize handling of types

* signer/core/apitypes: improve array check

* apitypes: add a test for big.Int -> int32

* signer/core/apitypes: Add a test for parsing addresses from [20]byte, []byte and string

* signer/core/apitypes: add some testcases

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-11-04 16:28:12 +01:00
Martin Holst Swende
5a02b2d6d0
all: fix spelling mistakes (#25961) 2022-10-11 09:37:00 +02:00
Felix Lange
b628d72766
build: upgrade to go 1.19 (#25726)
This changes the CI / release builds to use the latest Go version. It also
upgrades golangci-lint to a newer version compatible with Go 1.19.

In Go 1.19, godoc has gained official support for links and lists. The
syntax for code blocks in doc comments has changed and now requires a
leading tab character. gofmt adapts comments to the new syntax
automatically, so there are a lot of comment re-formatting changes in this
PR. We need to apply the new format in order to pass the CI lint stage with
Go 1.19.

With the linter upgrade, I have decided to disable 'gosec' - it produces
too many false-positive warnings. The 'deadcode' and 'varcheck' linters
have also been removed because golangci-lint warns about them being
unmaintained. 'unused' provides similar coverage and we already have it
enabled, so we don't lose much with this change.
2022-09-10 13:25:40 +02:00
Justin Traglia
2c5648d891
all: fix some typos (#25551)
* Fix some typos

* Fix some mistakes

* Revert 4byte.json

* Fix an incorrect fix

* Change files to fails
2022-08-19 09:00:21 +03:00
Martin Holst Swende
1a18c14c43
signer/rules: register clef api properly when rules are used (#25455)
signer/rules: register clef api properly when rules are used, fixes #25298
2022-08-10 09:31:15 +02:00
Delweng
b196ad1c16
all: add whitespace linter (#25312)
* golangci: typo

Signed-off-by: Delweng <delweng@gmail.com>

* golangci: add whietspace

Signed-off-by: Delweng <delweng@gmail.com>

* *: rm whitesapce using golangci-lint

Signed-off-by: Delweng <delweng@gmail.com>

* cmd/puppeth: revert accidental resurrection

Co-authored-by: Péter Szilágyi <peterke@gmail.com>
2022-07-25 13:14:03 +03:00
Nikhil Suri
ba3919cac6
signer/core: add canonical TypedData hashing methods (#25283) 2022-07-22 09:53:35 +02:00
スパイク
55f914a1d7
signer/core/apitypes: support primitive types int96/uint96 (#25105)
I have a EIP712 typehash using uint96, but it's currently not supported
by go-ethereum. This change fixes it.
2022-07-04 15:01:07 +02:00
Seungbae.yu
2697e44d81
all: change format 0x%x to %#x (#25221) 2022-07-04 11:03:32 +03:00
lmittmann
bc013bc42e
all: prefer new(big.Int) over big.NewInt(0) (#25087)
minor performance improvement: `big.NewInt(0).Xxx` -> `new(big.Int).Xxx`
2022-06-14 15:09:48 +03:00
s7v7nislands
6ad620d642
cmd/ethkey: use accounts.TextHash (#25069) 2022-06-14 13:47:11 +02:00
Felix Lange
9244d5cd61
all: update license headers and AUTHORS from git history (#24947) 2022-05-24 20:39:40 +02:00
jwasinger
3ff479bc94
signer/core: always pad clique header extra data with space for sealer's signature (#24941)
* signer/core: always pad clique header extra data with space for sealer's signature

* capitalize comment
2022-05-24 10:18:03 +02:00
Håvard Anda Estensen
4b309c7006
all: replace non-trivial uses of package ioutil with os (#24886)
Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-05-17 14:27:04 +02:00
Håvard Anda Estensen
07508ac0e9
all: replace uses of ioutil with io and os (#24869) 2022-05-16 11:59:35 +02:00
Martin Holst Swende
91751cbaa7
signer/fourbyte: remove offending signatures (#24842) 2022-05-10 13:54:11 +02:00
Martin Holst Swende
1b26991bec
signer/fourbyte: import new signatures (#22865) 2022-05-06 16:12:06 +02:00
s7v7nislands
7ab15490e9
all: use 'embed' instead of go-bindata (#24744) 2022-04-25 11:15:14 +02:00
ucwong
d4d288e3f1
build: add imports for go generate tools (#24682)
This adds a tools.go file to import all command packages used for
go:generate. Doing so makes it possible to execute go-based code
generators using 'go run', locking in the tool version using go.mod.

Co-authored-by: Felix Lange <fjl@twurst.com>
2022-04-12 20:24:02 +02:00
Eng Zer Jun
8d066f1f42
all: use T.TempDir to create temporary test directories (#24633)
This commit replaces ioutil.TempDir with t.TempDir in tests. The
directory created by t.TempDir is automatically removed when the test
and all its subtests complete.

Prior to this commit, temporary directory created using ioutil.TempDir
had to be removed manually by calling os.RemoveAll, which is omitted in
some tests. The error handling boilerplate e.g.

	defer func() {
		if err := os.RemoveAll(dir); err != nil {
			t.Fatal(err)
		}
	}

is also tedious, but t.TempDir handles this for us nicely.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-04-08 15:44:55 +02:00
Daniel Perez
37f9d25ba0
signer/fourbyte: add support for nested types in selectors (#24407)
This replaces the simple selector parser in signer/fourbyte with one that
can actually handle most types. The new parser is added in accounts/abi
to also make it useable elsewhere.
2022-03-04 13:39:09 +01:00
Martin Holst Swende
5a0d487c3b
signer/core: fix complex typed data sign (EIP712) (#24220)
Co-authored-by: specerxi <xhxpecer@gmail.com>
2022-02-08 14:40:00 +01:00
Shihao Xia
eef7a33135
core, miner, rpc, eth: fix goroutine leaks in tests (#24211)
* fix blocking and non-blocking issues

* core: revert change in blockchain.go

Co-authored-by: Martin Holst Swende <martin@swende.se>
2022-01-21 12:22:44 +01:00
Felix Lange
5bcbb2980b
rpc: add PeerInfo (#24255)
This replaces the sketchy and undocumented string context keys for HTTP requests
with a defined interface. Using string keys with context is discouraged because
they may clash with keys created by other packages.

We added these keys to make connection metadata available in the signer, so this
change also updates signer/core to use the new PeerInfo API.
2022-01-20 12:45:07 +01:00
Mikhail Mikheev
7dec26db2a
signer, core: support chainId for GnosisSafeTx (#24231) 2022-01-18 13:31:25 +01:00
Martin Holst Swende
619a3e7085
signer/core: move EIP-712 types to package apitypes (#24029)
Fixes #23972
2021-12-05 14:31:41 +01:00
Iskander (Alex) Sharipov
778ff94794
all: fix some go-critic linter warnings (#23709)
This doesn't fix all go-critic warnings, just the most serious ones.

Co-authored-by: Felix Lange <fjl@twurst.com>
Co-authored-by: Martin Holst Swende <martin@swende.se>
2021-10-13 17:31:02 +02:00
Felix Lange
f9d683b07f
go.mod: upgrade goja (#23721)
This update adds support for some more ES6 functionality, notably
arrow functions.
2021-10-13 14:42:00 +02:00
Felix Lange
bb1f7ebf20
signer/core/apitypes: remove dependency on internal/ethapi (#23362) 2021-08-23 12:20:56 +02:00
Martin Holst Swende
295bc35ecf
signer/core: move API JSON types to separate package (#23275)
This PR moves (some) account types into a standalone package, to avoid
depending on signer/core from accounts/external.
2021-07-29 16:06:44 +02:00
Martin Holst Swende
7a00378e2b
cmd/clef, signer: support for eip-1559 txs in clef (#22966) 2021-06-09 13:48:47 +02:00
Martin Holst Swende
67da83aca5
accounts/external, signer/core: add support for EIP-2930 transactions (#22585)
This adds support for signing EIP-2930 with clef.
2021-04-21 13:03:33 +02:00