Skip to content

Commit

Permalink
Merge pull request #4082 from oasisprotocol/ptrus/stable/21.2.x/ias-p…
Browse files Browse the repository at this point in the history
…roxy

[BACKPORT/21.2.x] multiple backports
  • Loading branch information
ptrus authored Jun 25, 2021
2 parents 9fa585d + b121f40 commit 1d7f325
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/4081.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ias/proxy/client: `GetSigRL` don't panic if IAS proxy not configured
1 change: 1 addition & 0 deletions .changelog/4083.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/worker/executor: skip proposer timeout if batch was received
3 changes: 3 additions & 0 deletions go/ias/proxy/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ func (c *proxyClient) GetSPIDInfo(ctx context.Context) (*api.SPIDInfo, error) {
}

func (c *proxyClient) GetSigRL(ctx context.Context, epidGID uint32) ([]byte, error) {
if c.endpoint == nil {
return nil, fmt.Errorf("IAS proxy is not configured, mock used")
}
return c.endpoint.GetSigRL(ctx, epidGID)
}

Expand Down
19 changes: 17 additions & 2 deletions go/worker/compute/executor/committee/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ func (n *Node) proposeTimeoutLocked(roundCtx context.Context) error {
)
n.proposingTimeout = true
tx := roothash.NewRequestProposerTimeoutTx(0, nil, n.commonNode.Runtime.ID(), n.commonNode.CurrentBlock.Header.Round)
go func() {
go func(round uint64) {
// Wait a bit before actually proposing a timeout, to give the current
// scheduler some time to propose a batch in case it just received it.
//
Expand All @@ -776,8 +776,23 @@ func (n *Node) proposeTimeoutLocked(roundCtx context.Context) error {
select {
case <-time.After(proposeTimeoutDelay):
case <-roundCtx.Done():
n.logger.Info("not requesting proposer timeout, round context canceled")
return
}

// Make sure we are still in the right state/round.
n.commonNode.CrossNode.Lock()
if _, ok := n.state.(StateWaitingForBatch); !ok || round != n.commonNode.CurrentBlock.Header.Round {
n.logger.Info("not requesting proposer timeout",
"height", n.commonNode.Height,
"current_block_round", n.commonNode.CurrentBlock.Header.Round,
"proposing_round", round,
"state", n.state,
)
n.commonNode.CrossNode.Unlock()
return
}
n.commonNode.CrossNode.Unlock()

err := consensus.SignAndSubmitTx(roundCtx, n.commonNode.Consensus, n.commonNode.Identity.NodeSigner, tx)
switch err {
Expand All @@ -797,7 +812,7 @@ func (n *Node) proposeTimeoutLocked(roundCtx context.Context) error {
n.proposingTimeout = false
n.commonNode.CrossNode.Unlock()
}
}()
}(n.commonNode.CurrentBlock.Header.Round)

return nil
}
Expand Down

0 comments on commit 1d7f325

Please sign in to comment.