Fix Up READMEs for Mainnet (#7910)

* fix up readmes

* Update README.md

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>

Co-authored-by: Preston Van Loon <preston@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
Raul Jordan
2020-11-23 12:47:55 -06:00
committed by GitHub
parent 8c3faaa4c7
commit b0dfc46603
12 changed files with 40 additions and 230 deletions

55
third_party/README.md vendored
View File

@@ -59,58 +59,3 @@ go_repository(
Now, when used in Prysm, the dependency you patched will have the patched modifications
when you run your code.
## Ethereum APIs Patch
As mentioned earlier, patches aren't a recommended approach when needing to modify dependencies
in Prysm save for a few use cases. In particular, all of our public APIs and most canonical
data structures for Prysm are kept in the [Ethereum APIs](https://github.com/prysmaticlabs/ethereumapis) repo.
The purpose of the repo is to serve as a well-documented, well-maintained schema for a full-featured
eth2 API. It is written in protobuf format, and specifies JSON over HTTP mappings as well
as a [Swagger API](https://api.prylabs.network) front-end configuration.
The Prysm repo specifically requires its data structures to have certain struct tags
for serialization purposes as well as other package-related annotations for proper functionality.
Given a protobuf schema is meant to be generic, easily readable, accessible, and language agnostic
(at least for languages which support protobuf generation), it would be wrong for us to include
Go-specific annotations in the Ethereum APIs repo. Instead of maintaining a duplicate of it
within Prysm, we can apply a patch to include those struct tags as needed, while being able
to use the latest changes in the Ethereum APIs repo. This is an appropriate use-case for a patch.
Here's an example:
```
// The block body of an Ethereum 2.0 beacon block.
message BeaconBlockBody {
// The validators RANDAO reveal 96 byte value.
- bytes randao_reveal = 1;
+ bytes randao_reveal = 1 [(gogoproto.moretags) = "ssz-size:\"96\""];
// A reference to the Ethereum 1.x chain.
Eth1Data eth1_data = 2;
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
- bytes graffiti = 3;
+ bytes graffiti = 3 [(gogoproto.moretags) = "ssz-size:\"32\""];
...
}
```
Above, we're telling Prysm to patch a few lines to include protobuf tags
for SSZ (the serialization library used by Prysm).
## Updating Patches
Say we want to update Ethereum APIs in Prysm to its latest master commit `b7452dde4ca361809def4ed5924ab3cb7ad1299a`.
Here are the steps:
1. Go to your Prysm WORKSPACE and look at the commit in there for Ethereum APIs, say it's `e6f60041667fbc3edb22b03735ec111d1a40cd0e`
2. Go to Ethereum APIs and do `git checkout e6f60041667fbc3edb22b03735ec111d1a40cd0e`
3. In the Ethereum APIs repo, do `git apply $GOPATH/src/github.com/prysmaticlabs/prysm/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch`
4. Make any changes you want to make in Ethereum APIs, such as applying ssz struct tags, etc.
5. In the Ethereum APIs repo, do `git commit -m "applied patch and changes"`
6. Do `git merge master`
7. Generate a new diff and update the diff in Prysm `git diff b7452dde4ca361809def4ed5924ab3cb7ad1299a > $GOPATH/src/github.com/prysmaticlabs/prysm/third_party/com_github_prysmaticlabs_ethereumapis-tags.patch`
8. Update the commit in the Prysm WORKSPACE file for Ethereum APIs to `b7452dde4ca361809def4ed5924ab3cb7ad1299a`
9. Build the Prysm project