From 19b33c67743b2b87004ee48e89a2f345f976af99 Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 24 May 2022 05:59:47 +0000 Subject: [PATCH 1/2] signer/core: always pad clique header extra data with space for sealer's signature --- signer/core/signed_data.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index 03494c098d46..ba269f1d8f93 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -147,13 +147,11 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType if err := rlp.DecodeBytes(cliqueData, header); err != nil { return nil, useEthereumV, err } - // The incoming clique header is already truncated, sent to us with a extradata already shortened - if len(header.Extra) < 65 { - // Need to add it back, to get a suitable length for hashing - newExtra := make([]byte, len(header.Extra)+65) - copy(newExtra, header.Extra) - header.Extra = newExtra - } + // add space in the extradata to put the signature + newExtra := make([]byte, len(header.Extra)+65) + copy(newExtra, header.Extra) + header.Extra = newExtra + // Get back the rlp data, encoded by us sighash, cliqueRlp, err := cliqueHeaderHashAndRlp(header) if err != nil { From a9f180da398dad43aebf8f1907320873a9621e7c Mon Sep 17 00:00:00 2001 From: Jared Wasinger Date: Tue, 24 May 2022 07:57:48 +0000 Subject: [PATCH 2/2] capitalize comment --- signer/core/signed_data.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/signer/core/signed_data.go b/signer/core/signed_data.go index ba269f1d8f93..9bf47be799d8 100644 --- a/signer/core/signed_data.go +++ b/signer/core/signed_data.go @@ -147,7 +147,7 @@ func (api *SignerAPI) determineSignatureFormat(ctx context.Context, contentType if err := rlp.DecodeBytes(cliqueData, header); err != nil { return nil, useEthereumV, err } - // add space in the extradata to put the signature + // Add space in the extradata to put the signature newExtra := make([]byte, len(header.Extra)+65) copy(newExtra, header.Extra) header.Extra = newExtra