[#17] frostfs: Remove method alphabetAddress
All checks were successful
DCO action / DCO (pull_request) Successful in 1m3s
Tests / Tests (1.19) (pull_request) Successful in 1m34s
Tests / Tests (1.20) (pull_request) Successful in 1m29s

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-02-02 16:01:31 +03:00
parent 43c90af97d
commit c9c53bb9ec
5 changed files with 26 additions and 66 deletions

View file

@ -9,7 +9,6 @@ import (
"github.com/nspcc-dev/neo-go/pkg/interop/native/ledger"
"github.com/nspcc-dev/neo-go/pkg/interop/native/management"
"github.com/nspcc-dev/neo-go/pkg/interop/native/roles"
"github.com/nspcc-dev/neo-go/pkg/interop/native/std"
"github.com/nspcc-dev/neo-go/pkg/interop/runtime"
"github.com/nspcc-dev/neo-go/pkg/interop/storage"
)
@ -26,7 +25,6 @@ const (
CandidateFeeConfigKey = "InnerRingCandidateFee"
withdrawFeeConfigKey = "WithdrawFee"
alphabetKey = "alphabet"
candidatesKey = "candidates"
processingContractKey = "processingScriptHash"
@ -71,9 +69,6 @@ func _deploy(data any, isUpdate bool) {
}
}
// initialize all storage slices
common.SetSerialized(ctx, alphabetKey, args.keys)
storage.Put(ctx, processingContractKey, args.addrProc)
ln := len(args.config)
@ -106,13 +101,6 @@ func Update(script []byte, manifest []byte, data any) {
runtime.Log("frostfs contract updated")
}
// AlphabetAddress returns 2\3n+1 multisignature address of alphabet nodes.
// It is used in sidechain notary disabled environment.
func AlphabetAddress() interop.Hash160 {
ctx := storage.GetReadOnlyContext()
return multiaddress(getAlphabetNodes(ctx))
}
// InnerRingCandidates returns an array of structures that contain an Inner Ring
// candidate node key.
func InnerRingCandidates() []common.IRNode {
@ -137,8 +125,7 @@ func InnerRingCandidateRemove(key interop.PublicKey) {
keyOwner := runtime.CheckWitness(key)
if !keyOwner {
multiaddr := AlphabetAddress()
if !runtime.CheckWitness(multiaddr) {
if !runtime.CheckWitness(common.AlphabetAddress()) {
panic("this method must be invoked by candidate or alphabet")
}
}
@ -358,16 +345,6 @@ func Version() int {
return common.Version
}
// getAlphabetNodes returns a deserialized slice of nodes from storage.
func getAlphabetNodes(ctx storage.Context) []interop.PublicKey {
data := storage.Get(ctx, alphabetKey)
if data != nil {
return std.Deserialize(data.([]byte)).([]interop.PublicKey)
}
return []interop.PublicKey{}
}
// getConfig returns the installed frostfs configuration value or nil if it is not set.
func getConfig(ctx storage.Context, key any) interface{} {
postfix := key.([]byte)