sharding: added contributing.md and readings.md

Former-commit-id: c34ad3ffa9d2f5a92aab53f93ece82a1e6a15657 [formerly c10eec7a57773a322c996fb6275af6053f3d0a06]
Former-commit-id: b3dd4cc565a35ed4310d36ed20b158d3f6dad93e
This commit is contained in:
Raul Jordan
2018-05-29 16:26:13 -06:00
5 changed files with 135 additions and 32 deletions

View File

@@ -4,12 +4,14 @@
This is the main repository for the sharding implementation for the go-ethereum project by [Prysmatic Labs](https://prysmaticlabs.com). For the original, go-ethereum project, refer to the following [link](https://github.com/ethereum/go-ethereum).
Before you begin, check out our [Sharding Reference Implementation Doc](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/README.md). This doc serves as the single source of truth for our team, our milestones, and details on the different components of our architecture.
Interested in contributing? Check out our [Contribution Guidelines](#contribution-guidelines) and join our active chat room on Gitter below:
Before you begin, check out our [Contribution Guidelines](#contribution-guidelines) and join our active chat room on Gitter below:
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prysmaticlabs/geth-sharding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
Also, read our [Sharding Reference Implementation Doc](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/README.md). This doc serves as a source of truth for the sharding implementation we follow at Prysmatic Labs.
# Table of Contents
- [Installation](#installation)
@@ -19,7 +21,7 @@ Interested in contributing? Check out our [Contribution Guidelines](#contributio
- [Becoming a Notary](#becoming-a-notary)
- [Running a Collation Proposal Node](#running-a-collation-proposal-node)
- [Testing](#testing)
- [Contribution Guidelines](#contribution-guidelines)
- [Contributing](#contributing)
- [License](#license)
# Installation
@@ -148,28 +150,11 @@ go test github.com/ethereum/go-ethereum/sharding
We will require more complex testing scenarios (fuzz tests) to measure the full integrity of the system as it evolves.
# Contribution Guidelines
# Contributing
Excited by our work and want to get involved in building out our sharding releases? Our [Sharding Reference Implementation Doc](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/README.md) has all you need to know in order to begin helping us make this happen. We created this document as a single source of reference for all things related to sharding Ethereum, and we need as much help as we can get!
We have put all of our contribution guidelines into [CONTRIBUTING.md](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/CONTRIBUTING.md)! Check it out to get started.
You can explore our [Current Projects](https://github.com/prysmaticlabs/geth-sharding/projects) in-the works for the Ruby release. Each of the project boards contain a full collection of open and closed issues relevant to the different parts of our first implementation that we use to track our open source progress. Feel free to fork our repo and start creating PRs after assigning yourself to an issue of interest. We are always chatting on [Gitter](https://gitter.im/prysmaticlabs/geth-sharding), so drop us a line there if you want to get more involved or have any questions on our implementation!
**Contribution Steps**
- Create a folder in your `$GOPATH` and navigate to it `mkdir -p $GOPATH/src/github.com/ethereum && cd $GOPATH/src/github.com/ethereum`
- Clone our repository as `go-ethereum`, `git clone https://github.com/prysmaticlabs/geth-sharding ./go-ethereum`
- Fork the `go-ethereum` repository on Github: <https://github.com/ethereum/go-ethereum>
- Add a remote to your fork
\`git remote add YOURNAME <https://github.com/YOURNAME/go-ethereum>
Now you should have a remote pointing to the `origin` repo (geth-sharding) and to your forked, go-ethereum repo on Github. To commit changes and start a Pull Request, our workflow is as follows:
- Create a new branch with a clear feature name such as `git checkout -b collations-pool`
- Issue changes with clear commit messages
- Run the linter and CI tester as follows `go run build/ci.go test && go run build/ci.go lint`
- Push to your remote `git push YOURNAME collations-pool`
- Go to the [geth-sharding](https://github.com/prysmaticlabs/geth-sharding) repository on Github and start a PR comparing `geth-sharding:master` with `go-ethereum:collations-pool` (your fork on your profile).
- Add a clear PR title along with a description of what this PR encompasses, when it can be closed, and what you are currently working on. Github markdown checklists work great for this.
![nyancat](https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRBSus2ozk_HuGdHMHKWjb1W5CmwwoxmYIjIBmERE1u-WeONpJJXg)
# License

View File

@@ -338,6 +338,7 @@ func doLint(cmdline []string) {
"--enable=misspell",
"--enable=goconst",
"--min-occurrences=6", // for goconst
"--deadline=10m",
}
build.MustRunCommand(filepath.Join(GOBIN, "gometalinter.v2"), append(configs, packages...)...)

58
sharding/CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,58 @@
# Contribution Guidelines
Excited by our work and want to get involved in building out our sharding releases? Or maybe you haven't learned as much about the Ethereum protocol but are a savvy developer? Our [READINGS.md](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/READINGS.md) doc includes comprehensive information on Ethereum and sharding for both part-time and core contributors to the project.
Additionally, our [Sharding Reference Implementation Doc](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/README.md) serves source of truth for all things related to our implementation of sharding fo Ethereum.
You can explore our [Current Projects](https://github.com/prysmaticlabs/geth-sharding/projects) in-the works for our different releases. Feel free to fork our repo and start creating PRs after assigning yourself to an issue of interest. We are always chatting on [Gitter](https://gitter.im/prysmaticlabs/geth-sharding), so drop us a line there if you want to get more involved or have any questions on our implementation!
**Contribution Steps**
- Create a folder in your `$GOPATH` and navigate to it `mkdir -p $GOPATH/src/github.com/ethereum && cd $GOPATH/src/github.com/ethereum`
- Clone our repository as `go-ethereum`, `git clone https://github.com/prysmaticlabs/geth-sharding ./go-ethereum`
- Fork the `go-ethereum` repository on Github: <https://github.com/ethereum/go-ethereum>
- Add a remote to your fork
\`git remote add YOURNAME <https://github.com/YOURNAME/go-ethereum>
Now you should have a remote pointing to the `origin` repo (geth-sharding) and to your forked, go-ethereum repo on Github. To commit changes and start a Pull Request, our workflow is as follows:
- Create a new branch with a clear feature name such as `git checkout -b collations-pool`
- Issue changes with clear commit messages
- Run the linter and CI tester as follows `go run build/ci.go test && go run build/ci.go lint`
- Push to your remote `git push YOURNAME collations-pool`
- Go to the [geth-sharding](https://github.com/prysmaticlabs/geth-sharding) repository on Github and start a PR comparing `geth-sharding:master` with `go-ethereum:collations-pool` (your fork on your profile).
- Add a clear PR title along with a description of what this PR encompasses, when it can be closed, and what you are currently working on. Github markdown checklists work great for this.
## Contributor Responsibilities
We consider two types of contributions to our repo and categorize them as follows:
### Part-Time Contributors
Anyone can become a part-time contributor and help out on implementing sharding. The responsibilities of a part-time contributor include:
- Engaging in Gitter conversations, asking the questions on how to begin contributing to the project
- Opening up github issues to express interest in code to implement
- Opening up PRs referencing any open issue in the repo. PRs should include:
- Detailed context of what would be required for merge
- Tests that are consistent with how other tests are written in our implementation
- Proper labels, milestones, and projects (see other closed PRs for reference)
- Follow up on open PRs
- Have an estimated timeframe to completion and let the core contributors know if a PR will take longer than expected
We do not expect all part-time contributors to be experts on all the latest sharding documentation, but all contributors should at least be familiarized with our sharding [README.md](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/README.md) and have gone through the required Ethereum readings as posted on our [READINGS.md](https://github.com/prysmaticlabs/geth-sharding/blob/master/sharding/READINGS.md) document.
### Core Contributors
Core contributors are remote contractors of Prysmatic Labs, LLC. and are considered critical team members of our organization. Core devs have all of the responsibilities of part-time contributors plus the majority of the following:
- Stay up to date on the latest sharding posts on ETHResearch
- Monitor github issues and PRs to make sure owner, labels, descriptions are correct
- Formulate independent ideas, suggest new work to do, point out improvements to existing approaches
- Participate in code review, ensure code quality is excellent, and have ensure high code coverage
- Help with social media presence, write bi-weekly development update
- Represent Prysmatic Labs at events to help spread the word on scalability research and solutions
We love working with people that are autonomous, bring independent thoughts to the team, and are excited for their work! We believe in a merit-based approach to becoming a core contributor, and any part-time contributor that puts in the time, work, and drive can become a core member of our team.
![eth](https://steemitimages.com/DQmV1NASyCJYusDjY1WCvpoWiXh32HyumQHFQhY8zYZ6WDH/source.gif)

0
sharding/READINGS.md Normal file
View File

View File

@@ -73,8 +73,7 @@ func (s *smcTestHelper) fastForward(p int) {
}
}
// registerNotaries is a helper function register notaries in batch,
// it also verifies notary registration is successful.
// registerNotaries is a helper function register notaries in batch.
func (s *smcTestHelper) registerNotaries(deposit *big.Int, params ...int) error {
for i := params[0]; i < params[1]; i++ {
s.testAccounts[i].txOpts.Value = deposit
@@ -92,11 +91,26 @@ func (s *smcTestHelper) registerNotaries(deposit *big.Int, params ...int) error
"Got - deposited:%v, index:%v, period:%v ", i, notary.Deposited, notary.PoolIndex, notary.DeregisteredPeriod)
}
}
// Filter SMC logs by notaryRegistered.
log, err := s.smc.FilterNotaryRegistered(&bind.FilterOpts{})
if err != nil {
return err
}
// Iterate notaryRegistered logs, compare each address and poolIndex.
for i := 0; i < params[1]; i++ {
log.Next()
if log.Event.Notary != s.testAccounts[i].addr {
return fmt.Errorf("incorrect address in notaryRegistered log. Want: %v Got: %v", s.testAccounts[i].addr, log.Event.Notary)
}
// Verify notaryPoolIndex is incremental starting from 1st registered Notary.
if log.Event.PoolIndex.Cmp(big.NewInt(int64(i))) != 0 {
return fmt.Errorf("incorrect index in notaryRegistered log. Want: %v Got: %v", i, log.Event.Notary)
}
}
return nil
}
// deregisterNotaries is a helper function that deregister notaries in batch,
// it also verifies notary deregistration is successful.
// deregisterNotaries is a helper function that deregister notaries in batch.
func (s *smcTestHelper) deregisterNotaries(params ...int) error {
for i := params[0]; i < params[1]; i++ {
s.testAccounts[i].txOpts.Value = big.NewInt(0)
@@ -110,11 +124,28 @@ func (s *smcTestHelper) deregisterNotaries(params ...int) error {
return fmt.Errorf("Degistered period can not be 0 right after deregistration")
}
}
// Filter SMC logs by notaryDeregistered.
log, err := s.smc.FilterNotaryDeregistered(&bind.FilterOpts{})
if err != nil {
return err
}
// Iterate notaryDeregistered logs, compare each address, poolIndex and verify period is set.
for i := 0; i < params[1]; i++ {
log.Next()
if log.Event.Notary != s.testAccounts[i].addr {
return fmt.Errorf("incorrect address in notaryDeregistered log. Want: %v Got: %v", s.testAccounts[i].addr, log.Event.Notary)
}
if log.Event.PoolIndex.Cmp(big.NewInt(int64(i))) != 0 {
return fmt.Errorf("incorrect index in notaryDeregistered log. Want: %v Got: %v", i, log.Event.Notary)
}
if log.Event.DeregisteredPeriod.Cmp(big.NewInt(0)) == 0 {
return fmt.Errorf("incorrect period in notaryDeregistered log. Got: %v", log.Event.DeregisteredPeriod)
}
}
return nil
}
// addHeader is a helper function to add header to smc,
// it also verifies header is correctly added to the SMC.
// addHeader is a helper function to add header to smc.
func (s *smcTestHelper) addHeader(a *testAccount, shard *big.Int, period *big.Int, chunkRoot uint8) error {
_, err := s.smc.AddHeader(a.txOpts, shard, period, [32]byte{chunkRoot})
if err != nil {
@@ -134,11 +165,25 @@ func (s *smcTestHelper) addHeader(a *testAccount, shard *big.Int, period *big.In
if cr.ChunkRoot != [32]byte{chunkRoot} {
return fmt.Errorf("Chunkroot mismatched. Want: %v, Got: %v", chunkRoot, cr)
}
// Filter SMC logs by headerAdded.
shardIndex := []*big.Int{shard}
logPeriod := uint64(period.Int64() * sharding.PeriodLength)
log, err := s.smc.FilterHeaderAdded(&bind.FilterOpts{Start: logPeriod}, shardIndex)
if err != nil {
return err
}
log.Next()
if log.Event.ProposerAddress != s.testAccounts[0].addr {
return fmt.Errorf("incorrect proposer address in addHeader log. Want: %v Got: %v", s.testAccounts[0].addr, log.Event.ProposerAddress)
}
if log.Event.ChunkRoot != [32]byte{chunkRoot} {
return fmt.Errorf("chunk root missmatch in addHeader log. Want: %v Got: %v", [32]byte{chunkRoot}, log.Event.ChunkRoot)
}
return nil
}
// addHeader is a helper function for notary to submit vote on a given header,
// it also verifies vote is properly submitted and casted.
// submitVote is a helper function for notary to submit vote on a given header.
func (s *smcTestHelper) submitVote(a *testAccount, shard *big.Int, period *big.Int, index *big.Int, chunkRoot uint8) error {
_, err := s.smc.SubmitVote(a.txOpts, shard, period, index, [32]byte{chunkRoot})
if err != nil {
@@ -153,6 +198,20 @@ func (s *smcTestHelper) submitVote(a *testAccount, shard *big.Int, period *big.I
if !v {
return fmt.Errorf("Notary's indexd bit did not cast to 1 in index %v", index)
}
// Filter SMC logs by submitVote.
shardIndex := []*big.Int{shard}
logPeriod := uint64(period.Int64() * sharding.PeriodLength)
log, err := s.smc.FilterVoteSubmitted(&bind.FilterOpts{Start: logPeriod}, shardIndex)
if err != nil {
return err
}
log.Next()
if log.Event.NotaryAddress != a.addr {
return fmt.Errorf("incorrect notary address in submitVote log. Want: %v Got: %v", s.testAccounts[0].addr, a.addr)
}
if log.Event.ChunkRoot != [32]byte{chunkRoot} {
return fmt.Errorf("chunk root missmatch in submitVote log. Want: %v Got: %v", common.BytesToHash([]byte{chunkRoot}), common.BytesToHash(log.Event.ChunkRoot[:]))
}
return nil
}