[#338] ir: Drop notaryless code from governance
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-05-18 11:19:08 +03:00 committed by Evgenii Stratonikov
parent 0ab589dd52
commit 53a1b15693
4 changed files with 52 additions and 75 deletions

View file

@ -170,7 +170,6 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli
IRFetcher: irf,
MorphClient: s.morphClient,
MainnetClient: s.mainnetClient,
NotaryDisabled: s.sideNotaryConfig.disabled,
})
if err != nil {
return nil, err

View file

@ -47,7 +47,6 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
AlphabetState: as,
Voter: v,
IRFetcher: irf,
NotaryDisabled: true,
MorphClient: m,
MainnetClient: mn,
FrostFSClient: f,
@ -74,17 +73,19 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
},
}, v.votes, "invalid vote calls")
var irUpdateExp nmClient.UpdateIRPrm
irUpdateExp.SetKeys(testKeys.newInnerRingExp)
irUpdateExp.SetHash(ev.txHash)
var irUpdateExp []nmClient.UpdateIRPrm
require.EqualValues(t, []nmClient.UpdateIRPrm{irUpdateExp}, nm.updates, "invalid IR updates")
require.EqualValues(t, irUpdateExp, nm.updates, "invalid IR updates")
var expAlphabetUpdates []client.UpdateAlphabetListPrm
require.EqualValues(t, expAlphabetUpdates, m.alphabetUpdates, "invalid alphabet updates")
var expAlphabetUpdate client.UpdateAlphabetListPrm
expAlphabetUpdate.SetHash(ev.txHash)
expAlphabetUpdate.SetList(testKeys.newInnerRingExp)
require.EqualValues(t, []client.UpdateAlphabetListPrm{expAlphabetUpdate}, m.alphabetUpdates, "invalid alphabet updates")
var expNotaryUpdates []client.UpdateNotaryListPrm
require.EqualValues(t, expNotaryUpdates, m.notaryUpdates, "invalid notary list updates")
var expNotaryUpdate client.UpdateNotaryListPrm
expNotaryUpdate.SetHash(ev.txHash)
expNotaryUpdate.SetList(testKeys.newAlphabetExp)
require.EqualValues(t, []client.UpdateNotaryListPrm{expNotaryUpdate}, m.notaryUpdates, "invalid notary list updates")
buf := make([]byte, 8)
binary.LittleEndian.PutUint64(buf, es.epoch)
@ -127,7 +128,6 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) {
AlphabetState: as,
Voter: v,
IRFetcher: irf,
NotaryDisabled: false,
MorphClient: m,
MainnetClient: mn,
FrostFSClient: f,

View file

@ -9,7 +9,6 @@ import (
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
frostfscontract "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/frostfs"
nmClient "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/netmap"
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/util"
"go.uber.org/zap"
@ -114,33 +113,17 @@ func (gp *Processor) updateNeoFSAlphabetRoleInSidechain(sidechainAlphabet, newAl
zap.String("after", prettyKeys(newInnerRing)),
)
if gp.notaryDisabled {
updPrm := nmClient.UpdateIRPrm{}
updPrm.SetKeys(newInnerRing)
updPrm.SetHash(txHash)
err = gp.netmapClient.UpdateInnerRing(updPrm)
} else {
updPrm := client.UpdateAlphabetListPrm{}
updPrm.SetList(newInnerRing)
updPrm.SetHash(txHash)
err = gp.morphClient.UpdateNeoFSAlphabetList(updPrm)
}
if err != nil {
if err = gp.morphClient.UpdateNeoFSAlphabetList(updPrm); err != nil {
gp.log.Error(logs.GovernanceCantUpdateInnerRingListWithNewAlphabetKeys,
zap.String("error", err.Error()))
}
}
func (gp *Processor) updateNotaryRoleInSidechain(newAlphabet keys.PublicKeys, txHash util.Uint256) {
if gp.notaryDisabled {
return
}
updPrm := client.UpdateNotaryListPrm{}
updPrm.SetList(newAlphabet)

View file

@ -87,8 +87,6 @@ type (
mainnetClient MainnetClient
morphClient MorphClient
notaryDisabled bool
designate util.Uint160
}
@ -105,8 +103,6 @@ type (
MainnetClient MainnetClient
FrostFSClient FrostFSClient
NetmapClient NetmapClient
NotaryDisabled bool
}
)
@ -148,7 +144,6 @@ func New(p *Params) (*Processor, error) {
irFetcher: p.IRFetcher,
mainnetClient: p.MainnetClient,
morphClient: p.MorphClient,
notaryDisabled: p.NotaryDisabled,
designate: designate,
}, nil
}