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

Fix ibft not mining bug when network split on waiting for commit mess… #10

Merged
merged 2 commits into from
Apr 21, 2022
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions consensus/ibft/ibft.go
Original file line number Diff line number Diff line change
Expand Up @@ -900,11 +900,24 @@ func (i *Ibft) runValidateState() {
}

if msg == nil {
i.logger.Debug("ValidateState got message timeout, should change round",
"sequence", i.state.view.Sequence, "round", i.state.view.Round+1)
i.state.unlock()
i.setState(RoundChangeState)

continue
}

// check msg number and round, might from some faulty nodes
if i.state.view.Sequence != msg.View.GetSequence() ||
i.state.view.Round != msg.View.GetRound() {
i.logger.Debug("ValidateState got message not matching sequence and round",
"my-sequence", i.state.view.Sequence, "my-round", i.state.view.Round+1,
"other-sequence", msg.View.GetSequence(), "other-round", msg.View.GetRound())

continue
}

switch msg.Type {
case proto.MessageReq_Prepare:
i.state.addPrepared(msg)
Expand Down
5 changes: 4 additions & 1 deletion contracts/abis/abis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,7 @@ var (
)

// Temporarily deployed contract ABI
var StressTestABI = abi.MustNewABI(StressTestJSONABI)
var (
// StressTest contract abi
StressTestABI = abi.MustNewABI(StressTestJSONABI)
)
41 changes: 21 additions & 20 deletions e2e/framework/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,27 @@ type SrvAccount struct {
// TestServerConfig for the test server
type TestServerConfig struct {
ReservedPorts []ReservedPort
JSONRPCPort int // The JSON RPC endpoint port
GRPCPort int // The GRPC endpoint port
LibP2PPort int // The Libp2p endpoint port
Seal bool // Flag indicating if blocks should be sealed
RootDir string // The root directory for test environment
IBFTDirPrefix string // The prefix of data directory for IBFT
IBFTDir string // The name of data directory for IBFT
PremineAccts []*SrvAccount // Accounts with existing balances (genesis accounts)
GenesisValidatorBalance *big.Int // Genesis the balance for the validators
DevStakers []types.Address // List of initial staking addresses for the ValidatorSet SC with dev consensus
Consensus ConsensusType // Consensus MechanismType
Bootnodes []string // Bootnode Addresses
PriceLimit *uint64 // Minimum gas price limit to enforce for acceptance into the pool
DevInterval int // Dev consensus update interval [s]
EpochSize uint64 // The epoch size in blocks for the IBFT layer
BlockGasLimit uint64 // Block gas limit
BlockGasTarget uint64 // Gas target for new blocks
ShowsLog bool // Flag specifying if logs are shown
IsPos bool // Specifies the mechanism used for IBFT (PoA / PoS)
Signer *crypto.EIP155Signer // Signer used for transactions
JSONRPCPort int // The JSON RPC endpoint port
GRPCPort int // The GRPC endpoint port
LibP2PPort int // The Libp2p endpoint port
Seal bool // Flag indicating if blocks should be sealed
RootDir string // The root directory for test environment
IBFTDirPrefix string // The prefix of data directory for IBFT
IBFTDir string // The name of data directory for IBFT
PremineAccts []*SrvAccount // Accounts with existing balances (genesis accounts)
GenesisValidatorBalance *big.Int // Genesis the balance for the validators
// List of initial staking addresses for the ValidatorSet SC with dev consensus
DevStakers []types.Address
Consensus ConsensusType // Consensus MechanismType
Bootnodes []string // Bootnode Addresses
PriceLimit *uint64 // Minimum gas price limit to enforce for acceptance into the pool
DevInterval int // Dev consensus update interval [s]
EpochSize uint64 // The epoch size in blocks for the IBFT layer
BlockGasLimit uint64 // Block gas limit
BlockGasTarget uint64 // Gas target for new blocks
ShowsLog bool // Flag specifying if logs are shown
IsPos bool // Specifies the mechanism used for IBFT (PoA / PoS)
Signer *crypto.EIP155Signer // Signer used for transactions
}

// DataDir returns path of data directory server uses
Expand Down