-
Notifications
You must be signed in to change notification settings - Fork 20.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clef: make external signing work + follow up fixes #19003
Conversation
…ounts_sign take hexdata
…ue signing in clef
Output on clef-side when running the script
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple nitpicks
cmd/clef/intapi_changelog.md
Outdated
@@ -1,8 +1,15 @@ | |||
### Changelog for internal API (ui-api) | |||
|
|||
### 3.2.0 | |||
|
|||
* Make `ShowError`, `OnApprovedTx`, `OnSignerStartup` be json-rpc [notification](https://www.jsonrpc.org/specification#notification): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make ShowError
, OnApprovedTx
, AND OnSignerStartup
(remove be) json-rpc [notificationS]
@@ -1481,6 +1482,42 @@ func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (stri | |||
return fmt.Sprintf("%x", encoded), nil | |||
} | |||
|
|||
// TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the | |||
// given address, returning the address of the recovered signature |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reminder: Peter said that this should be noted as TODO/to remove
signer/core/signed_data.go
Outdated
func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType string, addr common.MixedcaseAddress, data interface{}) (*SignDataRequest, bool, error) { | ||
var ( | ||
req *SignDataRequest | ||
useLegacyV = true // Default to use V = 27 or 28, the legacy Ethereum format |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per our conversation, let's use useEthereumV
or useCliqueV
as a name instead.
var tests = [ | ||
testTx, | ||
testSignText, | ||
testClique, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we also have tests to check the error conditions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there any particular error conditions you're thinking of?
I mean, there are quite a lot of ways for signing to fail. This js-test is meant as an integration test, to test the whole geth-external-ui and back again flow.
It's not for CI, but for a dev to run manually to test things more easily.
Individual tests within signer/clef should test things like rejection and tx validation etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking of the 27/28 vs 0/1 in particular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, added for transactions. For clique, the new debug endpoint will deliver the derived signer. And if the wrong v-type is used, it will derive another address as sealer of that block.
So the js-test already checks that the requested signer-address equals what the endpoint returns, thus checks that the geth and clef are in agreement (without explicitly checking v
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* signer/clef: make use of json-rpc notification * signer: tidy up output of OnApprovedTx * accounts/external, signer: implement remote signing of text, make accounts_sign take hexdata * clef: added basic testscript * signer, external, api: add clique signing test to debug rpc, fix clique signing in clef * signer: fix clique interoperability between geth and clef * clef: rename networkid switch to chainid * clef: enable chainid flag * clef, signer: minor changes from review * clef: more tests for signer
This is a follow-up PR to fix issues after the merging of external-signer, bidirectional communication and implementation of eip 712/192.
It contains
%q
)--networkid
into--chainid
One thing still remaining is to display remote and local address for ipc communication, but that can be left for a later PR.