config: replace LatestHardfork() with HFLatestStable

Function doesn't make much sense here. The change is rather trivial and this
is not expected to be used by external code, so no deprecation.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2024-12-04 22:20:57 +03:00
parent 981ae10091
commit a164db92cc
4 changed files with 6 additions and 8 deletions

View file

@ -310,7 +310,7 @@ func getMethod(t *testing.T, ctr interop.ContractMD, name string, params []strin
name = strings.TrimSuffix(name, "WithData") name = strings.TrimSuffix(name, "WithData")
} }
latestHF := config.LatestHardfork() latestHF := config.HFLatestKnown
cMD := ctr.HFSpecificContractMD(&latestHF) cMD := ctr.HFSpecificContractMD(&latestHF)
md, ok := cMD.GetMethod(name, paramLen) md, ok := cMD.GetMethod(name, paramLen)
require.True(t, ok, cMD.Manifest.Name, name, paramLen) require.True(t, ok, cMD.Manifest.Name, name, paramLen)

View file

@ -57,6 +57,9 @@ const (
// between releases even if the set of known hardforks is the same. // between releases even if the set of known hardforks is the same.
const HFLatestStable = HFDomovoi const HFLatestStable = HFDomovoi
// HFLatestKnown is the latest known hardfork.
const HFLatestKnown = hfLast >> 1
// StableHardforks is an ordered slice of all stable hardforks (before or // StableHardforks is an ordered slice of all stable hardforks (before or
// equal [HFLatestStable]). // equal [HFLatestStable]).
var StableHardforks []Hardfork var StableHardforks []Hardfork
@ -110,8 +113,3 @@ func IsHardforkValid(s string) bool {
_, ok := hardforks[s] _, ok := hardforks[s]
return ok return ok
} }
// LatestHardfork returns latest known hardfork.
func LatestHardfork() Hardfork {
return hfLast >> 1
}

View file

@ -12,7 +12,7 @@ import (
func TestNamesASCII(t *testing.T) { func TestNamesASCII(t *testing.T) {
cfg := config.ProtocolConfiguration{P2PSigExtensions: true} cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
cs := NewContracts(cfg) cs := NewContracts(cfg)
latestHF := config.LatestHardfork() latestHF := config.HFLatestKnown
for _, c := range cs.Contracts { for _, c := range cs.Contracts {
require.True(t, isASCII(c.Metadata().Name)) require.True(t, isASCII(c.Metadata().Name))
hfMD := c.Metadata().HFSpecificContractMD(&latestHF) hfMD := c.Metadata().HFSpecificContractMD(&latestHF)

View file

@ -12,7 +12,7 @@ import (
func TestNativeGetMethod(t *testing.T) { func TestNativeGetMethod(t *testing.T) {
cfg := config.ProtocolConfiguration{P2PSigExtensions: true} cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
cs := NewContracts(cfg) cs := NewContracts(cfg)
latestHF := config.LatestHardfork() latestHF := config.HFLatestKnown
for _, c := range cs.Contracts { for _, c := range cs.Contracts {
hfMD := c.Metadata().HFSpecificContractMD(&latestHF) hfMD := c.Metadata().HFSpecificContractMD(&latestHF)
t.Run(c.Metadata().Name, func(t *testing.T) { t.Run(c.Metadata().Name, func(t *testing.T) {