diff --git a/pkg/innerring/blocktimer.go b/pkg/innerring/blocktimer.go index 3c54a6ec..76f8a2c0 100644 --- a/pkg/innerring/blocktimer.go +++ b/pkg/innerring/blocktimer.go @@ -93,7 +93,7 @@ func newEpochTimer(args *epochTimerArgs) *timer.BlockTimer { return } - err := args.cnrWrapper.StopEstimation(epochN - 1) + err := args.cnrWrapper.StopEstimationNotary(epochN - 1) if err != nil { args.l.Warn("can't stop epoch estimation", zap.Uint64("epoch", epochN), diff --git a/pkg/innerring/processors/netmap/process_epoch.go b/pkg/innerring/processors/netmap/process_epoch.go index ac2bb6b8..38781dc5 100644 --- a/pkg/innerring/processors/netmap/process_epoch.go +++ b/pkg/innerring/processors/netmap/process_epoch.go @@ -27,7 +27,7 @@ func (np *Processor) processNewEpoch(epoch uint64) { } if epoch > 0 { // estimates are invalid in genesis epoch - err = np.containerWrp.StartEstimation(epoch - 1) + err = np.containerWrp.StartEstimationNotary(epoch - 1) if err != nil { np.log.Warn("can't start container size estimation", zap.Uint64("epoch", epoch), diff --git a/pkg/morph/client/container/estimations.go b/pkg/morph/client/container/estimations.go index 118ee296..0a03aa76 100644 --- a/pkg/morph/client/container/estimations.go +++ b/pkg/morph/client/container/estimations.go @@ -21,6 +21,13 @@ func (e *StopEstimation) SetEpoch(v int64) { } func (c *Client) StartEstimation(args StartEstimation) error { + return errors.Wrapf(c.client.Invoke( + c.startEstimation, + args.epoch, + ), "could not invoke method (%s)", c.startEstimation) +} + +func (c *Client) StartEstimationNotary(args StartEstimation) error { return errors.Wrapf(c.client.NotaryInvoke( c.startEstimation, args.epoch, @@ -28,6 +35,13 @@ func (c *Client) StartEstimation(args StartEstimation) error { } func (c *Client) StopEstimation(args StopEstimation) error { + return errors.Wrapf(c.client.Invoke( + c.stopEstimation, + args.epoch, + ), "could not invoke method (%s)", c.stopEstimation) +} + +func (c *Client) StopEstimationNotary(args StopEstimation) error { return errors.Wrapf(c.client.NotaryInvoke( c.stopEstimation, args.epoch, diff --git a/pkg/morph/client/container/wrapper/estimations.go b/pkg/morph/client/container/wrapper/estimations.go index 49785992..0c17c2b5 100644 --- a/pkg/morph/client/container/wrapper/estimations.go +++ b/pkg/morph/client/container/wrapper/estimations.go @@ -12,6 +12,15 @@ func (w *Wrapper) StartEstimation(epoch uint64) error { return w.client.StartEstimation(args) } +// StartEstimationNotary votes to produce start estimation notification through +// notary contract. +func (w *Wrapper) StartEstimationNotary(epoch uint64) error { + args := container.StartEstimation{} + args.SetEpoch(int64(epoch)) + + return w.client.StartEstimationNotary(args) +} + // StopEstimation votes to produce stop estimation notification. func (w *Wrapper) StopEstimation(epoch uint64) error { args := container.StopEstimation{} @@ -19,3 +28,12 @@ func (w *Wrapper) StopEstimation(epoch uint64) error { return w.client.StopEstimation(args) } + +// StopEstimationNotary votes to produce stop estimation notification through +// notary contract. +func (w *Wrapper) StopEstimationNotary(epoch uint64) error { + args := container.StopEstimation{} + args.SetEpoch(int64(epoch)) + + return w.client.StopEstimationNotary(args) +}