celestiaorg / celestia-node

Celestia Data Availability Nodes
Apache License 2.0
933 stars 928 forks source link

Serialization inconsistency between celestia-node API and Tendermint API #3918

Open oblique opened 2 weeks ago

oblique commented 2 weeks ago

Celestia Node version

ace6840bb00b337c320c07be4dbe10e4d853271d

OS

Arch Linux

Install tools

No response

Others

No response

Steps to reproduce it

Send header.GetByHeight request and /commit request.

Expected result

Both to be the same, preferably a string.

Actual result

In the header.GetByHeight response the Commit.Height is a number and in /commit response it is a string.

Relevant log output

No response

Is the node "stuck"? Has it stopped syncing?

No response

Notes

celestia-node API and Tendermint API have some types in common. One example is Commit type. However we noticed that their JSON serialization is not the same. For example Commit.Height when it used from celestia-node API is serialized as a number and as a string when it is used from Tendermint API.

We managed to find the root cause: Tendermint API uses a custom serializer which explicitly serializes int64/uint64 as strings, but celestia-node API does it only for ExtendedHeader.RawHeader and ExtendedHeader.ValidatorSet.

This inconsistency is a huge problem in Lumina because we can not control which serializer must be used in the jsonrpsee level.

We believe celestia-node API could also use the same serializer as Tendermint API.