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

Ethjs JavaScript REPL #3781

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Ethjs JavaScript REPL #3781

wants to merge 29 commits into from

Conversation

scorbajio
Copy link
Contributor

@scorbajio scorbajio commented Oct 31, 2024

This change continues from a PoC created in #3776 to add a repl to the ethereumjs client module.

This current repl npm script can be expanded by switching over to bash in order to run a consensus client as well and sync networks so that the provided repl can have some applied use-cases met.

The current goal with this PoC expansion is to provide a repl with features similar to geth's and we can potentially expand use cases.

ignoreUndefined: true,
})

// bootstrap contexts or modules
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could potentially make the rpc servers and the API's they serve available as contexts here, but on first look, this wouldn't be very usable. A more user friendly option might be defining commands in the repl that would interact with the client and rpc server objects that could be called like this: .getBlock 0x01.

process.exit()
})

// define commands
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Commands can be defined as such that would allow use to simplify rpc API function calls and passing input parameters. Any other processing can also be done in the command callback implementation, but we should be careful not to e.g. reimplement rpc functions here.

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.64%. Comparing base (4da1f03) to head (50ecdfd).

Additional details and impacted files

Impacted file tree graph

Flag Coverage Δ
block 73.74% <ø> (ø)
blockchain 83.23% <ø> (ø)
client 73.66% <ø> (ø)
common 89.93% <ø> (ø)
devp2p 71.95% <ø> (ø)
evm 64.72% <ø> (ø)
genesis 100.00% <ø> (ø)
mpt 52.09% <ø> (-0.04%) ⬇️
rlp 95.11% <ø> (ø)
statemanager 67.81% <ø> (ø)
tx 76.56% <ø> (ø)
util 72.81% <ø> (ø)
vm 57.30% <ø> (ø)
wallet 79.67% <ø> (ø)

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

@acolytec3
Copy link
Contributor

Another thing that would be really cool would be to be able to turn on the different log levels dynamically in the client (and also maybe the debug stuff too to see lower level debug logging.

@holgerd77
Copy link
Member

Can we take the admin_addPeer RPC implementation out here as a separate PR (and also add a few tests), so that there is not too much heaping up here?

Another thing that would be really cool would be to be able to turn on the different log levels dynamically in the client (and also maybe the debug stuff too to see lower level debug logging.

This might also be a candidate for a separate PR.

I have the general impression that this might be a good strategic approach, respectively that this here (the REPL PR) is somewhat of a "sub task trigger PR" 🙂 So it's pretty likely that this will let one stumble upon refactoring tasks, clean-up TODOs and the like and then I think it might also be good to continue like this: to then extract these as separate/small pieces of work and keep this PR here lean and small and updated.

@holgerd77
Copy link
Member

(but then likely do the PRs on top of each other, so that you do not always have to wait a day until one of these is merged. So basically (PR order) from clean (mergeable, e.g. a `admin_addPeer PR with tests) to dirty (likely the REPL PR for some time 😁))

@acolytec3
Copy link
Contributor

(but then likely do the PRs on top of each other, so that you do not always have to wait a day until one of these is merged. So basically (PR order) from clean (mergeable, e.g. a `admin_addPeer PR with tests) to dirty (likely the REPL PR for some time 😁))

Agree. This has been working well for the verkle stuff.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants