Commit Graph

133 Commits

Author SHA1 Message Date
Martin HS a5f0001845
cmd/geth: remove unlock commandline flag (#30737)
This is one further step towards removing account management from
`geth`. This PR deprecates the flag `unlock`, and makes the flag moot:
unlock via geth is no longer possible.
2024-11-15 10:15:15 +01:00
Naveen 5b78aef009
signer/core: extended support for EIP-712 array types (#30620)
This change updates the EIP-712 implementation to resolve [#30619](https://github.com/ethereum/go-ethereum/issues/30619).

The test cases have been repurposed from the ethers.js [repository](https://github.com/ethers-io/ethers.js/blob/main/testcases/typed-data.json.gz), but have been updated to remove tests that don't have a valid domain separator; EIP-712 messages without a domain separator are not supported by geth.

---------

Co-authored-by: Martin Holst Swende <martin@swende.se>
2024-11-08 15:04:17 +01:00
Martin HS f3b4bbbaf3
all: remove `personal` RPC namespace (#30704)
This PR is a first step towards removing account management from geth,
and contains a lot of the user-facing changes.

With this PR, the `personal` namespace disappears. **Note**: `personal`
namespace has been deprecated for quite some time (since
https://github.com/ethereum/go-ethereum/pull/26390 1 year and 8 months
ago), and users who have wanted to use it has been forced to used the
flag `--rpc.enabledeprecatedpersonal`. So I think it's fairly
non-controversial to drop it at this point.

Specifically, this means: 

- Account/wallet listing
  -`personal.getListAccounts`  
  -`personal.listAccounts`     
  -`personal.getListWallets`   
  -`personal.listWallets`      
- Lock/unlock
  -`personal.lockAccount`      
  -`personal.openWallet`       
  -`personal.unlockAccount`
- Sign ops
  -`personal.sign`             
  -`personal.sendTransaction`  
  -`personal.signTransaction`  
- Imports / inits
  -`personal.deriveAccount`    
  -`personal.importRawKey`     
  -`personal.initializeWallet` 
  -`personal.newAccount`       
  -`personal.unpair` 
- Other: 
  -`personal.ecRecover`        


The underlying keystores and account managent code is still in place,
which means that `geth --dev` still works as expected, so that e.g. the
example below still works:

```
> eth.sendTransaction({data:"0x6060", value: 1, from:eth.accounts[0]})
```	

Also, `ethkey` and `clef` are untouched. 

With the removal of `personal`, as far as I know we have no more API
methods which contain credentials, and if we want to implement
logging-capabilities of RPC ingress payload, it would be possible after
this.

---------

Co-authored-by: Felix Lange <fjl@twurst.com>
2024-10-31 19:53:35 +01:00
markus ea3b5095f4
signer/core/apitypes: support fixed size arrays for EIP-712 typed data (#30175)
When attempting to hash a typed data struct that includes a type
reference with a fixed-size array, the validation process fails.
According to EIP-712, arrays can be either fixed-size or dynamic,
denoted by `Type[n]` or `Type[]` respectively, although it appears this
currently isn't supported.

This change modifies  the validation logic to accommodate types
containing fixed-size arrays.
2024-08-28 14:12:09 +02:00
llkhacquan 978041feea
signer/core: improve performance of isPrimitiveTypeValid function (#30274) (#30277)
Precomputes valid primitive types into a map to use for validation, thus removing sprintf.
2024-08-08 09:13:18 +02:00
Felix Lange 1e97148249
all: fix inconsistent receiver name and add lint rule for it (#29974)
* .golangci.yml: enable check for consistent receiver name

* beacon/light/sync: fix receiver name

* core/txpool/blobpool: fix receiver name

* core/types: fix receiver name

* internal/ethapi: use consistent receiver name 'api' for handler object

* signer/core/apitypes: fix receiver name

* signer/core: use consistent receiver name 'api' for handler object

* log: fix receiver name
2024-06-12 10:45:42 +03:00
Aaron Chen 34aac1d756
all: use big.Sign to compare with zero (#29490) 2024-04-09 12:14:30 +02:00
Aaron Chen 70bf94c34e
internal, signer/core: replace path.Join with filepath.Join (#29489) 2024-04-09 08:22:53 +02:00
Aaron Chen cfc7d06cc9
signer/core/apitypes: use slices.Contains (#29474) 2024-04-08 12:58:37 +02:00
imalasong 0dc09da7db
all: replace path.Join with filepath.Join (#29479)
* core/rawdb: replace file.Join with filepath.Join

Signed-off-by: xiaochangbai <704566072@qq.com>

* internal/build: replace file.Join with filepath.Join

Signed-off-by: xiaochangbai <704566072@qq.com>

---------

Signed-off-by: xiaochangbai <704566072@qq.com>
2024-04-08 12:29:49 +03:00
Martin HS 4458905f26
signer/core/apitypes: fix apitypes breakage due to bitrotted PR (#29470) 2024-04-05 21:01:39 +02:00
Martin HS 7ee9a6e89f
signer: implement blob txs sendtxargs, enable blobtx-signing (#28976)
This change makes it possible to sign blob transactions
2024-04-05 19:29:44 +02:00
Aaron Chen 723b1e36ad
all: fix mismatched names in comments (#29348)
* all: fix mismatched names in comments

* metrics: fix mismatched name in UpdateIfGt
2024-03-26 21:01:28 +01:00
Martin HS d9bde37ac3
log: use native log/slog instead of golang/exp (#29302) 2024-03-22 13:17:59 +01:00
miles 45b88abbde
all: fix typos (#29288) 2024-03-20 08:49:38 +01:00
yzb db4cf69166
all: replace fmt.Errorf() with errors.New() if no param required (#29126)
replace-fmt-errorf

Co-authored-by: yzb@example.cn <yzb@example.cn>
2024-02-29 11:56:46 +02:00
cui fliter dbc27a199f
all: fix function names in docs (#29128)
Signed-off-by: cui fliter <imcusg@gmail.com>
2024-02-29 11:29:06 +02:00
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