You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@ancazamfir recently discovered that the Rust relayer would sometimes send malformed light blocks to the chain, eg. in a ClientUpdate message. The chain would then fail with the following error:
Because this field is part of the hash of the header, the chain would then compute a different hash than the commit's last_block_id_hash, yielding the error above.
The problem stems from the custom serde serializer for Time values, which is used by serde_cbor to encode the light blocks as a byte array before storing them in the sled-backed light store.
I have tracked this to the custom RFC3339 formatter which we use to format tendermint::Time via tendermint_proto::serializers::timestamp::Timestamp.
This function incorrectly trims the leading zeros of the nanoseconds digits, which would break the Time -> String -> Time roundtrip.
For example, the date "2021-01-06T21:50:58.067816Z" is serialized as "2021-01-06T21:50:58.67816Z", which then decodes to "2021-01-06T21:50:58.678160Z", shifting the leading zero to the end.
This explains why this error pops up non-deterministically, as it requires a light block whose time would feature one or more zeros in its subseconds digits for the formatting to break.
The text was updated successfully, but these errors were encountered:
romac
changed the title
Time values are not formatted properly, causing the light client to return malformed light blocksTime values are not always formatted correctly, causing the light client to someties return malformed light blocks
Jan 7, 2021
romac
changed the title
Time values are not always formatted correctly, causing the light client to someties return malformed light blocksTime values are not always formatted correctly, causing the light client to sometimes return malformed light blocks
Jan 7, 2021
This glitch was not caught by the Rust light client because light blocks are verified before they are stored in the light store (at which point they are serialized and the glitch occurs). On the other hand, the light client always fetches a block from the light store before returning it upon successful verification.
* Release v0.17.1
Mainly focuses on fixing #774.
Signed-off-by: Thane Thomson <[email protected]>
* Update release date in CHANGELOG
Signed-off-by: Thane Thomson <[email protected]>
* Fix year
It is 2021, even though it may not feel like it.
Signed-off-by: Thane Thomson <[email protected]>
* Update release date for v0.17.1
Signed-off-by: Thane Thomson <[email protected]>
@ancazamfir recently discovered that the Rust relayer would sometimes send malformed light blocks to the chain, eg. in a ClientUpdate message. The chain would then fail with the following error:
It appears that light blocks sometimes get corrupted when stored and retrieved from the LightStore, specifically the
signed_header.header.time
field:Because this field is part of the hash of the header, the chain would then compute a different hash than the commit's
last_block_id_hash
, yielding the error above.The problem stems from the custom
serde
serializer forTime
values, which is used byserde_cbor
to encode the light blocks as a byte array before storing them in thesled
-backed light store.I have tracked this to the custom RFC3339 formatter which we use to format
tendermint::Time
viatendermint_proto::serializers::timestamp::Timestamp
.This function incorrectly trims the leading zeros of the nanoseconds digits, which would break the
Time
-> String ->Time
roundtrip.For example, the date "2021-01-06T21:50:58.067816Z" is serialized as "2021-01-06T21:50:58.67816Z", which then decodes to "2021-01-06T21:50:58.678160Z", shifting the leading zero to the end.
This explains why this error pops up non-deterministically, as it requires a light block whose time would feature one or more zeros in its subseconds digits for the formatting to break.
The text was updated successfully, but these errors were encountered: