spacemeshos / api

Protobuf implementation of the Spacemesh API
MIT License
14 stars 8 forks source link

Feature: Enhanced activations data (for SM 0.2) #139

Open avive opened 3 years ago

avive commented 3 years ago

Motivation

We'd like to make the non-trivial activations flow transparent to users. Some activation state is local to the node which submits them to PoET and to the mesh and can't be obtained from the MeshService. We should add to the SmesherService capabilities to provide information about locally created and submitted activations.

Activations Local State

  1. Node submitted activation data to PoET service.
  2. Node got back PoET results.
  3. Node broadcasted an activation to other nodes..
  4. Activation on the mesh in epoch n (public mesh data - not really a local state).

Each of the states has a time-stamp and the last one has an epoch number.

Proposed new functionality

avive commented 3 years ago

So we have basic activation data for clients via the mesh api.

What we need to do to provide a decent UX for activations, is to add additional meta-data to activations returned by the api so clients have sufficient data to provide useful information to users and to keep them informed and on top of their activations. Here's an initial proposal for api additions:

An activation can only be in one of these states.

enum State {
    STATE_CREATED = 0;  // from post data
    STATE_SUBMITTED = 1; // to poet
    STATE_GOT_PROOF =2;  // from poet
    STATE_BROADCASTED = 3;  // to p2p net
    STATE_MESH =4;  // published on mesh
}

Add ActivationExtraData field to the Activation protobufs data type or add these fields directly to Activation if can be done in backwards compatible manner.

// timestamps are 0 when they are not set
message ActivationExtraData {
        uint64 Submitted =1; // timestamp when submitted to poet
    uint64 Proof = 2; // proof time  
    uint64 Broadcast = 3; // broadcast time
    uint64 MeshEpoch = 4; // epoch published on mesh (eligibility epoch is this epoch + 1 )
}

The first 3 fields will only be non-zero when this activation was created locally by the node that serves the api. In the case of all other activations, only the last field will be non-zero.

Based on this data, we would like to display more details about user's activations. Here are rough mocks of activations in smapp.

Activations List

Accessible from smesher screen. Should include all activations created with the smesher's id.

Activations List Screen


Activation Details

Activations Details Screen

Notice the eligibility info in the summary line. If Activation is on mesh on epoch e, then smesher is eligible for rewards in epoch e+1.

avive commented 3 years ago

@noamnelke @lrettig @moshababo fyi

avive commented 3 years ago

@moshababo - what we talked about - please review.