forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge istanbul into (celo) master (ethereum#135)
* cmd, consensus, eth, ethstats: add protocol interface into consensus to support custom messages * params: add Istanbul consensus engine config to ChainConfig * cmd/*: add Istanbul command line flags * consensus/istanbul, eth: add Istanbul configuration * node: add an interface to retrieve node key from config * core/types: add Istanbul specific block hash calculation * internal/web3ext: add Istanbul JS RPC API * consensus: add Istanbul consensus engine interface * consensus/istanbul: Istanbul core implementation * consensus/istanbul: add tests for Istanbul core * consensus/istanbul: common Istanbul interfaces and types * consensus/istanbul: Istanbul validator set implementation * consensus/istanbul: Istanbul consensus backend implementation * core, les, eth, miner: Istanbul consensus integration * cmd/*, core, params: add ottoman testnet * Address comments * Fix Istanbul lint (ethereum#137) * Remove unused vars for lint * Remove unnecessary conversion * Don't propose empty blocks with Istanbul (ethereum#134) * Make istanbul.Backend a public type * Don't mine empty block with Istanbul engine unless necessary * PR comments * Revert to original order * Add test fixes * PR comments * Update the expected hash given that celo headers have a different payload with BlockSignature * Make Istanbul's Seal asynchronous Originally, when Istanbul was written, the Seal method was synchronous, i.e. it would return when the sealing process was done (or cancelled). Now that is no longer the case, in fact the miner expects the Seal to return to be able to respond/intiate other Seal's. This commit allows Istanbul to do so. * Notify the Istanbul engine of new ChainHeads During the merge, we removed this crucial line, where the worker will notify the Istanbul engine of new chain heads that crucially allow its peers to increse the sequence number for the next Seal. * Apply celolatest syncmode mods to Istanbul * [Istanbul] Seal/NewHeadChain fixes (ethereum#147) * Make Istanbul's Seal asynchronous Originally, when Istanbul was written, the Seal method was synchronous, i.e. it would return when the sealing process was done (or cancelled). Now that is no longer the case, in fact the miner expects the Seal to return to be able to respond/intiate other Seal's. This commit allows Istanbul to do so. * Notify the Istanbul engine of new ChainHeads During the merge, we removed this crucial line, where the worker will notify the Istanbul engine of new chain heads that crucially allow its peers to increse the sequence number for the next Seal. * Fix test * Fix test
- Loading branch information
Showing
76 changed files
with
9,020 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// Copyright 2017 The go-ethereum Authors | ||
// This file is part of the go-ethereum library. | ||
// | ||
// The go-ethereum library is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU Lesser General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// The go-ethereum library is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU Lesser General Public License for more details. | ||
// | ||
// You should have received a copy of the GNU Lesser General Public License | ||
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
package istanbul | ||
|
||
import ( | ||
"math/big" | ||
"time" | ||
|
||
"github.com/ethereum/go-ethereum/common" | ||
"github.com/ethereum/go-ethereum/event" | ||
) | ||
|
||
// Backend provides application specific functions for Istanbul core | ||
type Backend interface { | ||
// Address returns the owner's address | ||
Address() common.Address | ||
|
||
// Validators returns the validator set | ||
Validators(proposal Proposal) ValidatorSet | ||
|
||
// EventMux returns the event mux in backend | ||
EventMux() *event.TypeMux | ||
|
||
// Broadcast sends a message to all validators (include self) | ||
Broadcast(valSet ValidatorSet, payload []byte) error | ||
|
||
// Gossip sends a message to all validators (exclude self) | ||
Gossip(valSet ValidatorSet, payload []byte) error | ||
|
||
// Commit delivers an approved proposal to backend. | ||
// The delivered proposal will be put into blockchain. | ||
Commit(proposal Proposal, seals [][]byte) error | ||
|
||
// Verify verifies the proposal. If a consensus.ErrFutureBlock error is returned, | ||
// the time difference of the proposal and current time is also returned. | ||
Verify(Proposal) (time.Duration, error) | ||
|
||
// Sign signs input data with the backend's private key | ||
Sign([]byte) ([]byte, error) | ||
|
||
// CheckSignature verifies the signature by checking if it's signed by | ||
// the given validator | ||
CheckSignature(data []byte, addr common.Address, sig []byte) error | ||
|
||
// LastProposal retrieves latest committed proposal and the address of proposer | ||
LastProposal() (Proposal, common.Address) | ||
|
||
// HasProposal checks if the combination of the given hash and height matches any existing blocks | ||
HasProposal(hash common.Hash, number *big.Int) bool | ||
|
||
// GetProposer returns the proposer of the given block height | ||
GetProposer(number uint64) common.Address | ||
|
||
// ParentValidators returns the validator set of the given proposal's parent block | ||
ParentValidators(proposal Proposal) ValidatorSet | ||
|
||
// HasBadProposal returns whether the block with the hash is a bad block | ||
HasBadProposal(hash common.Hash) bool | ||
} |
Oops, something went wrong.