@@ -190,7 +190,7 @@ func (s londonSigner) Sender(tx *Transaction) (common.Address, error) {
190190 // id, add 27 to become equivalent to unprotected Homestead signatures.
191191 V = new (big.Int ).Add (V , big .NewInt (27 ))
192192 if tx .ChainId ().Cmp (s .chainId ) != 0 {
193- return common.Address {}, ErrInvalidChainId
193+ return common.Address {}, fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId (), s . chainId )
194194 }
195195 return recoverPlain (s .Hash (tx ), R , S , V , true )
196196}
@@ -208,7 +208,7 @@ func (s londonSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *big
208208 // Check that chain ID of tx matches the signer. We also accept ID zero here,
209209 // because it indicates that the chain ID was not specified in the tx.
210210 if txdata .ChainID .Sign () != 0 && txdata .ChainID .Cmp (s .chainId ) != 0 {
211- return nil , nil , nil , ErrInvalidChainId
211+ return nil , nil , nil , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , txdata . ChainID , s . chainId )
212212 }
213213 R , S , _ = decodeSignature (sig )
214214 V = big .NewInt (int64 (sig [64 ]))
@@ -270,7 +270,7 @@ func (s eip2930Signer) Sender(tx *Transaction) (common.Address, error) {
270270 return common.Address {}, ErrTxTypeNotSupported
271271 }
272272 if tx .ChainId ().Cmp (s .chainId ) != 0 {
273- return common.Address {}, ErrInvalidChainId
273+ return common.Address {}, fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId (), s . chainId )
274274 }
275275 return recoverPlain (s .Hash (tx ), R , S , V , true )
276276}
@@ -283,7 +283,7 @@ func (s eip2930Signer) SignatureValues(tx *Transaction, sig []byte) (R, S, V *bi
283283 // Check that chain ID of tx matches the signer. We also accept ID zero here,
284284 // because it indicates that the chain ID was not specified in the tx.
285285 if txdata .ChainID .Sign () != 0 && txdata .ChainID .Cmp (s .chainId ) != 0 {
286- return nil , nil , nil , ErrInvalidChainId
286+ return nil , nil , nil , fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , txdata . ChainID , s . chainId )
287287 }
288288 R , S , _ = decodeSignature (sig )
289289 V = big .NewInt (int64 (sig [64 ]))
@@ -364,7 +364,7 @@ func (s EIP155Signer) Sender(tx *Transaction) (common.Address, error) {
364364 return HomesteadSigner {}.Sender (tx )
365365 }
366366 if tx .ChainId ().Cmp (s .chainId ) != 0 {
367- return common.Address {}, ErrInvalidChainId
367+ return common.Address {}, fmt . Errorf ( "%w: have %d want %d" , ErrInvalidChainId , tx . ChainId (), s . chainId )
368368 }
369369 V , R , S := tx .RawSignatureValues ()
370370 V = new (big.Int ).Sub (V , s .chainIdMul )
0 commit comments