forked from TrueCloudLab/frostfs-node
[#338] ir: Drop notaryless code from governance
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
0ab589dd52
commit
53a1b15693
4 changed files with 52 additions and 75 deletions
|
@ -170,7 +170,6 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli
|
||||||
IRFetcher: irf,
|
IRFetcher: irf,
|
||||||
MorphClient: s.morphClient,
|
MorphClient: s.morphClient,
|
||||||
MainnetClient: s.mainnetClient,
|
MainnetClient: s.mainnetClient,
|
||||||
NotaryDisabled: s.sideNotaryConfig.disabled,
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -47,7 +47,6 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
|
||||||
AlphabetState: as,
|
AlphabetState: as,
|
||||||
Voter: v,
|
Voter: v,
|
||||||
IRFetcher: irf,
|
IRFetcher: irf,
|
||||||
NotaryDisabled: true,
|
|
||||||
MorphClient: m,
|
MorphClient: m,
|
||||||
MainnetClient: mn,
|
MainnetClient: mn,
|
||||||
FrostFSClient: f,
|
FrostFSClient: f,
|
||||||
|
@ -74,17 +73,19 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
|
||||||
},
|
},
|
||||||
}, v.votes, "invalid vote calls")
|
}, v.votes, "invalid vote calls")
|
||||||
|
|
||||||
var irUpdateExp nmClient.UpdateIRPrm
|
var irUpdateExp []nmClient.UpdateIRPrm
|
||||||
irUpdateExp.SetKeys(testKeys.newInnerRingExp)
|
|
||||||
irUpdateExp.SetHash(ev.txHash)
|
|
||||||
|
|
||||||
require.EqualValues(t, []nmClient.UpdateIRPrm{irUpdateExp}, nm.updates, "invalid IR updates")
|
require.EqualValues(t, irUpdateExp, nm.updates, "invalid IR updates")
|
||||||
|
|
||||||
var expAlphabetUpdates []client.UpdateAlphabetListPrm
|
var expAlphabetUpdate client.UpdateAlphabetListPrm
|
||||||
require.EqualValues(t, expAlphabetUpdates, m.alphabetUpdates, "invalid alphabet updates")
|
expAlphabetUpdate.SetHash(ev.txHash)
|
||||||
|
expAlphabetUpdate.SetList(testKeys.newInnerRingExp)
|
||||||
|
require.EqualValues(t, []client.UpdateAlphabetListPrm{expAlphabetUpdate}, m.alphabetUpdates, "invalid alphabet updates")
|
||||||
|
|
||||||
var expNotaryUpdates []client.UpdateNotaryListPrm
|
var expNotaryUpdate client.UpdateNotaryListPrm
|
||||||
require.EqualValues(t, expNotaryUpdates, m.notaryUpdates, "invalid notary list updates")
|
expNotaryUpdate.SetHash(ev.txHash)
|
||||||
|
expNotaryUpdate.SetList(testKeys.newAlphabetExp)
|
||||||
|
require.EqualValues(t, []client.UpdateNotaryListPrm{expNotaryUpdate}, m.notaryUpdates, "invalid notary list updates")
|
||||||
|
|
||||||
buf := make([]byte, 8)
|
buf := make([]byte, 8)
|
||||||
binary.LittleEndian.PutUint64(buf, es.epoch)
|
binary.LittleEndian.PutUint64(buf, es.epoch)
|
||||||
|
@ -127,7 +128,6 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) {
|
||||||
AlphabetState: as,
|
AlphabetState: as,
|
||||||
Voter: v,
|
Voter: v,
|
||||||
IRFetcher: irf,
|
IRFetcher: irf,
|
||||||
NotaryDisabled: false,
|
|
||||||
MorphClient: m,
|
MorphClient: m,
|
||||||
MainnetClient: mn,
|
MainnetClient: mn,
|
||||||
FrostFSClient: f,
|
FrostFSClient: f,
|
||||||
|
|
|
@ -9,7 +9,6 @@ import (
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client"
|
||||||
frostfscontract "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/client/frostfs"
|
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/crypto/keys"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
|
@ -114,33 +113,17 @@ func (gp *Processor) updateNeoFSAlphabetRoleInSidechain(sidechainAlphabet, newAl
|
||||||
zap.String("after", prettyKeys(newInnerRing)),
|
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 := client.UpdateAlphabetListPrm{}
|
||||||
|
|
||||||
updPrm.SetList(newInnerRing)
|
updPrm.SetList(newInnerRing)
|
||||||
updPrm.SetHash(txHash)
|
updPrm.SetHash(txHash)
|
||||||
|
|
||||||
err = gp.morphClient.UpdateNeoFSAlphabetList(updPrm)
|
if err = gp.morphClient.UpdateNeoFSAlphabetList(updPrm); err != nil {
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
gp.log.Error(logs.GovernanceCantUpdateInnerRingListWithNewAlphabetKeys,
|
gp.log.Error(logs.GovernanceCantUpdateInnerRingListWithNewAlphabetKeys,
|
||||||
zap.String("error", err.Error()))
|
zap.String("error", err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (gp *Processor) updateNotaryRoleInSidechain(newAlphabet keys.PublicKeys, txHash util.Uint256) {
|
func (gp *Processor) updateNotaryRoleInSidechain(newAlphabet keys.PublicKeys, txHash util.Uint256) {
|
||||||
if gp.notaryDisabled {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
updPrm := client.UpdateNotaryListPrm{}
|
updPrm := client.UpdateNotaryListPrm{}
|
||||||
|
|
||||||
updPrm.SetList(newAlphabet)
|
updPrm.SetList(newAlphabet)
|
||||||
|
|
|
@ -87,8 +87,6 @@ type (
|
||||||
mainnetClient MainnetClient
|
mainnetClient MainnetClient
|
||||||
morphClient MorphClient
|
morphClient MorphClient
|
||||||
|
|
||||||
notaryDisabled bool
|
|
||||||
|
|
||||||
designate util.Uint160
|
designate util.Uint160
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,8 +103,6 @@ type (
|
||||||
MainnetClient MainnetClient
|
MainnetClient MainnetClient
|
||||||
FrostFSClient FrostFSClient
|
FrostFSClient FrostFSClient
|
||||||
NetmapClient NetmapClient
|
NetmapClient NetmapClient
|
||||||
|
|
||||||
NotaryDisabled bool
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -148,7 +144,6 @@ func New(p *Params) (*Processor, error) {
|
||||||
irFetcher: p.IRFetcher,
|
irFetcher: p.IRFetcher,
|
||||||
mainnetClient: p.MainnetClient,
|
mainnetClient: p.MainnetClient,
|
||||||
morphClient: p.MorphClient,
|
morphClient: p.MorphClient,
|
||||||
notaryDisabled: p.NotaryDisabled,
|
|
||||||
designate: designate,
|
designate: designate,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue