Skip to content

Commit

Permalink
include node ID in ProposalBuildFailed event
Browse files Browse the repository at this point in the history
  • Loading branch information
poszu committed Dec 31, 2024
1 parent 850c706 commit 338ce11
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions miner/remote_proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,19 @@ func (pb *RemoteProposalBuilder) build(
pb.signers.mu.Lock()
signers := maps.Values(pb.signers.signers)
pb.signers.mu.Unlock()
var err error
bcn, ok := beacons[epoch]
if !ok {
var err error
bcn, err = pb.beaconSvc.Beacon(ctx, epoch)
if err != nil {
pb.identityStates.Set(types.EmptyNodeID, &epoch, &smesherIdentity.ProposalBuildFailed{
ErrorMsg: fmt.Sprintf("beacon: %v", err),
Layer: layer,
})
return fmt.Errorf("beacon: %w", err)
err = fmt.Errorf("getting beacon: %w", err)
for _, s := range signers {
pb.identityStates.Set(s.signer.NodeID(), nil, &smesherIdentity.ProposalBuildFailed{
ErrorMsg: err.Error(),
Layer: layer,
})
}
return err
}
beacons[epoch] = bcn
}
Expand All @@ -197,7 +200,7 @@ func (pb *RemoteProposalBuilder) build(
)
eligibilities[nodeId] = proofs
pb.identityStates.SetEligibilities(nodeId, proofs)
pb.identityStates.Set(nodeId, &epoch, &smesherIdentity.Eligible{
pb.identityStates.Set(nodeId, nil, &smesherIdentity.Eligible{
Layers: proofs,
})
} else {
Expand All @@ -207,7 +210,7 @@ func (pb *RemoteProposalBuilder) build(
proposal, _, err := pb.proposalSvc.Proposal(ctx, layer, nodeId)
if err != nil {
pb.logger.Error("get partial proposal", zap.Error(err))
pb.identityStates.Set(nodeId, &epoch, &smesherIdentity.ProposalBuildFailed{
pb.identityStates.Set(nodeId, nil, &smesherIdentity.ProposalBuildFailed{
ErrorMsg: fmt.Sprintf("get partial proposal: %v", err),
Layer: layer,
})
Expand All @@ -232,7 +235,7 @@ func (pb *RemoteProposalBuilder) build(
err = proposal.Initialize()
if err != nil {
pb.logger.Error("failed to initialize proposal", zap.Error(err))
pb.identityStates.Set(nodeId, &epoch, &smesherIdentity.ProposalBuildFailed{
pb.identityStates.Set(nodeId, nil, &smesherIdentity.ProposalBuildFailed{
ErrorMsg: fmt.Sprintf("failed to initialize proposal: %v", err),
Layer: layer,
})
Expand All @@ -246,7 +249,7 @@ func (pb *RemoteProposalBuilder) build(
zap.Stringer("id", proposal.ID()),
zap.Error(err),
)
pb.identityStates.Set(nodeId, &epoch, &smesherIdentity.ProposalPublishFailed{
pb.identityStates.Set(nodeId, nil, &smesherIdentity.ProposalPublishFailed{
ErrorMsg: err.Error(),
Proposal: proposal.ID(),
Layer: proposal.Layer,
Expand Down

0 comments on commit 338ce11

Please sign in to comment.