livepeer / protocol

Livepeer protocol
MIT License
154 stars 45 forks source link

Auto-build and publish contract ABI npm and go packages upon mainnet and public testnet migrations #371

Open kyriediculous opened 4 years ago

kyriediculous commented 4 years ago

The protocol repo contains the contract ABIs after compiling the contracts. These ABIs are not only used within the protocol repo's truffle scripts but also in other client-side repos. This requires manual importing and more often than not more ABIs than necessary are imported.

We could add a script that build and publishes a new (or updated) npm package whenever we run mainnet or public testnet migrations. The public network builds would lead to a dev tagged package or something similar.

A first step could be to just consider the entire protocol repo as the npm package. For compiled javascript projects tree-shaking should be sufficient to avoid importing non-used ABIs in the build.

A second step could be to extract only the necessary ABIs into a very small package, this would require a little bit more work however.

We could do the same for a go package , running abigen and then publishing the generated files.

Alternatively we could use a CI tool to accomplish this but to avoid the built package being out of sync with the on-chain contracts it would require us to not merge changes into master before they are migrated on-chain.