mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2025-01-03 09:17:38 +00:00
core/types: fix unmarshalling of BlobTx values (#27939)
FromBig returns true *when overflow occurs*
This commit is contained in:
parent
386cba15b5
commit
a3e35414b7
@ -373,20 +373,20 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
|||||||
itx.BlobHashes = dec.BlobVersionedHashes
|
itx.BlobHashes = dec.BlobVersionedHashes
|
||||||
|
|
||||||
// signature R
|
// signature R
|
||||||
var ok bool
|
var overflow bool
|
||||||
if dec.R == nil {
|
if dec.R == nil {
|
||||||
return errors.New("missing required field 'r' in transaction")
|
return errors.New("missing required field 'r' in transaction")
|
||||||
}
|
}
|
||||||
itx.R, ok = uint256.FromBig((*big.Int)(dec.R))
|
itx.R, overflow = uint256.FromBig((*big.Int)(dec.R))
|
||||||
if !ok {
|
if overflow {
|
||||||
return errors.New("'r' value overflows uint256")
|
return errors.New("'r' value overflows uint256")
|
||||||
}
|
}
|
||||||
// signature S
|
// signature S
|
||||||
if dec.S == nil {
|
if dec.S == nil {
|
||||||
return errors.New("missing required field 's' in transaction")
|
return errors.New("missing required field 's' in transaction")
|
||||||
}
|
}
|
||||||
itx.S, ok = uint256.FromBig((*big.Int)(dec.S))
|
itx.S, overflow = uint256.FromBig((*big.Int)(dec.S))
|
||||||
if !ok {
|
if overflow {
|
||||||
return errors.New("'s' value overflows uint256")
|
return errors.New("'s' value overflows uint256")
|
||||||
}
|
}
|
||||||
// signature V
|
// signature V
|
||||||
@ -394,8 +394,8 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
itx.V, ok = uint256.FromBig(vbig)
|
itx.V, overflow = uint256.FromBig(vbig)
|
||||||
if !ok {
|
if overflow {
|
||||||
return errors.New("'v' value overflows uint256")
|
return errors.New("'v' value overflows uint256")
|
||||||
}
|
}
|
||||||
if itx.V.Sign() != 0 || itx.R.Sign() != 0 || itx.S.Sign() != 0 {
|
if itx.V.Sign() != 0 || itx.R.Sign() != 0 || itx.S.Sign() != 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user