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

fix: fix RpcDB connection so one can attach local Instance to remote DB for debugging purpose #8049

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

Conversation

kamilchodola
Copy link
Contributor

@kamilchodola kamilchodola commented Jan 14, 2025

Fixes RpcDB mode - with proper configuration it allows to debug remote DB (or at least use some remote data and debug RPC calls issues).

To make it work, make sure local node runs with flags:
--Init.DiagnosticMode=RpcDb --Init.RpcDbUrl=JsonRPC URL (properly formatted with http:// as prefix)
Also enabling of debug rpc endpoints is needed as in background few debug calls are made to fetch from remote DB

Also for now it is quite slow (at least on my end) so worth applying --Init.ProcessingEnabled=false and disabling CL for processing on the desired node so will avoid messages about potential corruption of Db and will easily proceed to a enabled rpc node

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

src/Nethermind/Nethermind.Db.Rpc/RpcDb.cs Outdated Show resolved Hide resolved
@@ -96,7 +97,7 @@ private byte[] GetThroughRpc(ReadOnlySpan<byte> key)
byte[] value = null;
if (response.Result is not null)
{
value = Bytes.FromHexString((string)response.Result);
value = Bytes.FromHexString(response.Result.ToString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Cosmetic I prefer $"{response.Result}" for strings

@@ -59,7 +59,7 @@ private DbSettings GetRocksDbSettings(DbSettings originalSetting)
bool firstDb = _index == -1;

// if first DB, then we will put it into main directory and not use indexed subdirectory
string dbName = firstDb ? originalSetting.DbName : originalSetting.DbName + _index;
string dbName = originalSetting.DbName;
Copy link
Contributor

Choose a reason for hiding this comment

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

hmmm, my intuition is telling me that it could cause issues with full-pruning

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah wrote to Ashraf already as was not confident about this one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But path still point to proper location - just DbName is different - without this change RPC was looking for a DB called "State0"

Copy link
Member

Choose a reason for hiding this comment

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

Should be fine 'Path' is more important and 'Name' is mostly for our convenience. You might want to change FullPruningInnerDbFactoryTests.MatchSettings

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.

3 participants