spacemeshos / api

Protobuf implementation of the Spacemesh API
MIT License
15 stars 9 forks source link

Add "until" field to PoetWaitRound, PoetWaitProof, AtxPublished events #297

Closed xearl4 closed 10 months ago

xearl4 commented 10 months ago

Many people currently use the gRPC AdminService's EventStream for simple go-spacemesh monitoring. This PR adds an "until" field to the PoetWaitRound, PoetWaitProof and AtxPublished events to make it a bit easier to see until when the node will wait after those events (related recent discussion in Discord).

Example events after this change:

  "poetWaitRound": {
    "current": 12,                                        
    "publish": 13,                                        
    "wait": "29238.819235612s",
    "until": "2024-01-09T07:00:21.151608967Z"
  }

  "poetWaitProof": {
    "publish": 13,
    "target": 14,
    "wait": "987972.244983544s",
    "until": "2024-01-20T20:00:00.000003843Z"
  }

  "atxPublished": {                                                                                                  
    "current": 12,                                                                                                   
    "target": 13,
    "id": "...", 
    "wait": "292017.668117248s",               
    "until": "2024-01-12T08:00:00.000001993Z"
  }

The above needs a corresponding change in go-spacemesh to actually fill in the "until" fields. I'll submit this dependent PR to go-spacemesh once the present PR is reviewed, merged and a new version tagged (if you have another process for dependent changes, just tell me and I'll be happy to follow it).

I also added a cosmetic change cleaning up indentation. If you'd prefer the cosmetic change to be a separate PR, just tell me, and I'll split things up.

fasmat commented 10 months ago

@xearl4 thanks. Since the change is backwards compatible I will merge it. It might however take some time until the next release where it would be included.