Skip to content

Etcm 175 sync reporting issues#735

Merged
kapke merged 1 commit intodevelopfrom
etcm-175-sync-reporting-issues
Oct 29, 2020
Merged

Etcm 175 sync reporting issues#735
kapke merged 1 commit intodevelopfrom
etcm-175-sync-reporting-issues

Conversation

@kapke
Copy link
Copy Markdown
Contributor

@kapke kapke commented Oct 14, 2020

Description

Update eth_syncing method to standarized output (https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/etclabscore/ethereum-json-rpc-specification/master/openrpc.json&uiSchema%5BappBar%5D%5Bui:input%5D=false)) and move sync progress reporting into sync module.

Important Changes Introduced

A SyncProtocol is used now for high-level communication between sync controller and specific implementations as well as outside sync controller. Probably it makes sense to further extend that change and hide it behind a well-typed task-returning interfaces.

State breakage is related to changed datatype for tracking state nodes progress - from Int to Long (as in sync state scheduler)

Testing

  1. All automatic tests should pass (most notably unit and it ones)
  2. When sync is actually happening (data is being actively fetched from network) - eth_syncing should return full response, including information about state nodes.

@kapke kapke self-assigned this Oct 14, 2020
@kapke kapke added the BREAKS STATE Affects self state retro-compatibility, needs data wiping label Oct 14, 2020
Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/SyncStateSchedulerActor.scala Outdated
Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/SyncStateSchedulerActor.scala Outdated
Comment thread src/main/scala/io/iohk/ethereum/blockchain/sync/regular/RegularSync.scala Outdated
): Receive = {
case ReportStats =>
syncInitiator ! StateSyncStats(
currentStats.saved + currentState.memBatch.size,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

again question of granularity, as if restart happen and membatch won't be persisted then user may end up with lesser number of nodes reporter after restart. If someone is paranoic enought it can mean for him that some data was lost (i kinda already see QA reporting it that some nodes were lost while testing restarting :D )

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I see your point. Let me test that as I'm not 100% sure whether that's the wanted behavior

@kapke kapke force-pushed the etcm-175-sync-reporting-issues branch 2 times, most recently from 2691c6c to 3b81587 Compare October 16, 2020 17:00
@lemastero
Copy link
Copy Markdown
Contributor

lemastero commented Oct 17, 2020

After margin [ETCM-141] scalafmt . This PR can be updated by git merge etcm-175-sync-reporting-issues-fmt2

Changes:
+1296 -540
+1172 -477

ec: ExecutionContext
): Future[(List[Block], Option[Any])] =
if (blocks.isEmpty) {
supervisor ! ProgressProtocol.ImportedBlock(importedBlocks.map(_.number).max)
Copy link
Copy Markdown
Contributor

@mmrozek mmrozek Oct 20, 2020

Choose a reason for hiding this comment

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

It could be importedBlocks.headOption.map(_.number).getOrElse(0). In the case when we ex. try to import 1 block and it will be a duplicate importedBlocks.map(_.number).max will return an exception

highestBlock = highestBlock
def syncing(req: SyncingRequest): ServiceResponse[SyncingResponse] =
syncingController
.ask(SyncProtocol.GetStatus)(getTransactionFromPoolTimeout)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why getTransactionFromPoolTimeout ?

Comment thread src/test/resources/application.conf Outdated
peers-to-choose-pivot-block-margin = 1
pivot-block-offset = 500
min-peers-to-choose-target-block = 2
target-block-offset = 500
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you make this change? I think it is incorrect. min-peers-to-choose-target-block and target-block-offset are not used anymore

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Wrong resolution after merging in changes in pivot block selection. Fixed

val defaultState =
SyncState(defaultpivotBlockHeader, defaultSafeDownloadTarget, bestBlockHeaderNumber = defaultBestBlock)
SyncState(
defaultpivotBlockHeader,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Very minor: it should be defaultPivotBlockHeader

@kapke kapke force-pushed the etcm-175-sync-reporting-issues branch 2 times, most recently from 631d3a1 to 443ea00 Compare October 27, 2020 15:11
it should "sync state to different tries when peer provide mixed responses" in new TestSetup() {
forAll(ObjectGenerators.genMultipleNodeData(1000)) { nodeData =>
val initiator = TestProbe()
initiator.ignoreMsg { case SyncStateSchedulerActor.StateSyncStats(_, _) => true }
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this need to be added also in last test start state sync when receiving start signal while bloom filter is loading

@kapke kapke force-pushed the etcm-175-sync-reporting-issues branch from 443ea00 to e9f1032 Compare October 28, 2020 09:46
Copy link
Copy Markdown
Contributor

@mmrozek mmrozek left a comment

Choose a reason for hiding this comment

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

LGTM!

@kapke kapke force-pushed the etcm-175-sync-reporting-issues branch 5 times, most recently from b57793f to dde2b38 Compare October 28, 2020 16:11
[ETCM-175][WIP] Introduce sync protocol, provide (not working yet :() tests for both regular sync and fast sync, provide initial implementation of reporting sync progress through SyncController

[ETCM-175] Make RegularSync reporting progress properly

[ETCM-175] Fix most of sync reporting tests

[ETCM-175] Make all tests pass 🎇

[ETCM-175] Switch eth_syncing to use SyncProtocol now

[ETCM-175] Cleanup

[ETCM-175] Update state sync progress with each response received

[ETCM-175] Rename best known block in regular sync progress state

[ETCM-175] Filer out empty state progress in fast sync

[ETCM-175] Return initial incomplete state on fast sync

[ETCM-175] Introduce config for ask timeout
@kapke kapke force-pushed the etcm-175-sync-reporting-issues branch from dde2b38 to 6a67888 Compare October 29, 2020 08:20
@kapke kapke merged commit c340728 into develop Oct 29, 2020
@kapke kapke deleted the etcm-175-sync-reporting-issues branch October 29, 2020 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BREAKS STATE Affects self state retro-compatibility, needs data wiping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants