ethereum / portal-network-specs

Official repository for specifications for the Portal Network
313 stars 85 forks source link

Add specification for Portal JSON-RPC #345

Open KolbyML opened 1 month ago

KolbyML commented 1 month ago

I am still working on this just getting it out there

KolbyML commented 1 month ago

I do think it would be nicer if we can get this all on one place/page, i.e. within the json-rpc specifications that get generated. But I do understand that this could be more work.

As example, the beacon api has very rich explanations on all of their calls: https://ethereum.github.io/beacon-APIs/

I don't think that is as detailed for implementations as the specification for the engine_api is. https://ethereum.github.io/beacon-APIs/ is more user focused, where this documentation I am building is more implementor focused

The engine_api has both a user facing https://ethereum.github.io/beacon-APIs/ and a developer-facing specification which goes into how RPC endpoints should behave which is more developer focused

bhartnett commented 1 month ago

We have recently reviewed and updated the validation of the state portal JSON-RPC endpoints and this is what we implemented based on what intuitively made sense:

This was just our initial intuition of what seems like be a good implementation and perhaps the spec could head in this direction. I think we need to be clear what we mean by validation in the spec as well because the ones that can be done without network look ups should probably still be required by the spec.

kdeme commented 1 month ago

The engine_api has both a user facing https://ethereum.github.io/beacon-APIs/ and a developer-facing specification which goes into how RPC endpoints should behave which is more developer focused

I assume you meant to link https://github.com/ethereum/execution-apis/tree/main/src/engine. But yes, good point on user vs implementer docs, I didn't look at it with this differentiation. Perhaps that should be made clear also.

But I do think that in some cases you can just write it differently in the "users" specification because it is still very useful information to the user in the end. E.g. Implementer doc/spec would say: "Data MUST be validated by its hash before returning" User doc/spec: "Returned data is validated by its hash"

By the way, https://ethereum.github.io/beacon-APIs/ is quite detailed also, especially if you start looking into the validator API.