Skip to content

Commit

Permalink
make fake tx in arbitrumSigner.SignatureValues, add comment in .Sender
Browse files Browse the repository at this point in the history
  • Loading branch information
magicxyyz committed Jan 13, 2024
1 parent 2cf65c2 commit 7594ef3
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions core/types/arbitrum_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (s arbitrumSigner) Sender(tx *Transaction) (common.Address, error) {
case *ArbitrumSubtypedTx:
switch inner.TxData.(type) {
case *ArbitrumTippingTx:
// same as in londonSigner.Sender for DynamicFeeTx,
// but use arbitrumSigner.Hash to include tx subtype in the hashed data

V, R, S := tx.RawSignatureValues()
// DynamicFee txs are defined to use 0 and 1 as their recovery
// id, add 27 to become equivalent to unprotected Homestead signatures.
Expand Down Expand Up @@ -85,14 +88,8 @@ func (s arbitrumSigner) SignatureValues(tx *Transaction, sig []byte) (R, S, V *b
case *ArbitrumSubtypedTx:
switch txdata := inner.TxData.(type) {
case *ArbitrumTippingTx:
// Check that chain ID of tx matches the signer. We also accept ID zero here,
// because it indicates that the chain ID was not specified in the tx.
if txdata.ChainID.Sign() != 0 && txdata.ChainID.Cmp(s.Signer.ChainID()) != 0 {
return nil, nil, nil, fmt.Errorf("%w: have %d want %d", ErrInvalidChainId, txdata.ChainID, s.Signer.ChainID())
}
R, S, _ = decodeSignature(sig)
V = big.NewInt(int64(sig[64]))
return R, S, V, nil
fakeTx := NewTx(&txdata.DynamicFeeTx)
return s.Signer.SignatureValues(fakeTx, sig)
default:
return nil, nil, nil, ErrTxTypeNotSupported
}
Expand Down

0 comments on commit 7594ef3

Please sign in to comment.