Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consensus: add fast finality interface #304

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion consensus/consensus.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
package consensus

import (
"math/big"

"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/ethdb"
"math/big"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
Expand Down Expand Up @@ -147,3 +148,21 @@ type PoSA interface {
IsSystemTransaction(tx *types.Transaction, header *types.Header) (bool, error)
IsSystemContract(to *common.Address) bool
}

type FastFinalityPoSA interface {
PoSA

GetJustifiedBlock(chain ChainHeaderReader, blockNumber uint64, blockHash common.Hash) (uint64, common.Hash)
GetFinalizedBlock(chain ChainHeaderReader, blockNumber uint64, blockHash common.Hash) (uint64, common.Hash)

// IsActiveValidatorAt always returns false before Shillin
IsActiveValidatorAt(chain ChainHeaderReader, header *types.Header) bool

// VerifyVote check if the finality voter is in the validator set, it assumes the signature is
// already verified
VerifyVote(chain ChainHeaderReader, vote *types.VoteEnvelope) error
}

type VotePool interface {
FetchVoteByBlockHash(blockHash common.Hash) []*types.VoteEnvelope
}