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

feat: implement clientVersionV1 in engine API #8016

Merged
merged 14 commits into from
May 24, 2024

Conversation

guha-rahul
Copy link
Contributor

@guha-rahul guha-rahul commented May 1, 2024

fixes #7668 and based on #7708 which I closed because of branch problems
Added ClientVersionV1to engine.rs and engine_api.rs
Need to add ClientVersionV1 in crates/node/builder/src/launch/mod.rs.
Adding reth-node-core.workspace =true in rpc/rpc-engine-api gives me a cyclic dependency issue.

@guha-rahul
Copy link
Contributor Author

guha-rahul commented May 1, 2024

After some debugging i think i have solved those issues but I am getting this error now:-

   --> crates/node/builder/src/launch/mod.rs:430:35
    |
430 |             code: CLIENTVERSIONV1.code,
    |                                   ^^^^ private field

error[E0616]: field `name` of struct `reth_node_core::version::ClientVersionV1` is private
   --> crates/node/builder/src/launch/mod.rs:431:35
    |
431 |             name: CLIENTVERSIONV1.name,
    |                                   ^^^^ private field

error[E0616]: field `version` of struct `reth_node_core::version::ClientVersionV1` is private
   --> crates/node/builder/src/launch/mod.rs:432:38
    |
432 |             version: CLIENTVERSIONV1.version,
    |                                      ^^^^^^^ private field

error[E0616]: field `commit` of struct `reth_node_core::version::ClientVersionV1` is private
   --> crates/node/builder/src/launch/mod.rs:433:37
    |
433 |             commit: CLIENTVERSIONV1.commit,
    |                                     ^^^^^^ private field

any ideas on how to solve this?

@onbjerg
Copy link
Member

onbjerg commented May 1, 2024

Yes, you need to mark the fields as public. Please see https://doc.rust-lang.org/rust-by-example/mod/struct_visibility.html

@onbjerg onbjerg added C-enhancement New feature or request A-rpc Related to the RPC implementation labels May 1, 2024
@guha-rahul
Copy link
Contributor Author

guha-rahul commented May 1, 2024

Hey , when I try to run cargo nextest run without adding reth-node-core.workspace =true in my cargo file in crates/rpc/rpc-engine-api, it runs successfully but fails at make pr with the error

use reth_node_core::CLIENTVERSIONV1;
 |         ^^^^^^^^^^^^^^ use of undeclared crate or module `reth_node_core`

If I remove it, then it shows me a cyclic package error

error: cyclic package dependency: package `reth-node-core v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/node-core)` depends on itself. Cycle:
package `reth-node-core v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/node-core)`
 ... which satisfies path dependency `reth-node-core` (locked to 0.2.0-beta.6) of package `reth-rpc-engine-api v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/rpc/rpc-engine-api)`
 ... which satisfies path dependency `reth-rpc-engine-api` (locked to 0.2.0-beta.6) of package `reth-rpc v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/rpc/rpc)`
 ... which satisfies path dependency `reth-rpc` (locked to 0.2.0-beta.6) of package `reth-node-core v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/node-core)`
 ... which satisfies path dependency `reth-node-core` (locked to 0.2.0-beta.6) of package `reth-exex v0.2.0-beta.6 (/home/rahul/Reth/reth/crates/exex)`
 ... which satisfies path dependency `reth-exex` (locked to 0.2.0-beta.6) of package `reth v0.2.0-beta.6 (/home/rahul/Reth/reth/bin/reth)`
 ... which satisfies path dependency `reth` (locked to 0.2.0-beta.6) of package `beacon-api-sse v0.0.0 (/home/rahul/Reth/reth/examples/beacon-api-sse)`
 ```

Any pointers on how I can get rid of this?

@onbjerg
Copy link
Member

onbjerg commented May 1, 2024

@guha-rahul Yes, don't use CLIENTVERSIONV1 in the tests for the method, just fill it with dummy fields, which is fine for testing. This should get rid of the cyclical dependency

@guha-rahul
Copy link
Contributor Author

@onbjerg Resolved all the errors, should i change it from draft to normal?

onbjerg
onbjerg previously requested changes May 1, 2024
crates/node-core/src/version.rs Outdated Show resolved Hide resolved
crates/node-core/src/version.rs Outdated Show resolved Hide resolved
crates/node-core/src/version.rs Outdated Show resolved Hide resolved
crates/node-core/src/version.rs Outdated Show resolved Hide resolved
crates/node-core/src/version.rs Outdated Show resolved Hide resolved
crates/rpc/rpc-engine-api/src/engine_api.rs Outdated Show resolved Hide resolved
crates/rpc/rpc-engine-api/src/engine_api.rs Show resolved Hide resolved
@guha-rahul guha-rahul requested a review from onbjerg May 4, 2024 11:25
@Rjected
Copy link
Member

Rjected commented May 22, 2024

@guha-rahul could you solve merge conflicts here?

bump @onbjerg for review

@Rjected Rjected marked this pull request as ready for review May 22, 2024 20:13
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

one suggestion, the implementation looks good! otherwise, I think putting this is reth rpc-types is fine for now given the only added dep is for node-builder, which imports a lot already. I do wonder whether or not it fits better in another crate, but that should not be a blocker for this pr.

crates/rpc/rpc-engine-api/src/engine_api.rs Outdated Show resolved Hide resolved
@guha-rahul
Copy link
Contributor Author

@Rjected made the changes and i commented out the CLIENTVERSIONV1 struct from version.rs since it was causing many problems and defined it where the engine-api is initialised. I think we can make do with it being in the rpc-types but do let me know if you want to put it in another crate.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

ty

pending @Rjected

Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

just one thing, otherwise lgtm

crates/node-core/src/version.rs Outdated Show resolved Hide resolved
Copy link
Member

@Rjected Rjected left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@Rjected Rjected added this pull request to the merge queue May 24, 2024
Merged via the queue into paradigmxyz:main with commit a8e5eb6 May 24, 2024
31 checks passed
mw2000 pushed a commit to mw2000/reth that referenced this pull request Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Related to the RPC implementation C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support engine_getClientVersionV1
4 participants