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
|
@ -161,16 +161,15 @@ func (s *Server) createAlphaSync(cfg *viper.Viper, frostfsCli *frostfsClient.Cli
|
||||||
} else {
|
} else {
|
||||||
// create governance processor
|
// create governance processor
|
||||||
governanceProcessor, err := governance.New(&governance.Params{
|
governanceProcessor, err := governance.New(&governance.Params{
|
||||||
Log: s.log,
|
Log: s.log,
|
||||||
FrostFSClient: frostfsCli,
|
FrostFSClient: frostfsCli,
|
||||||
NetmapClient: s.netmapClient,
|
NetmapClient: s.netmapClient,
|
||||||
AlphabetState: s,
|
AlphabetState: s,
|
||||||
EpochState: s,
|
EpochState: s,
|
||||||
Voter: s,
|
Voter: s,
|
||||||
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
|
||||||
|
|
|
@ -42,16 +42,15 @@ func TestHandleAlphabetSyncEvent(t *testing.T) {
|
||||||
|
|
||||||
proc, err := New(
|
proc, err := New(
|
||||||
&Params{
|
&Params{
|
||||||
Log: test.NewLogger(t, true),
|
Log: test.NewLogger(t, true),
|
||||||
EpochState: es,
|
EpochState: es,
|
||||||
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,
|
NetmapClient: nm,
|
||||||
NetmapClient: nm,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -122,16 +123,15 @@ func TestHandleAlphabetDesignateEvent(t *testing.T) {
|
||||||
|
|
||||||
proc, err := New(
|
proc, err := New(
|
||||||
&Params{
|
&Params{
|
||||||
Log: test.NewLogger(t, true),
|
Log: test.NewLogger(t, true),
|
||||||
EpochState: es,
|
EpochState: es,
|
||||||
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,
|
NetmapClient: nm,
|
||||||
NetmapClient: nm,
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -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 := client.UpdateAlphabetListPrm{}
|
||||||
updPrm := nmClient.UpdateIRPrm{}
|
updPrm.SetList(newInnerRing)
|
||||||
|
updPrm.SetHash(txHash)
|
||||||
|
|
||||||
updPrm.SetKeys(newInnerRing)
|
if err = gp.morphClient.UpdateNeoFSAlphabetList(updPrm); err != nil {
|
||||||
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 {
|
|
||||||
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
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -138,18 +134,17 @@ func New(p *Params) (*Processor, error) {
|
||||||
designate := p.MainnetClient.GetDesignateHash()
|
designate := p.MainnetClient.GetDesignateHash()
|
||||||
|
|
||||||
return &Processor{
|
return &Processor{
|
||||||
log: p.Log,
|
log: p.Log,
|
||||||
pool: pool,
|
pool: pool,
|
||||||
frostfsClient: p.FrostFSClient,
|
frostfsClient: p.FrostFSClient,
|
||||||
netmapClient: p.NetmapClient,
|
netmapClient: p.NetmapClient,
|
||||||
alphabetState: p.AlphabetState,
|
alphabetState: p.AlphabetState,
|
||||||
epochState: p.EpochState,
|
epochState: p.EpochState,
|
||||||
voter: p.Voter,
|
voter: p.Voter,
|
||||||
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