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

Refactor provider broadcast #4744

Merged
merged 10 commits into from
Sep 26, 2023
Merged

Conversation

zhangchiqing
Copy link
Member

This PR move the condition of "whether EN should broadcast execution result" from ingestion engine to provider engine, which reduce the ingestion engine complexity.

@codecov-commenter
Copy link

codecov-commenter commented Sep 21, 2023

Codecov Report

Patch coverage: 76.59% and project coverage change: -0.05% ⚠️

Comparison is base (90c09b7) 55.62% compared to head (978d46c) 55.57%.
Report is 51 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4744      +/-   ##
==========================================
- Coverage   55.62%   55.57%   -0.05%     
==========================================
  Files         931      932       +1     
  Lines       86292    86370      +78     
==========================================
+ Hits        47996    47997       +1     
- Misses      34665    34742      +77     
  Partials     3631     3631              
Flag Coverage Δ
unittests 55.57% <76.59%> (-0.05%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
cmd/execution_builder.go 0.00% <ø> (ø)
engine/execution/provider/engine.go 73.86% <62.50%> (+5.70%) ⬆️
engine/execution/ingestion/engine.go 44.84% <91.30%> (-15.51%) ⬇️

... and 11 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

engine/execution/provider/engine.go Show resolved Hide resolved
engine/execution/provider/engine_test.go Outdated Show resolved Hide resolved
broadcasted = true
}
}
broadcasted, err := e.providerEngine.BroadcastExecutionReceipt(
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like the only use of the returned boolean, and that is only for logging. Does it still make sense to return this boolean? If we still want this in the log, can we not move the logging inside of BroadcastExecutionReceipt

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's only used for logging for now. And yes, we could move the logging to the provider engine, but it's not hurt to still return the boolean. I'd like to keep as is so that we don't have to introduce additional logging just to know whether it's broadcasted. It's simple to just merge the broadcaster along with other property of the receipts, so that it's easy to search for the receipt.

@zhangchiqing zhangchiqing added this pull request to the merge queue Sep 26, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Sep 26, 2023
@@ -471,29 +464,11 @@ func (e *Engine) executeBlock(
return
}

// if the receipt is for a sealed block, then no need to broadcast it.
lastSealed, err := e.state.Sealed().Head()
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only place where protocol state is being used, which is to check if a result can be skipped for broadcasting if it's already sealed.

After moving this check to provider engine, the ingestion engine no long depend on protocol state, therefore the protocol state can be removed from the engine

@@ -785,6 +744,7 @@ func TestBlocksArentExecutedMultipleTimes_multipleBlockEnqueue(t *testing.T) {
}

func TestBlocksArentExecutedMultipleTimes_collectionArrival(t *testing.T) {
unittest.SkipUnless(t, unittest.TEST_FLAKY, "To be fixed later")
Copy link
Member Author

Choose a reason for hiding this comment

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

this test will be refactored in the follow up PR

broadcasted = true
}
}
broadcasted, err := e.providerEngine.BroadcastExecutionReceipt(
Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it's only used for logging for now. And yes, we could move the logging to the provider engine, but it's not hurt to still return the boolean. I'd like to keep as is so that we don't have to introduce additional logging just to know whether it's broadcasted. It's simple to just merge the broadcaster along with other property of the receipts, so that it's easy to search for the receipt.

@zhangchiqing zhangchiqing added this pull request to the merge queue Sep 26, 2023
Merged via the queue into master with commit 366ebaf Sep 26, 2023
36 checks passed
@zhangchiqing zhangchiqing deleted the leo/refactor-provider-broadcast branch September 26, 2023 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants