forked from TrueCloudLab/neoneo-go
core: rename hardfork HF_2712_FixSyscallFees
Fantastic Beasts and Where to Find Them
This commit is contained in:
parent
c4ad434f20
commit
8055952bbc
8 changed files with 16 additions and 17 deletions
|
@ -21,7 +21,7 @@ ProtocolConfiguration:
|
||||||
OracleContract: [0]
|
OracleContract: [0]
|
||||||
Notary: [0]
|
Notary: [0]
|
||||||
Hardforks:
|
Hardforks:
|
||||||
HF_2712_FixSyscallFees: 25
|
HF_Aspidochelone: 25
|
||||||
|
|
||||||
ApplicationConfiguration:
|
ApplicationConfiguration:
|
||||||
# LogPath could be set up in case you need stdout logs to some proper file.
|
# LogPath could be set up in case you need stdout logs to some proper file.
|
||||||
|
|
|
@ -30,7 +30,7 @@ ProtocolConfiguration:
|
||||||
OracleContract: [0]
|
OracleContract: [0]
|
||||||
Notary: [0]
|
Notary: [0]
|
||||||
Hardforks:
|
Hardforks:
|
||||||
HF_2712_FixSyscallFees: 25
|
HF_Aspidochelone: 25
|
||||||
|
|
||||||
ApplicationConfiguration:
|
ApplicationConfiguration:
|
||||||
# LogPath could be set up in case you need stdout logs to some proper file.
|
# LogPath could be set up in case you need stdout logs to some proper file.
|
||||||
|
|
|
@ -204,7 +204,7 @@ protocol-related settings described in the table below.
|
||||||
| --- | --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| CommitteeHistory | map[uint32]int | none | Number of committee members after the given height, for example `{0: 1, 20: 4}` sets up a chain with one committee member since the genesis and then changes the setting to 4 committee members at the height of 20. `StandbyCommittee` committee setting must have the number of keys equal or exceeding the highest value in this option. Blocks numbers where the change happens must be divisible by the old and by the new values simultaneously. If not set, committee size is derived from the `StandbyCommittee` setting and never changes. |
|
| CommitteeHistory | map[uint32]int | none | Number of committee members after the given height, for example `{0: 1, 20: 4}` sets up a chain with one committee member since the genesis and then changes the setting to 4 committee members at the height of 20. `StandbyCommittee` committee setting must have the number of keys equal or exceeding the highest value in this option. Blocks numbers where the change happens must be divisible by the old and by the new values simultaneously. If not set, committee size is derived from the `StandbyCommittee` setting and never changes. |
|
||||||
| GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. |
|
| GarbageCollectionPeriod | `uint32` | 10000 | Controls MPT garbage collection interval (in blocks) for configurations with `RemoveUntraceableBlocks` enabled and `KeepOnlyLatestState` disabled. In this mode the node stores a number of MPT trees (corresponding to `MaxTraceableBlocks` and `StateSyncInterval`), but the DB needs to be clean from old entries from time to time. Doing it too often will cause too much processing overhead, doing it too rarely will leave more useless data in the DB. |
|
||||||
| Hardforks | `map[string]uint32` | [] | The set of incompatible changes that affect node behaviour starting from the specified height. The default value is an empty set which should be interpreted as "each known hard-fork is applied from the zero blockchain height". The list of valid hard-fork names:<br>• `HF_2712_FixSyscallFees` represents hard-fork introduced in [#2469](https://github.com/nspcc-dev/neo-go/pull/2469) (ported from the [reference](https://github.com/neo-project/neo/pull/2712)). It adjusts the prices of `System.Contract.CreateStandardAccount` and `System.Contract.CreateMultisigAccount` interops so that the resulting prices are in accordance with `sha256` method of native `CryptoLib` contract. |
|
| Hardforks | `map[string]uint32` | [] | The set of incompatible changes that affect node behaviour starting from the specified height. The default value is an empty set which should be interpreted as "each known hard-fork is applied from the zero blockchain height". The list of valid hard-fork names:<br>• `HF_Aspidochelone` represents hard-fork introduced in [#2469](https://github.com/nspcc-dev/neo-go/pull/2469) (ported from the [reference](https://github.com/neo-project/neo/pull/2712)). It adjusts the prices of `System.Contract.CreateStandardAccount` and `System.Contract.CreateMultisigAccount` interops so that the resulting prices are in accordance with `sha256` method of native `CryptoLib` contract. `HF_Aspidochelone` is also includes [#2519](https://github.com/nspcc-dev/neo-go/pull/2519) (ported from the [reference](https://github.com/neo-project/neo/pull/2749)). It adjusts the price of `System.Runtime.GetRandom` interop and fixes its vulnerability. |
|
||||||
| KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store latest state. If true, DB size will be smaller, but older roots won't be accessible. This value should remain th
|
| KeepOnlyLatestState | `bool` | `false` | Specifies if MPT should only store latest state. If true, DB size will be smaller, but older roots won't be accessible. This value should remain th
|
||||||
e same for the same database. | Conflicts with `P2PStateExchangeExtensions`. |
|
e same for the same database. | Conflicts with `P2PStateExchangeExtensions`. |
|
||||||
| Magic | `uint32` | `0` | Magic number which uniquely identifies NEO network. |
|
| Magic | `uint32` | `0` | Magic number which uniquely identifies NEO network. |
|
||||||
|
|
|
@ -6,11 +6,10 @@ package config
|
||||||
type Hardfork byte
|
type Hardfork byte
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// HF2712FixSyscallFees represents hard-fork introduced in #2469 (ported from
|
// HFAspidochelone represents hard-fork introduced in #2469 (ported from
|
||||||
// https://github.com/neo-project/neo/pull/2712) changing the prices of
|
// https://github.com/neo-project/neo/pull/2712) and #2519 (ported from
|
||||||
// System.Contract.CreateStandardAccount and
|
// https://github.com/neo-project/neo/pull/2749).
|
||||||
// System.Contract.CreateMultisigAccount interops.
|
HFAspidochelone Hardfork = 1 << iota // HF_Aspidochelone
|
||||||
HF2712FixSyscallFees Hardfork = 1 << iota // HF_2712_FixSyscallFees
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// hardforks holds a map of Hardfork string representation to its type.
|
// hardforks holds a map of Hardfork string representation to its type.
|
||||||
|
@ -18,7 +17,7 @@ var hardforks map[string]Hardfork
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
hardforks = make(map[string]Hardfork)
|
hardforks = make(map[string]Hardfork)
|
||||||
for _, hf := range []Hardfork{HF2712FixSyscallFees} {
|
for _, hf := range []Hardfork{HFAspidochelone} {
|
||||||
hardforks[hf.String()] = hf
|
hardforks[hf.String()] = hf
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Code generated by "stringer -type Hardfork -linecomment ./pkg/config/hardfork.go"; DO NOT EDIT.
|
// Code generated by "stringer -type=Hardfork -linecomment"; DO NOT EDIT.
|
||||||
|
|
||||||
package config
|
package config
|
||||||
|
|
||||||
|
@ -8,12 +8,12 @@ func _() {
|
||||||
// An "invalid array index" compiler error signifies that the constant values have changed.
|
// An "invalid array index" compiler error signifies that the constant values have changed.
|
||||||
// Re-run the stringer command to generate them again.
|
// Re-run the stringer command to generate them again.
|
||||||
var x [1]struct{}
|
var x [1]struct{}
|
||||||
_ = x[HF2712FixSyscallFees-1]
|
_ = x[HFAspidochelone-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
const _Hardfork_name = "HF_2712_FixSyscallFees"
|
const _Hardfork_name = "HF_Aspidochelone"
|
||||||
|
|
||||||
var _Hardfork_index = [...]uint8{0, 22}
|
var _Hardfork_index = [...]uint8{0, 16}
|
||||||
|
|
||||||
func (i Hardfork) String() string {
|
func (i Hardfork) String() string {
|
||||||
i -= 1
|
i -= 1
|
||||||
|
|
|
@ -93,7 +93,7 @@ func GetRandom(ic *interop.Context) error {
|
||||||
price int64
|
price int64
|
||||||
seed = ic.Network
|
seed = ic.Network
|
||||||
)
|
)
|
||||||
isHF := ic.IsHardforkEnabled(config.HF2712FixSyscallFees)
|
isHF := ic.IsHardforkEnabled(config.HFAspidochelone)
|
||||||
if isHF {
|
if isHF {
|
||||||
price = 1 << 13
|
price = 1 << 13
|
||||||
seed += ic.GetRandomCounter
|
seed += ic.GetRandomCounter
|
||||||
|
|
|
@ -225,7 +225,7 @@ func contractCreateMultisigAccount(ic *interop.Context) error {
|
||||||
pubs[i] = p
|
pubs[i] = p
|
||||||
}
|
}
|
||||||
var invokeFee int64
|
var invokeFee int64
|
||||||
if ic.IsHardforkEnabled(config.HF2712FixSyscallFees) {
|
if ic.IsHardforkEnabled(config.HFAspidochelone) {
|
||||||
invokeFee = fee.ECDSAVerifyPrice * int64(len(pubs))
|
invokeFee = fee.ECDSAVerifyPrice * int64(len(pubs))
|
||||||
} else {
|
} else {
|
||||||
invokeFee = 1 << 8
|
invokeFee = 1 << 8
|
||||||
|
@ -250,7 +250,7 @@ func contractCreateStandardAccount(ic *interop.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var invokeFee int64
|
var invokeFee int64
|
||||||
if ic.IsHardforkEnabled(config.HF2712FixSyscallFees) {
|
if ic.IsHardforkEnabled(config.HFAspidochelone) {
|
||||||
invokeFee = fee.ECDSAVerifyPrice
|
invokeFee = fee.ECDSAVerifyPrice
|
||||||
} else {
|
} else {
|
||||||
invokeFee = 1 << 8
|
invokeFee = 1 << 8
|
||||||
|
|
|
@ -261,7 +261,7 @@ func TestSystemContractCreateAccount_Hardfork(t *testing.T) {
|
||||||
bc, acc := chain.NewSingleWithCustomConfig(t, func(c *config.ProtocolConfiguration) {
|
bc, acc := chain.NewSingleWithCustomConfig(t, func(c *config.ProtocolConfiguration) {
|
||||||
c.P2PSigExtensions = true // `initBasicChain` requires Notary enabled
|
c.P2PSigExtensions = true // `initBasicChain` requires Notary enabled
|
||||||
c.Hardforks = map[string]uint32{
|
c.Hardforks = map[string]uint32{
|
||||||
config.HF2712FixSyscallFees.String(): 2,
|
config.HFAspidochelone.String(): 2,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
e := neotest.NewExecutor(t, bc, acc, acc)
|
e := neotest.NewExecutor(t, bc, acc, acc)
|
||||||
|
|
Loading…
Reference in a new issue