Closed mkoura closed 2 weeks ago
I can reproduce :+1:
Investigation:
updateProtocolParams
indeed contains a maxBlockerHeaderSize
of size 2160
.ghci> import Data.Word
ghci> read "-3161913232" :: Word16
2160
This is a known issue:
Trying possible fixes:
ghci> ((read "-31619132" :: Natural) & naturalToWordMaybe <&> fromIntegral) :: Maybe Word16
*** Exception: Prelude.read: no parse
Good :heavy_check_mark:
ghci> ((read "65537" :: Natural) & naturalToWordMaybe <&> fromIntegral) :: Maybe Word16
Just 1
Not good: 65537
doesn't fit in a Word16
An overflow is happening here (fromIntegral
is the crux of the problem again) :x:
toIntegralSized
seems to do the job:
ghci> ((65536 :: Word) & toIntegralSized) :: Maybe Word16
Nothing
ghci> ((65535 :: Word) & toIntegralSized) :: Maybe Word16
Just 65535
Description
When creating pparam update proposal, negative value overflows into positive value.
Steps to Reproduce
ie.
-3161913232
becomes2160
.Additional Context