dominant-strategies / go-quai

Official Go Implementation of the Quai Network
GNU General Public License v3.0
2.38k stars 466 forks source link

Update RPC to use Proto definitions for JSON (Block and Header changes) #2039

Closed mibuono closed 1 month ago

gameofpointers commented 2 months ago

Here's our RPC typing proposal: https://docs.google.com/document/d/1HVyvg6Ka91HWsJvvzqvg23I9FKjKXCMOGKMX8QCOVHw/edit

I've attached examples of each of the proposed changes in JSON

gameofpointers commented 2 months ago

After some investigation, what I can confirm is that, we cannot use the protojson library to convert the ProtoMessage to Json formatted output. Because, 1) It turns out the authors of the repo from google, dont want people building on it, so they introduce inconsistencies in the json output. Thus it is not useful for encoding and decoding in json reliably. 2) Library is that it encodes the values into base64, and that cannot be changed and our RPC outputs have a hex reliance.

Thus only way we can move forward with using proto as a json encoding is if we can find a reliable library that does this and lets us also have hex encoding.

gameofpointers commented 2 months ago

I confirmed with @kiltsonfire and we will make the changes suggested in the google doc but use the existing marshling techniques to make the changes.

gameofpointers commented 1 month ago

This PR has been merged, only things that is left is the transaction fields clean up which is coming with the gas price