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

Extended events logging port to v0.20 #1058

Merged
merged 6 commits into from
Jul 29, 2021
Merged

Conversation

m4ksio
Copy link
Contributor

@m4ksio m4ksio commented Jul 29, 2021

No description provided.

@m4ksio m4ksio requested a review from zhangchiqing July 29, 2021 17:00
@m4ksio m4ksio changed the base branch from master to v0.20 July 29, 2021 17:00
@@ -170,7 +170,7 @@ func main() {
rt := fvm.NewInterpreterRuntime()
vm := fvm.NewVirtualMachine(rt)
vmCtx := fvm.NewContext(node.Logger, node.FvmOptions...)
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx)
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Logger.With().Str("component", "chunk_verifier").Logger())
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be more readable if we just pass the logger here and do the rest internally. Otherwise, we always should make sure that the caller takes care of this part. As seen in the rest of PR, we need to replicate this pattern at least three times on all invocations, which literally makes code less DRY (Don't Repeat Yourself).

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Logger.With().Str("component", "chunk_verifier").Logger())
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Logger)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you are right, this will be better, let me refactor it

@@ -41,6 +44,7 @@ func NewChunkVerifier(vm VirtualMachine, vmCtx fvm.Context) *ChunkVerifier {
fvm.WithServiceEventCollectionEnabled(),
fvm.WithTransactionProcessors(fvm.NewTransactionInvocator(vmCtx.Logger)),
),
logger: logger,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
logger: logger,
logger: logger.With().Str("component", "chunk_verifier").Logger(),

@@ -828,7 +828,7 @@ func VerificationNode(t testing.TB,
fvm.WithBlocks(blockFinder),
)

chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx)
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Log.With().Str("component", "chunk_verifier").Logger())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Log.With().Str("component", "chunk_verifier").Logger())
chunkVerifier := chunks.NewChunkVerifier(vm, vmCtx, node.Log)

@@ -191,7 +191,7 @@ func executeBlockAndVerify(t *testing.T, txs [][]*flow.TransactionBody) *executi
_, chdps, er, err := execution.GenerateExecutionResultAndChunkDataPacks(prevResultId, initialCommit, computationResult)
require.NoError(t, err)

verifier := chunks.NewChunkVerifier(vm, fvmContext)
verifier := chunks.NewChunkVerifier(vm, fvmContext, logger.With().Str("component", "chunk_verifier").Logger())
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
verifier := chunks.NewChunkVerifier(vm, fvmContext, logger.With().Str("component", "chunk_verifier").Logger())
verifier := chunks.NewChunkVerifier(vm, fvmContext, logger)

@codecov-commenter
Copy link

Codecov Report

Merging #1058 (84d9c32) into v0.20 (e443390) will increase coverage by 0.11%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##            v0.20    #1058      +/-   ##
==========================================
+ Coverage   53.29%   53.41%   +0.11%     
==========================================
  Files         318      318              
  Lines       21513    21505       -8     
==========================================
+ Hits        11466    11487      +21     
+ Misses       8483     8450      -33     
- Partials     1564     1568       +4     
Flag Coverage Δ
unittests 53.41% <100.00%> (+0.11%) ⬆️

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

Impacted Files Coverage Δ
module/chunks/chunkVerifier.go 68.90% <100.00%> (+4.14%) ⬆️
engine/execution/ingestion/engine.go 57.14% <0.00%> (-1.52%) ⬇️
cmd/util/ledger/migrations/storage_v4.go 41.56% <0.00%> (-0.61%) ⬇️
network/p2p/middleware.go 0.00% <0.00%> (ø)
network/p2p/libp2pNode.go 66.66% <0.00%> (+0.26%) ⬆️
engine/access/rpc/backend/connection_factory.go 75.51% <0.00%> (+5.29%) ⬆️
...sus/approvals/assignment_collector_statemachine.go 51.92% <0.00%> (+9.61%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0212da6...84d9c32. Read the comment docs.

@jordanschalm jordanschalm merged commit 5bed462 into v0.20 Jul 29, 2021
@jordanschalm jordanschalm deleted the m4ksio/5706-port-to-v0.20 branch July 29, 2021 18:11
@zhangchiqing zhangchiqing restored the m4ksio/5706-port-to-v0.20 branch August 9, 2021 23:10
bors bot added a commit that referenced this pull request Aug 26, 2021
1088: Back-port `v0.20` fixes for `canary7` to `master` r=jordanschalm a=jordanschalm

Backport fixes on the `v0.20` branch to `master`:

- [x] #1036 
- [x] #1057 
- [x] #1058 
- [x] #1080 
- [x] #1090
- [x] #1096
- [x] #1124
- [x] #1125

Co-authored-by: Jordan Schalm <jordan@dapperlabs.com>
Co-authored-by: Maks Pawlak <120831+m4ksio@users.noreply.github.com>
Co-authored-by: Khalil Claybon <kclaybon1@gmail.com>
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.

None yet

4 participants