Skip to content

Commit

Permalink
Don't panic on deposit transaction signature values (ethereum#18)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mslipper authored and protolambda committed Nov 4, 2022
1 parent 80d26e9 commit 7d723ed
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/types/deposit_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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
}

0 comments on commit 7d723ed

Please sign in to comment.