[#392] ir: Remove bitsize from IR indices

There is no need to specify that IR indices are 32 bits in size.

Change return types of `Indexer` interface methods in audit and alphabet
packages. Support interface changes in `Server` implementation.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-02-21 09:28:53 +03:00 committed by Alex Vanin
parent 645bef9de9
commit 397c3b6757
4 changed files with 9 additions and 9 deletions

View file

@ -15,9 +15,9 @@ func (np *Processor) processEmit() {
np.log.Info("passive mode, ignore gas emission event") np.log.Info("passive mode, ignore gas emission event")
return return
} else if int(index) >= len(np.alphabetContracts) { } else if index >= len(np.alphabetContracts) {
np.log.Debug("node is out of alphabet range, ignore gas emission event", np.log.Debug("node is out of alphabet range, ignore gas emission event",
zap.Int32("index", index)) zap.Int("index", index))
return return
} }

View file

@ -12,7 +12,7 @@ import (
type ( type (
// Indexer is a callback interface for inner ring global state. // Indexer is a callback interface for inner ring global state.
Indexer interface { Indexer interface {
Index() int32 Index() int
} }
// Processor of events produced for alphabet contracts in sidechain. // Processor of events produced for alphabet contracts in sidechain.

View file

@ -20,8 +20,8 @@ import (
type ( type (
// Indexer is a callback interface for inner ring global state. // Indexer is a callback interface for inner ring global state.
Indexer interface { Indexer interface {
Index() int32 Index() int
InnerRingSize() int32 InnerRingSize() int
} }
// NeoFSClientCache is an interface for cache of neofs RPC clients // NeoFSClientCache is an interface for cache of neofs RPC clients

View file

@ -25,14 +25,14 @@ func (s *Server) IsActive() bool {
// Index is a getter for a global index of node in inner ring list. Negative // Index is a getter for a global index of node in inner ring list. Negative
// index means that node is not in the inner ring list. // index means that node is not in the inner ring list.
func (s *Server) Index() int32 { func (s *Server) Index() int {
return s.innerRingIndex.Load() return int(s.innerRingIndex.Load())
} }
// InnerRingSize is a getter for a global size of inner ring list. This value // InnerRingSize is a getter for a global size of inner ring list. This value
// paired with inner ring index. // paired with inner ring index.
func (s *Server) InnerRingSize() int32 { func (s *Server) InnerRingSize() int {
return s.innerRingSize.Load() return int(s.innerRingSize.Load())
} }
func (s *Server) voteForSidechainValidator(validators []keys.PublicKey) error { func (s *Server) voteForSidechainValidator(validators []keys.PublicKey) error {