config: add P2PStateExchangeExtensions and StateSyncInterval settings
This commit is contained in:
parent
23adb1e2fc
commit
76c687aaa1
3 changed files with 19 additions and 1 deletions
|
@ -234,6 +234,7 @@ protocol-related settings described in the table below.
|
|||
| NativeActivations | `map[string][]uint32` | ContractManagement: [0]<br>StdLib: [0]<br>CryptoLib: [0]<br>LedgerContract: [0]<br>NeoToken: [0]<br>GasToken: [0]<br>PolicyContract: [0]<br>RoleManagement: [0]<br>OracleContract: [0] | The list of histories of native contracts updates. Each list item shod be presented as a known native contract name with the corresponding list of chain's heights. The contract is not active until chain reaches the first height value specified in the list. | `Notary` is supported. |
|
||||
| P2PNotaryRequestPayloadPoolSize | `int` | `1000` | Size of the node's P2P Notary request payloads memory pool where P2P Notary requests are stored before main or fallback transaction is completed and added to the chain.<br>This option is valid only if `P2PSigExtensions` are enabled. | Not supported by the C# node, thus may affect heterogeneous networks functionality. |
|
||||
| P2PSigExtensions | `bool` | `false` | Enables following additional Notary service related logic:<br>• Transaction attributes `NotValidBefore`, `Conflicts` and `NotaryAssisted`<br>• Network payload of the `P2PNotaryRequest` type<br>• Native `Notary` contract<br>• Notary node module | Not supported by the C# node, thus may affect heterogeneous networks functionality. |
|
||||
| P2PStateExchangeExtensions | `bool` | `false` | Enables following P2P MPT state data exchange logic: <br>• `StateSyncInterval` protocol setting <br>• P2P commands `GetMPTDataCMD` and `MPTDataCMD` | Not supported by the C# node, thus may affect heterogeneous networks functionality. |
|
||||
| RemoveUntraceableBlocks | `bool`| `false` | Denotes whether old blocks should be removed from cache and database. If enabled, then only last `MaxTraceableBlocks` are stored and accessible to smart contracts. |
|
||||
| ReservedAttributes | `bool` | `false` | Allows to have reserved attributes range for experimental or private purposes. |
|
||||
| SaveStorageBatch | `bool` | `false` | Enables storage batch saving before every persist. It is similar to StorageDump plugin for C# node. |
|
||||
|
@ -241,6 +242,7 @@ protocol-related settings described in the table below.
|
|||
| SeedList | `[]string` | [] | List of initial nodes addresses used to establish connectivity. |
|
||||
| StandbyCommittee | `[]string` | [] | List of public keys of standby committee validators are chosen from. |
|
||||
| StateRootInHeader | `bool` | `false` | Enables storing state root in block header. | Experimental protocol extension! |
|
||||
| StateSyncInterval | `int` | `40000` | The number of blocks between state heights available for MPT state data synchronization. | `P2PStateExchangeExtensions` should be enabled to use this setting. |
|
||||
| ValidatorsCount | `int` | `0` | Number of validators. |
|
||||
| VerifyBlocks | `bool` | `false` | Denotes whether to verify received blocks. |
|
||||
| VerifyTransactions | `bool` | `false` | Denotes whether to verify transactions in received blocks. |
|
||||
|
|
|
@ -38,6 +38,8 @@ type (
|
|||
NativeUpdateHistories map[string][]uint32 `yaml:"NativeActivations"`
|
||||
// P2PSigExtensions enables additional signature-related logic.
|
||||
P2PSigExtensions bool `yaml:"P2PSigExtensions"`
|
||||
// P2PStateExchangeExtensions enables additional P2P MPT state data exchange logic.
|
||||
P2PStateExchangeExtensions bool `yaml:"P2PStateExchangeExtensions"`
|
||||
// ReservedAttributes allows to have reserved attributes range for experimental or private purposes.
|
||||
ReservedAttributes bool `yaml:"ReservedAttributes"`
|
||||
// SaveStorageBatch enables storage batch saving before every persist.
|
||||
|
@ -47,6 +49,9 @@ type (
|
|||
StandbyCommittee []string `yaml:"StandbyCommittee"`
|
||||
// StateRooInHeader enables storing state root in block header.
|
||||
StateRootInHeader bool `yaml:"StateRootInHeader"`
|
||||
// StateSyncInterval is the number of blocks between state heights available for MPT state data synchronization.
|
||||
// It is valid only if P2PStateExchangeExtensions are enabled.
|
||||
StateSyncInterval int `yaml:"StateSyncInterval"`
|
||||
ValidatorsCount int `yaml:"ValidatorsCount"`
|
||||
// Whether to verify received blocks.
|
||||
VerifyBlocks bool `yaml:"VerifyBlocks"`
|
||||
|
|
|
@ -54,6 +54,7 @@ const (
|
|||
defaultMaxTransactionsPerBlock = 512
|
||||
// HeaderVerificationGasLimit is the maximum amount of GAS for block header verification.
|
||||
HeaderVerificationGasLimit = 3_00000000 // 3 GAS
|
||||
defaultStateSyncInterval = 40000
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -208,6 +209,16 @@ func NewBlockchain(s storage.Store, cfg config.ProtocolConfiguration, log *zap.L
|
|||
log.Info("MaxValidUntilBlockIncrement is not set or wrong, using default value",
|
||||
zap.Uint32("MaxValidUntilBlockIncrement", cfg.MaxValidUntilBlockIncrement))
|
||||
}
|
||||
if cfg.P2PStateExchangeExtensions {
|
||||
if !cfg.StateRootInHeader {
|
||||
return nil, errors.New("P2PStatesExchangeExtensions are enabled, but StateRootInHeader is off")
|
||||
}
|
||||
if cfg.StateSyncInterval <= 0 {
|
||||
cfg.StateSyncInterval = defaultStateSyncInterval
|
||||
log.Info("StateSyncInterval is not set or wrong, using default value",
|
||||
zap.Int("StateSyncInterval", cfg.StateSyncInterval))
|
||||
}
|
||||
}
|
||||
committee, err := committeeFromConfig(cfg)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue