Skip to content

Commit

Permalink
feat: Show elapsed epoch and PSD wait epochs in UI (#1480)
Browse files Browse the repository at this point in the history
* show epochs

* fix devnet UI, use BlockdDelaySecs

* fix lint err

* Update gql/resolver.go

Co-authored-by: dirkmc <dirkmdev@gmail.com>

---------

Co-authored-by: dirkmc <dirkmdev@gmail.com>
  • Loading branch information
LexLuthr and dirkmc authored May 31, 2023
1 parent cd95724 commit 49df313
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions docker/devnet/boost/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ if [ ! -f $BOOST_PATH/.init.boost ]; then

echo Setting port in boost config...
sed -i 's|ip4/0.0.0.0/tcp/0|ip4/0.0.0.0/tcp/50000|g' $BOOST_PATH/config.toml
sed -i 's|127.0.0.1|0.0.0.0|g' $BOOST_PATH/config.toml

echo Done
touch $BOOST_PATH/.init.boost
Expand Down
2 changes: 1 addition & 1 deletion docker/devnet/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ services:
environment:
HTTP_BIND: "${HTTP_BIND:-127.0.0.1}"
HTTP_PORT: "${HTTP_PORT:-4080}"
network_mode: host
network_mode: host
10 changes: 7 additions & 3 deletions gql/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"errors"
"fmt"
"math"
"time"

"github.com/dustin/go-humanize"
"github.com/filecoin-project/boost-gfm/piecestore"
Expand All @@ -26,6 +27,7 @@ import (
"github.com/filecoin-project/boost/transport"
"github.com/filecoin-project/dagstore"
"github.com/filecoin-project/lotus/api/v1api"
"github.com/filecoin-project/lotus/build"
lotus_repo "github.com/filecoin-project/lotus/node/repo"
"github.com/google/uuid"
"github.com/graph-gophers/graphql-go"
Expand Down Expand Up @@ -527,14 +529,14 @@ func (dr *dealResolver) Retry() string {
}

func (dr *dealResolver) Message(ctx context.Context) string {
msg := dr.message(ctx, dr.ProviderDealState.Checkpoint)
msg := dr.message(ctx, dr.ProviderDealState.Checkpoint, dr.ProviderDealState.CheckpointAt)
if dr.ProviderDealState.Retry != types.DealRetryFatal && dr.ProviderDealState.Err != "" {
msg = "Paused at '" + msg + "': " + dr.ProviderDealState.Err
}
return msg
}

func (dr *dealResolver) message(ctx context.Context, checkpoint dealcheckpoints.Checkpoint) string {
func (dr *dealResolver) message(ctx context.Context, checkpoint dealcheckpoints.Checkpoint, checkpointAt time.Time) string {
switch checkpoint {
case dealcheckpoints.Accepted:
if dr.IsOffline {
Expand Down Expand Up @@ -570,7 +572,9 @@ func (dr *dealResolver) message(ctx context.Context, checkpoint dealcheckpoints.
case dealcheckpoints.Transferred:
return "Ready to Publish"
case dealcheckpoints.Published:
return "Awaiting Publish Confirmation"
elapsedEpochs := uint64(time.Since(checkpointAt).Seconds()) / build.BlockDelaySecs
confidenceEpochs := build.MessageConfidence * 2
return fmt.Sprintf("Awaiting Publish Confirmation (%d/%d epochs)", elapsedEpochs, confidenceEpochs)
case dealcheckpoints.PublishConfirmed:
return "Adding to Sector"
case dealcheckpoints.AddedPiece:
Expand Down

0 comments on commit 49df313

Please sign in to comment.