mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-20 05:41:35 +00:00
consensus, params: remove SkipV2Validation, close XFN-151 (#1730)
This commit is contained in:
parent
7a3ac998a3
commit
8cbbc1e83d
5 changed files with 3 additions and 27 deletions
|
|
@ -35,8 +35,7 @@
|
|||
"timeoutPeriod": 10,
|
||||
"certificateThreshold": 0.667
|
||||
}
|
||||
},
|
||||
"SkipV2Validation": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@ import (
|
|||
|
||||
// Verify individual header
|
||||
func (x *XDPoS_v2) verifyHeader(chain consensus.ChainReader, header *types.Header, parents []*types.Header, fullVerify bool) error {
|
||||
// If we're running a engine faking, accept any block as valid
|
||||
if x.config.V2.SkipV2Validation {
|
||||
return nil
|
||||
}
|
||||
|
||||
if !x.isInitilised {
|
||||
if err := x.initial(chain, header); err != nil {
|
||||
return err
|
||||
|
|
|
|||
|
|
@ -25,8 +25,6 @@ func TestShouldVerifyBlock(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, _, signer, signFn, _ := PrepareXDCTestBlockChainForV2Engine(t, 910, &config, nil)
|
||||
adaptor := blockchain.Engine().(*XDPoS.XDPoS)
|
||||
|
|
@ -176,8 +174,6 @@ func TestConfigSwitchOnDifferentCertThreshold(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, _, _, _, _ := PrepareXDCTestBlockChainForV2Engine(t, 915, &config, nil)
|
||||
|
||||
|
|
@ -274,8 +270,6 @@ func TestConfigSwitchOnDifferentMasternodeCount(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, currentBlock, _, _, _ := PrepareXDCTestBlockChainForV2Engine(t, int(config.XDPoS.Epoch)*2, &config, nil)
|
||||
adaptor := blockchain.Engine().(*XDPoS.XDPoS)
|
||||
|
|
@ -312,8 +306,6 @@ func TestConfigSwitchOnDifferentMindPeriod(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, _, _, _, _ := PrepareXDCTestBlockChainForV2Engine(t, 915, &config, nil)
|
||||
|
||||
|
|
@ -365,8 +357,6 @@ func TestShouldFailIfNotEnoughQCSignatures(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, currentBlock, signer, signFn, _ := PrepareXDCTestBlockChainForV2Engine(t, 902, &config, nil)
|
||||
adaptor := blockchain.Engine().(*XDPoS.XDPoS)
|
||||
|
|
@ -416,8 +406,6 @@ func TestShouldVerifyHeaders(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, _, _, _, _ := PrepareXDCTestBlockChainForV2Engine(t, 910, &config, nil)
|
||||
adaptor := blockchain.Engine().(*XDPoS.XDPoS)
|
||||
|
|
@ -455,8 +443,6 @@ func TestShouldVerifyHeadersEvenIfParentsNotYetWrittenIntoDB(t *testing.T) {
|
|||
var config params.ChainConfig
|
||||
err = json.Unmarshal([]byte(configString), &config)
|
||||
assert.Nil(t, err)
|
||||
// Enable verify
|
||||
config.XDPoS.V2.SkipV2Validation = false
|
||||
// Block 901 is the first v2 block with round of 1
|
||||
blockchain, _, block910, signer, signFn, _ := PrepareXDCTestBlockChainForV2Engine(t, 910, &config, nil)
|
||||
adaptor := blockchain.Engine().(*XDPoS.XDPoS)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,7 @@
|
|||
"timeoutPeriod": 10,
|
||||
"certificateThreshold": 0.667
|
||||
}
|
||||
},
|
||||
"SkipV2Validation": false
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -488,8 +488,6 @@ type V2 struct {
|
|||
CurrentConfig *V2Config `json:"config"`
|
||||
AllConfigs map[uint64]*V2Config `json:"allConfigs"`
|
||||
configIndex []uint64 //list of switch block of configs
|
||||
|
||||
SkipV2Validation bool //Skip Block Validation for testing purpose, V2 consensus only
|
||||
}
|
||||
|
||||
type V2Config struct {
|
||||
|
|
@ -574,7 +572,7 @@ func (v2 *V2) String() string {
|
|||
return "V2: <nil>"
|
||||
}
|
||||
|
||||
return fmt.Sprintf("V2{SwitchEpoch: %v, SwitchBlock: %v, SkipV2Validation: %v, %s}", v2.SwitchEpoch, v2.SwitchBlock, v2.SkipV2Validation, v2.CurrentConfig.String())
|
||||
return fmt.Sprintf("V2{SwitchEpoch: %v, SwitchBlock: %v, %s}", v2.SwitchEpoch, v2.SwitchBlock, v2.CurrentConfig.String())
|
||||
}
|
||||
|
||||
func (v2 *V2) Description(indent int) string {
|
||||
|
|
@ -586,7 +584,6 @@ func (v2 *V2) Description(indent int) string {
|
|||
prefix := strings.Repeat(" ", indent)
|
||||
banner += fmt.Sprintf("%s- SwitchEpoch: %v\n", prefix, v2.SwitchEpoch)
|
||||
banner += fmt.Sprintf("%s- SwitchBlock: %v\n", prefix, v2.SwitchBlock)
|
||||
banner += fmt.Sprintf("%s- SkipV2Validation: %v\n", prefix, v2.SkipV2Validation)
|
||||
banner += fmt.Sprintf("%s- %s", prefix, v2.GetCurrentConfig().Description("CurrentConfig", indent+2))
|
||||
return banner
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue