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

Coordinator: replace teku ExecutionPlayloadV1 by Domain Block class - fix block encoding #406

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jpnovais
Copy link
Collaborator

@jpnovais jpnovais commented Dec 6, 2024

This PR implements issue(s) #

Checklist

  • I wrote new tests for my new core changes.
  • I have successfully ran tests, style checker and build against my new changes locally.
  • I have informed the team of any breaking changes if there are any.

@jpnovais jpnovais requested a review from a team December 6, 2024 19:17
@jpnovais jpnovais temporarily deployed to docker-build-and-e2e December 6, 2024 19:18 — with GitHub Actions Inactive
@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 27.46711% with 441 lines in your changes missing coverage. Please review.

Project coverage is 67.46%. Comparing base (8cf2866) to head (41f40b0).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...omain-models/src/main/kotlin/linea/domain/Block.kt 25.68% 79 Missing and 2 partials ⚠️
...models/src/main/kotlin/linea/domain/Transaction.kt 34.86% 46 Missing and 25 partials ⚠️
...ain/kotlin/linea/domain/MapperLineaDomainToBesu.kt 43.90% 40 Missing and 6 partials ⚠️
...essor/src/main/kotlin/linea/blob/BlobCompressor.kt 0.00% 46 Missing ⚠️
...ain/kotlin/linea/domain/MapperBesuToLineaDomain.kt 0.00% 41 Missing ⚠️
...tlin/linea/web3j/EthGetBlockToLineaBlockMappers.kt 39.21% 27 Missing and 4 partials ⚠️
.../coordinator/blockcreation/BlockCreationMonitor.kt 0.00% 30 Missing ⚠️
...src/main/kotlin/linea/rlp/BesuRlpMainnetEncoder.kt 0.00% 19 Missing ⚠️
...u-rlp-and-mappers/src/main/kotlin/linea/rlp/RLP.kt 0.00% 18 Missing ⚠️
...nsions/src/main/kotlin/linea/web3j/Web3JFactory.kt 0.00% 15 Missing ⚠️
... and 12 more
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #406      +/-   ##
============================================
- Coverage     70.17%   67.46%   -2.72%     
- Complexity     1070     1086      +16     
============================================
  Files           306      315       +9     
  Lines         12337    12638     +301     
  Branches       1179     1267      +88     
============================================
- Hits           8658     8526     -132     
- Misses         3200     3605     +405     
- Partials        479      507      +28     
Flag Coverage Δ *Carryforward flag
hardhat 98.70% <ø> (ø) Carriedforward from f4a0147
kotlin 64.99% <27.46%> (-2.88%) ⬇️

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
.../consensys/zkevm/coordinator/app/CoordinatorApp.kt 0.00% <ø> (ø)
...clients/prover/FileBasedExecutionProverClientV2.kt 59.01% <100.00%> (ø)
...dination/blockcreation/BlockCreationCoordinator.kt 100.00% <100.00%> (ø)
...on/conflation/BlockToBatchSubmissionCoordinator.kt 91.66% <100.00%> (-0.23%) ⬇️
...conflation/upgrade/SwitchAwareConflationHandler.kt 100.00% <100.00%> (ø)
.../src/main/kotlin/net/consensys/StringExtensions.kt 85.71% <100.00%> (+19.04%) ⬆️
...src/main/kotlin/net/consensys/TypingsExtensions.kt 78.37% <100.00%> (ø)
.../kotlin/net/consensys/linea/web3j/ExtendedWeb3J.kt 0.00% <ø> (ø)
...nsys/zkevm/ethereum/coordination/MaxLongTracker.kt 19.23% <0.00%> (ø)
...um/coordination/blockcreation/SafeBlockProvider.kt 0.00% <0.00%> (-19.05%) ⬇️
... and 20 more

... and 4 files with indirect coverage changes

@jpnovais jpnovais temporarily deployed to docker-build-and-e2e December 6, 2024 20:11 — with GitHub Actions Inactive
@jpnovais jpnovais temporarily deployed to docker-build-and-e2e December 6, 2024 22:39 — with GitHub Actions Inactive
@jpnovais jpnovais force-pushed the coordinator-fix-blockencoding branch from b8a6102 to adf559c Compare December 9, 2024 18:41
@jpnovais jpnovais temporarily deployed to docker-build-and-e2e December 9, 2024 18:43 — with GitHub Actions Inactive
@@ -23,6 +23,12 @@ allprojects {
apply plugin: 'java' // do not add kotlin plugin here, it will add unnecessary Kotlin runtime dependencies
apply plugin: 'jacoco'

configurations.all {
resolutionStrategy {
force "org.web3j:core:${libs.versions.web3j.get()}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I pulled your code, removed this addition, built the project and it went fine. What was breaking for you so you had to add it? I want to check if we can work around it some other way on my machine

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it works. The reason I added this is because we have multiple versions of web3j, through transitive dependencies and when coding/debugging intellIJ was linking to the wrong one. So did this a quick workaround and ended up pushing by accident.

I am aware that this is not a solution that scales! We shall use proper management like spring plugin but I don't have time to address it now.
I am happy to revert or keep it since it does not cause any harm anyway.

Copy link
Collaborator

Choose a reason for hiding this comment

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

If it doesn't cause issues for you, I'd like to remove it, because it creates a bad precedent

@@ -21,7 +24,7 @@ import kotlin.time.Duration.Companion.days

class BlockCreationMonitor(
private val vertx: Vertx,
private val extendedWeb3j: ExtendedWeb3J,
private val web3j: Web3j,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we going back to plain Web3j here and in other places?

Copy link
Collaborator Author

@jpnovais jpnovais Dec 10, 2024

Choose a reason for hiding this comment

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

Because it was simpler this way and this extension is not properly designed and refactoring adapting would be more work. We created this interface to basically facilitate mock<> and return responses, if we create a fake rpc client this won't be necessary, we can tests against state that concrete implementations. That's my pan for new tests of BlockCreationMonitor.

Copy link
Collaborator

Choose a reason for hiding this comment

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

getNetNextSafeBlock is more complex now. Is it possible to make this change later, at the same time with the new tests?

@@ -27,4 +27,30 @@ class StringExtensionsTest {
assertThat("this includes lorem ipsum".containsAny(stringList, ignoreCase = true)).isTrue()
assertThat("this string won't match".containsAny(stringList, ignoreCase = true)).isFalse()
}

@OptIn(ExperimentalStdlibApi::class)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I didn't catch what experimental features we're using here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It had before, then I forgot to remove, will clean it, thanks

…r/blockcreation/BlockCreationMonitor.kt

Co-authored-by: Roman Vaseev <[email protected]>
Signed-off-by: Pedro Novais <[email protected]>
@@ -17,6 +17,7 @@ junit = "5.10.1"
kotlinxDatetime = "0.6.1"
ktlint = "0.47.0"
log4j = "2.20.0"
slf4j = "1.7.30"
Copy link
Contributor

Choose a reason for hiding this comment

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

Wondering where is it being used?

nonce = transaction.nonce.toULong(),
gasPrice = transaction.getGasPrice().getOrNull()?.toBigInteger()?.toULong(),
gasLimit = transaction.gasLimit.toULong(),
to = transaction.to?.getOrNull()?.toArray(),
Copy link
Contributor

@jonesho jonesho Dec 10, 2024

Choose a reason for hiding this comment

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

Without the ? operator should be sufficient as to = transaction.to.getOrNull()?.toArray(), same for the ? operators before getOrNull() below

@jpnovais jpnovais requested a deployment to docker-build-and-e2e December 12, 2024 16:28 — with GitHub Actions Waiting
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