Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): Fix status CatchingUp field updating #971

Merged
merged 13 commits into from
Jul 31, 2024

Conversation

zale144
Copy link
Contributor

@zale144 zale144 commented Jul 18, 2024

PR Standards

Opening a pull request should be able to meet the following requirements

--

PR naming convention: https://hackmd.io/@nZpxHZ0CT7O5ngTp0TP9mg/HJP_jrm7A


Close #935

Basically, the idea is to have the CatchingUp value be derived as such:

CatchingUp = targetHeight > latestHeight

My guess is that there might need to be some tolerance there, in case a new settlement batch is submitted, and at the same moment the /status is queried.

For Author:

  • Targeted PR against correct branch
  • included the correct type prefix in the PR title
  • Linked to Github issue with discussion and accepted design
  • Targets only one github issue
  • Wrote unit and integration tests
  • All CI checks have passed
  • Added relevant godoc comments

For Reviewer:

  • confirmed the correct type prefix in the PR title
  • Reviewers assigned
  • confirmed all author checklist items have been addressed

After reviewer approval:

  • In case targets main branch, PR should be squashed and merged.
  • In case PR targets a release branch, PR should be rebased.

@zale144 zale144 self-assigned this Jul 18, 2024
@omritoptix omritoptix marked this pull request as ready for review July 20, 2024 10:02
@omritoptix omritoptix requested a review from a team as a code owner July 20, 2024 10:02
@@ -751,13 +748,13 @@ func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) {
LatestAppHash: latestAppHash[:],
LatestBlockHeight: int64(latestHeight),
LatestBlockTime: time.Unix(0, int64(latestBlockTimeNano)),
CatchingUp: c.node.BlockManager.TargetHeight.Load() > latestHeight,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

u need to set TargetHeight also in syncBlockManager , currnetly u made it event based only

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field needs a docstring as well IMO
the other ones are obvious and fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix pushed

block/manager.go Outdated
@@ -64,6 +64,7 @@ type Manager struct {
// It is ALSO used by the producer, because the producer needs to check if it can prune blocks and it wont'
// prune anything that might be submitted in the future. Therefore, it must be atomic.
LastSubmittedHeight atomic.Uint64
TargetHeight atomic.Uint64
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's redundent. both LastSubmittedHeight and TargetHeight are actually LatestHeightOnSL

@zale144 zale144 requested a review from mtsitrin July 22, 2024 13:43
block/sync.go Outdated
@@ -42,6 +42,7 @@ func (m *Manager) SyncToTargetHeightLoop(ctx context.Context) (err error) {
continue
}
types.RollappHubHeightGauge.Set(float64(h))
m.LastSubmittedHeight.Store(h)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that name is confusing.
as a node which is catching up you're most likely didn't submit any height. I guess you mean here last settlement height, cause this is only for heights recieved by the DA - However, you can have also heights recieved by p2p (most likely this will be the case for syncing) which you don't capture currently.

I think the correct way to go around it is:

  1. name it LastSeenHeight
  2. update it on all sync options (da, p2p)

@zale144 zale144 requested a review from omritoptix July 24, 2024 08:06
block/gossip.go Outdated Show resolved Hide resolved
block/manager.go Outdated Show resolved Hide resolved
@danwt danwt self-requested a review July 25, 2024 11:51
Copy link
Contributor

@danwt danwt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure how this relates to the targetSyncHeight field and why we can just have one field

@@ -751,13 +748,13 @@ func (c *Client) Status(ctx context.Context) (*ctypes.ResultStatus, error) {
LatestAppHash: latestAppHash[:],
LatestBlockHeight: int64(latestHeight),
LatestBlockTime: time.Unix(0, int64(latestBlockTimeNano)),
CatchingUp: c.node.BlockManager.TargetHeight.Load() > latestHeight,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this field needs a docstring as well IMO
the other ones are obvious and fine

@zale144 zale144 requested a review from mtsitrin July 31, 2024 11:10
@mtsitrin mtsitrin merged commit 402dd00 into main Jul 31, 2024
6 checks passed
@mtsitrin mtsitrin deleted the zale144/935-status-catching_up-fix branch July 31, 2024 20:47
omritoptix pushed a commit that referenced this pull request Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

/status endpoints sync_info.catching_up field always shows false
4 participants