Skip to content

static-nodes.json should live within the data dir #9181

@skylenet

Description

@skylenet

Description

When I run a node with my own datadir, and then do an admin_addTrustedPeer RPC call, I get the following error:

data": "System.UnauthorizedAccessException: Access to the path '/nethermind/Data/trusted-nodes.json' is denied.\n ---> System.IO.IOException: Permission denied\n --- End of inner exception stack trace ---\n at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirError)\n at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, UnixFileMode openPermissions, Int64& fileLength, UnixFileMode& filePermissions, Boolean failForSymlink, Boolean& wasSymlink, Func4 createOpenException)\n at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable1 unixCreateMode)\n at System.IO.File.Create(String path)\n at Nethermind.Network.TrustedNodesManager.SaveFileAsync() in /src/Nethermind/Nethermind.Network/TrustedNodes/TrustedNodesManager.cs:line 186\n at Nethermind.Network.TrustedNodesManager.AddAsync(Enode enode, Boolean updateFile) in /src/Nethermind/Nethermind.Network/TrustedNodes/TrustedNodesManager.cs:line 125\n at Nethermind.JsonRpc.Modules.Admin.AdminRpcModule.admin_addTrustedPeer(String enode) in /src/Nethermind/Nethermind.JsonRpc/Modules/Admin/AdminRpcModule.cs:line 132\n at Nethermind.JsonRpc.JsonRpcService.ExecuteAsync(JsonRpcRequest request, String methodName, ResolvedMethodInfo method, JsonRpcContext context) in /src/Nethermind/Nethermind.JsonRpc/JsonRpcService.cs:line 203

The problem is that I'm running Nethermind within a container, and I'm setting --datadir=/data. The container has write access to the /data directory only. Somehow the static-nodes.json file lives in a different directory within /nethermind/Data. This sounds wrong and the static-nodes.json file should ideally also live in the directory defined via the datadir flag.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions