Skip to content

Commit

Permalink
*: move NativeUpdateHistory logic under Hardforks management
Browse files Browse the repository at this point in the history
Close #3196.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
  • Loading branch information
AnnaShaleva committed Nov 21, 2023
1 parent 1b9de3d commit 984c538
Show file tree
Hide file tree
Showing 35 changed files with 170 additions and 320 deletions.
11 changes: 0 additions & 11 deletions config/protocol.mainnet.neofs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,6 @@ ProtocolConfiguration:
Hardforks:
Aspidochelone: 3000000
Basilisk: 4500000
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]
Notary: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ ProtocolConfiguration:
Hardforks:
Aspidochelone: 1730000
Basilisk: 4120000
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.docker.four.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ ProtocolConfiguration:
- node_four:20336
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.docker.one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ ProtocolConfiguration:
- node_four:20336
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.docker.single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ ProtocolConfiguration:
- node_single:20333
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.docker.three.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ ProtocolConfiguration:
- node_four:20336
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.docker.two.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ ProtocolConfiguration:
- node_four:20336
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.privnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ ProtocolConfiguration:
- localhost:20336
VerifyTransactions: true
P2PSigExtensions: false
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
11 changes: 0 additions & 11 deletions config/protocol.testnet.neofs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,6 @@ ProtocolConfiguration:
- morph7.t5.fs.neo.org:50333
VerifyTransactions: true
P2PSigExtensions: true
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]
Notary: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
10 changes: 0 additions & 10 deletions config/protocol.testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,6 @@ ProtocolConfiguration:
Hardforks:
Aspidochelone: 210000
Basilisk: 2680000
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]

ApplicationConfiguration:
SkipBlockVerification: false
Expand Down
11 changes: 0 additions & 11 deletions config/protocol.unit_testnet.single.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ ProtocolConfiguration:
ValidatorsCount: 1
VerifyTransactions: true
P2PSigExtensions: true
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]
Notary: [0]
Hardforks:
Aspidochelone: 25

Expand Down
11 changes: 0 additions & 11 deletions config/protocol.unit_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ ProtocolConfiguration:
- 127.0.0.1:20336
VerifyTransactions: true
P2PSigExtensions: true
NativeActivations:
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]
Notary: [0]
Hardforks:
Aspidochelone: 25

Expand Down
5 changes: 2 additions & 3 deletions docs/node-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ protocol-related settings described in the table below.
| MaxTransactionsPerBlock | `uint16` | `512` | Maximum number of transactions per block. |
| MaxValidUntilBlockIncrement | `uint32` | `5760` | Upper height increment limit for transaction's ValidUntilBlock field value relative to the current blockchain height, exceeding which a transaction will fail validation. It is set to estimated daily number of blocks with 15s interval by default. |
| MemPoolSize | `int` | `50000` | Size of the node's memory pool where transactions are stored before they are added to block. |
| 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 attribute `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 the 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. Can be supported either on MPT-complete node (`KeepOnlyLatestState`=`false`) or on light GC-enabled node (`RemoveUntraceableBlocks=true`) in which case `KeepOnlyLatestState` setting doesn't change the behavior, an appropriate set of MPTs is always stored (see `RemoveUntraceableBlocks`). |
Expand Down Expand Up @@ -383,9 +382,9 @@ where:

Note that Roles is a NeoGo extension that isn't supported by the NeoC# node and
must be disabled on the public Neo N3 networks. Roles extension is compatible
with NativeUpdateHistory setting, which means that specified roles will be set
with Hardforks setting, which means that specified roles will be set
only during native RoleManagement contract initialisation (which may be
performed in some non-genesis block). By default, no roles are designated.
performed in some non-genesis hardfork). By default, no roles are designated.

- `Transaction` is a container for transaction script that should be deployed in
the genesis block if provided. `Transaction` includes `Script` which is a
Expand Down
16 changes: 2 additions & 14 deletions docs/notary.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,8 @@ verify and broadcast `P2PNotaryRequest` P2P payloads, properly initialize native
Notary contract and designate `P2PNotary` node role in RoleManagement native
contract.

If you use custom `NativeActivations` subsection of the `ProtocolConfiguration`
section in your node config, specify the height of the Notary contract
activation, e.g. `0`.
Currently, Notary contract activation height is not configurable and is always
set to 0 (if `P2PSigExtensions` are enabled).

Note, that even if `P2PSigExtensions` config subsection enables notary-related
logic in the network, it still does not turn your node into notary service node.
Expand All @@ -184,17 +183,6 @@ To enable notary service node functionality refer to the

```
P2PSigExtensions: true
NativeActivations:
Notary: [0]
ContractManagement: [0]
StdLib: [0]
CryptoLib: [0]
LedgerContract: [0]
NeoToken: [0]
GasToken: [0]
PolicyContract: [0]
RoleManagement: [0]
OracleContract: [0]
```


Expand Down
14 changes: 0 additions & 14 deletions pkg/config/config_test.go

This file was deleted.

20 changes: 0 additions & 20 deletions pkg/config/protocol_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"time"

"github.com/nspcc-dev/neo-go/pkg/config/netmode"
"github.com/nspcc-dev/neo-go/pkg/core/native/nativenames"
"github.com/nspcc-dev/neo-go/pkg/encoding/fixedn"
)

Expand Down Expand Up @@ -44,8 +43,6 @@ type (
// exceeding that a transaction should fail validation. It is set to estimated daily number
// of blocks with 15s interval.
MaxValidUntilBlockIncrement uint32 `yaml:"MaxValidUntilBlockIncrement"`
// NativeUpdateHistories is a list of histories of native contracts updates.
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.
Expand Down Expand Up @@ -86,11 +83,6 @@ func (p *ProtocolConfiguration) Validate() error {
if p.TimePerBlock%time.Millisecond != 0 {
return errors.New("TimePerBlock must be an integer number of milliseconds")
}
for name := range p.NativeUpdateHistories {
if !nativenames.IsValid(name) {
return fmt.Errorf("NativeActivations configuration section contains unexpected native contract name: %s", name)
}
}
for name := range p.Hardforks {
if !IsHardforkValid(name) {
return fmt.Errorf("Hardforks configuration section contains unexpected hardfork: %s", name)
Expand Down Expand Up @@ -237,7 +229,6 @@ func (p *ProtocolConfiguration) Equals(o *ProtocolConfiguration) bool {
p.VerifyTransactions != o.VerifyTransactions ||
len(p.CommitteeHistory) != len(o.CommitteeHistory) ||
len(p.Hardforks) != len(o.Hardforks) ||
len(p.NativeUpdateHistories) != len(o.NativeUpdateHistories) ||
len(p.SeedList) != len(o.SeedList) ||
len(p.StandbyCommittee) != len(o.StandbyCommittee) ||
len(p.ValidatorsHistory) != len(o.ValidatorsHistory) {
Expand All @@ -255,17 +246,6 @@ func (p *ProtocolConfiguration) Equals(o *ProtocolConfiguration) bool {
return false
}
}
for k, v := range p.NativeUpdateHistories {
vo := o.NativeUpdateHistories[k]
if len(v) != len(vo) {
return false
}
for i := range v {
if v[i] != vo[i] {
return false
}
}
}
for i := range p.SeedList {
if p.SeedList[i] != o.SeedList[i] {
return false
Expand Down
17 changes: 0 additions & 17 deletions pkg/config/protocol_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ func TestProtocolConfigurationValidation(t *testing.T) {
ValidatorsCount: 1,
}
require.Error(t, p.Validate())
p = &ProtocolConfiguration{
NativeUpdateHistories: map[string][]uint32{
"someContract": {0, 10},
},
}
require.Error(t, p.Validate())
p = &ProtocolConfiguration{
StandbyCommittee: []string{
"02b3622bf4017bdfe317c58aed5f4c753f206b7db896046fa7d774bbc4bf7f8dc2",
Expand Down Expand Up @@ -247,17 +241,6 @@ func TestProtocolConfigurationEquals(t *testing.T) {
p.Hardforks = nil
o.Hardforks = nil

p.NativeUpdateHistories = map[string][]uint32{"Contract": {1, 2, 3}}
o.NativeUpdateHistories = map[string][]uint32{"Contract": {1, 2, 3}}
require.True(t, p.Equals(o))
p.NativeUpdateHistories["Contract"] = []uint32{1, 2, 3, 4}
require.False(t, p.Equals(o))
p.NativeUpdateHistories["Contract"] = []uint32{1, 2, 4}
require.False(t, p.Equals(o))

p.NativeUpdateHistories = nil
o.NativeUpdateHistories = nil

p.SeedList = []string{"url1", "url2"}
o.SeedList = []string{"url1", "url2"}
require.True(t, p.Equals(o))
Expand Down
4 changes: 0 additions & 4 deletions pkg/config/testdata/protocol.test.yml

This file was deleted.

Loading

0 comments on commit 984c538

Please sign in to comment.