From 7d723ed3b7f929b99fe8d65c69c967820099d50b Mon Sep 17 00:00:00 2001 From: Matthew Slipper Date: Thu, 12 May 2022 13:32:41 -0600 Subject: [PATCH] Don't panic on deposit transaction signature values (#18) * Don't panic on deposit transaction signature values Instead of panicking on `rawSignatureValues`, return zero for V, R, and S. Panicking in those methods breaks users of the Go client like Hive, since transaction serialization calls `rawSignatureValues` under the hood. * Code review updates * Don't panic on chain ID too --- core/types/deposit_tx.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/types/deposit_tx.go b/core/types/deposit_tx.go index 54779cb119a2..00d73c32b1db 100644 --- a/core/types/deposit_tx.go +++ b/core/types/deposit_tx.go @@ -66,7 +66,7 @@ const DepositsNonce uint64 = 0xffff_ffff_ffff_fffd // accessors for innerTx. func (tx *DepositTx) txType() byte { return DepositTxType } -func (tx *DepositTx) chainID() *big.Int { panic("deposits are not signed and do not have a chain-ID") } +func (tx *DepositTx) chainID() *big.Int { return common.Big0 } func (tx *DepositTx) protected() bool { return true } func (tx *DepositTx) accessList() AccessList { return nil } func (tx *DepositTx) data() []byte { return tx.Data } @@ -79,9 +79,9 @@ func (tx *DepositTx) nonce() uint64 { return DepositsNonce } func (tx *DepositTx) to() *common.Address { return tx.To } func (tx *DepositTx) rawSignatureValues() (v, r, s *big.Int) { - panic("deposit tx does not have a signature") + return common.Big0, common.Big0, common.Big0 } func (tx *DepositTx) setSignatureValues(chainID, v, r, s *big.Int) { - panic("deposit tx does not have a signature") + // this is a noop for deposit transactions }