Flag that only switches statediffing on once the node has synced to head #155

Closed
opened 2021-11-19 03:34:05 +00:00 by i-norden · 3 comments
Member

CLI flag that configures the node such that it switches on the statediffing service only after the node has caught up to the head of the chain.

CLI flag that configures the node such that it switches on the statediffing service only after the node has caught up to the head of the chain.
abdulrabbani00 commented 2022-03-07 21:31:13 +00:00 (Migrated from github.com)

@i-norden - I am making the following assumptions, please correct me if they are wrong:

  • You want me to "add" a new CLI flag which turns the state diff service on once geth has caught up to the head of the blockchain.
  • The head of the blockchain refers to the latest published event.

I will take the following approach:

  • Figure out how the statediffing service is turned on and off.
  • Understand how we geth knows if it has "caught up" to the head of the chain.

Once I understand both components, I will add the flag. I will take extra time to "play" around with the above two components since they seem to appear in other tickets.

@i-norden - I am making the following assumptions, please correct me if they are wrong: * You want me to "add" a new CLI flag which turns the state diff service on once geth has caught up to the head of the blockchain. * The head of the blockchain refers to the latest published event. I will take the following approach: * Figure out how the statediffing service is turned on and off. * Understand how we geth knows if it has "caught up" to the head of the chain. Once I understand both components, I will add the flag. I will take extra time to "play" around with the above two components since they seem to appear in other tickets.
abdulrabbani00 commented 2022-03-08 13:31:03 +00:00 (Migrated from github.com)

I have a general understanding of how the state-diff service is started in geth.

  • init():cmd/geth/main.go ->
  • geth():cmd/geth/main.go →
  • makeFullNode():cmd/geth/config.go →
    • This function registers the statediff service
  • RegisterStateDiffService(): cmd/utils/flags.go →
  • New():statediff/service.go ->
  • RegisterLifecycle():node/node.go

The question I need to answer is:

  • Do I want to wait to add the state diff service to the lifecycle object until geth has caught up to head?
  • Do I want to start the state-diff service as usual but put it in some "paused" state until geth catches up to head?
  • Do I want to start the state-diff service and let it run, but don't perform the state diff if the block number is not the head block?
    • This would be done by adding some logic in the Loop():statediff/service.go method.
    • This can actually also be done more "cleanly" at Start():statediff/service.go. We don't actually call the Loop function until we have caught up to get. This might be the least intrusive and cleanest way.

The following two discoveries will help me decide the best way to approach:

  • Does makeFullNode() need to run before geth can catch up to head?
    • If this function needs to be executed to start geth (which I think might be the case, although I do not say that with any degree of confidence yet), we have two options.
      • Remove the RegisterStateDiffService() from this function call, and register it elsewhere.
      • Start the state diff service in a "paused" state.
  • Does the state diff service have the capability to be started in some "paused" state?
    • If this functionality is already present, it might make sense to start the state diff service at boot up in a "paused" state and put it in a "running" state after geth catches up to head.
    • Otherwise, we might want to consider the lift and utility of adding such a feature.
I have a general understanding of how the state-diff service is started in geth. - `init():cmd/geth/main.go ->` - `geth():cmd/geth/main.go →` - `makeFullNode():cmd/geth/config.go →` - This function registers the statediff service - `RegisterStateDiffService(): cmd/utils/flags.go →` - `New():statediff/service.go -> ` - `RegisterLifecycle():node/node.go` The question I need to answer is: * Do I want to wait to add the state diff service to the `lifecycle` object until geth has caught up to head? * Do I want to start the state-diff service as usual but put it in some "paused" state until geth catches up to head? * Do I want to start the state-diff service and let it run, but don't perform the state diff if the block number is not the head block? * This would be done by adding some logic in the `Loop():statediff/service.go` method. * This can actually also be done more "cleanly" at `Start():statediff/service.go`. We don't actually call the `Loop` function until we have caught up to get. __This might be the least intrusive and cleanest way.__ The following two discoveries will help me decide the best way to approach: * Does `makeFullNode()` need to run before geth can catch up to head? * If this function needs to be executed to start geth (which I think might be the case, although I do not say that with any degree of confidence yet), we have two options. * Remove the `RegisterStateDiffService()` from this function call, and register it elsewhere. * Start the state diff service in a "paused" state. * Does the state diff service have the capability to be started in some "paused" state? * If this functionality is already present, it might make sense to start the state diff service at boot up in a "paused" state and put it in a "running" state after geth catches up to head. * Otherwise, we might want to consider the lift and utility of adding such a feature.
abdulrabbani00 commented 2022-03-09 13:56:50 +00:00 (Migrated from github.com)

What I have accomplished:

  • Making code changes for the sync functionality.
  • Starting to create a process for building a local test environment without having to go through GitHub.

Working on next:

  • Working on utilizing dapptools locally, without having the need to merge code to github.
  • Spot checking code changes.
  • Adding functionality for the "flag," and any other necessary code changes.
  • Adding unit and integration tests.
What I have accomplished: * Making code changes for the sync functionality. * Starting to create a process for building a local test environment without having to go through GitHub. Working on next: * Working on utilizing dapptools locally, without having the need to merge code to github. * Spot checking code changes. * Adding functionality for the "flag," and any other necessary code changes. * Adding unit and integration tests.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/go-ethereum#155
No description provided.