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")
}
latestHF := config.LatestHardfork()
latestHF := config.HFLatestKnown
cMD := ctr.HFSpecificContractMD(&latestHF)
md, ok := cMD.GetMethod(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.
const HFLatestStable = HFDomovoi
// HFLatestKnown is the latest known hardfork.
const HFLatestKnown = hfLast >> 1
// StableHardforks is an ordered slice of all stable hardforks (before or
// equal [HFLatestStable]).
var StableHardforks []Hardfork
@ -110,8 +113,3 @@ func IsHardforkValid(s string) bool {
_, ok := hardforks[s]
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) {
cfg := config.ProtocolConfiguration{P2PSigExtensions: true}
cs := NewContracts(cfg)
latestHF := config.LatestHardfork()
latestHF := config.HFLatestKnown
for _, c := range cs.Contracts {
require.True(t, isASCII(c.Metadata().Name))
hfMD := c.Metadata().HFSpecificContractMD(&latestHF)

View file

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