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

Refactor/make peer info match geth #7750

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ public AdminRpcModule(
_staticNodesManager = staticNodesManager ?? throw new ArgumentNullException(nameof(staticNodesManager));
_pruningTrigger = pruningTrigger;
_parameters = parameters ?? throw new ArgumentNullException(nameof(parameters));

BuildNodeInfo();
}

Expand Down Expand Up @@ -121,6 +120,7 @@ public ResultWrapper<PeerInfo[]> admin_peers(bool includeDetails = false)

public ResultWrapper<NodeInfo> admin_nodeInfo()
{
// why the repetition? already called at contructor!
UpdateEthProtocolInfo();
return ResultWrapper<NodeInfo>.Success(_nodeInfo);
}
Expand Down
54 changes: 40 additions & 14 deletions src/Nethermind/Nethermind.JsonRpc/Modules/Admin/PeerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,35 @@
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Net;
using System.Text.Json.Serialization;
using Nethermind.Network;
using Nethermind.Stats.Model;

namespace Nethermind.JsonRpc.Modules.Admin
{
public class PeerInfo
{
public string Name { get; set; }
public string Id { get; }
public string Host { get; set; }
public int Port { get; set; }
public string Address { get; set; }
public bool IsBootnode { get; set; }
public bool IsTrusted { get; set; }
public bool IsStatic { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public string? Enr { get; set; }
public string Enode { get; set; }
public string Id { get; }
public string Name { get; set; }

// a list of all protocols supported in their canonical names
// // e.g snap as snap/1, protocol_name/version_no
public string[] Caps { get; set; }

public NetworkInfo Network { get; set; }
public Dictionary<string, string[]> Protocols { get; set; } = new();// set of protocols supported by the peer
// it's a map of protocol_name to partial info on protocol some info like version ONLY.
// ProtocolInfo [or Protocol] with sub-classes Eth, Snap etc...or just


// keep extra info not availibale in get?
public bool IsBootnode { get; set; }
public string ClientType { get; set; }
public string EthDetails { get; set; }
public string LastSignal { get; set; }
Expand All @@ -39,19 +49,35 @@ public PeerInfo(Peer peer, bool includeDetails)

Name = peer.Node.ClientId;
Id = peer.Node.Id.Hash.ToString(false);
Host = peer.Node.Host is null ? null : IPAddress.Parse(peer.Node.Host).MapToIPv4().ToString();
Port = peer.Node.Port;
Address = peer.Node.Address.ToString();
IsBootnode = peer.Node.IsBootnode;
IsStatic = peer.Node.IsStatic;
// Caps = peer.Protocols.Select(p => p.name).ToArray() // how it should be


Enode = peer.Node.ToString(Node.Format.ENode);
Network = new()
{
Inbound = peer.InSession is not null,
RemoteAddress = peer.Node.Address.ToString(),
Static = peer.Node.IsStatic

};
IsBootnode = peer.Node.IsBootnode;

if (includeDetails)
{
ClientType = peer.Node.ClientType.ToString();
EthDetails = peer.Node.EthDetails;
LastSignal = (peer.InSession ?? peer.OutSession)?.LastPingUtc.ToString(CultureInfo.InvariantCulture);
LastSignal = (peer.InSession ?? peer.OutSession!).LastPingUtc.ToString(CultureInfo.InvariantCulture);

}
}
}

public class NetworkInfo
{
public string LocalAddress { get; set; }
public string RemoteAddress { get; set; }
public bool Inbound { get; set; }
public bool Trusted { get; set; }
public bool Static { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/bench_precompiles
Submodule bench_precompiles updated 92 files
+0 −408 .gitignore
+0 −1 vectors/blsg1add/current/bench-g1add-1.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-1.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-10.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-11.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-12.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-128.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-13.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-14.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-15.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-16.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-17.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-18.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-19.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-2.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-20.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-2048.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-21.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-22.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-23.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-24.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-25.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-256.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-26.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-27.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-28.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-29.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-3.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-30.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-31.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-32.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-4.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-4096.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-5.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-512.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-6.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-64.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-7.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-8.csv
+0 −1 vectors/blsg1msm/current/bench-g1msm-9.csv
+0 −1 vectors/blsg1mul/current/bench-g1mul-1.csv
+0 −1 vectors/blsg2add/current/bench-g2add-1.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-1.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-10.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-11.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-12.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-128.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-13.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-14.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-15.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-16.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-17.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-18.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-19.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-2.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-20.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-2048.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-21.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-22.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-23.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-24.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-25.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-256.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-26.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-27.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-28.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-29.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-3.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-30.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-31.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-32.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-4.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-4096.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-5.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-512.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-6.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-64.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-7.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-8.csv
+0 −1 vectors/blsg2msm/current/bench-g2msm-9.csv
+0 −1 vectors/blsg2mul/current/bench-g2mul-1.csv
+0 −1 vectors/blsmapfp2tog2/current/bench-mapfp2-1.csv
+0 −1 vectors/blsmapfptog1/current/bench-mapfp-1.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-1.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-2.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-3.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-4.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-5.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-6.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-7.csv
+0 −1 vectors/blspairingcheck/current/bench-pairing-8.csv
+0 −142 vectors/modexp/current/file.json
2 changes: 1 addition & 1 deletion src/tests
Submodule tests updated 81 files
+140 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
+140 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json
+142 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json
+157 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json
+142 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json
+143 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/06_tstoreInReentrancyCall.json
+142 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/07_tloadAfterReentrancyStore.json
+142 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/08_revertUndoesTransientStore.json
+142 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/09_revertUndoesAll.json
+171 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/11_tstoreDelegateCall.json
+155 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/12_tloadDelegateCall.json
+143 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/13_tloadStaticCall.json
+140 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/16_tloadGas.json
+141 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/18_tloadAfterStore.json
+158 −0 BlockchainTests/GeneralStateTests/Cancun/stEIP1153-transientStorage/20_oogUndoesTransientStoreInCall.json
+57 −53 BlockchainTests/GeneralStateTests/Pyspecs/paris/security/tx_selfdestruct_balance_bug.json
+6 −6 BlockchainTests/GeneralStateTests/stStaticCall/static_InternlCallStoreClearsOOG.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/InternlCallStoreClearsOOG.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/InternlCallStoreClearsSucces.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/StoreClearsAndInternlCallStoreClearsOOG.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/StoreClearsAndInternlCallStoreClearsSuccess.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCall.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCallFailed.json
+6 −6 BlockchainTests/GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesOOG.json
+12 −12 BlockchainTests/GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesSuccess.json
+2 −3 BlockchainTests/GeneralStateTests/stTransactionTest/ValueOverflowParis.json
+52 −0 EOFTests/efValidation/EOF1_returncontract_invalid_.json
+40 −0 EOFTests/efValidation/EOF1_returncontract_valid_.json
+7 −8 EOFTests/efValidation/EOF1_undefined_opcodes_.json
+76 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
+75 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/02_tloadAfterTstore.json
+77 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0.json
+83 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/04_tloadAfterCall.json
+75 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/05_tloadReentrancy.json
+75 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/06_tstoreInReentrancyCall.json
+75 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/07_tloadAfterReentrancyStore.json
+76 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/08_revertUndoesTransientStore.json
+76 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/09_revertUndoesAll.json
+90 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/11_tstoreDelegateCall.json
+82 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/12_tloadDelegateCall.json
+76 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/13_tloadStaticCall.json
+75 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/16_tloadGas.json
+76 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/18_tloadAfterStore.json
+85 −0 GeneralStateTests/Cancun/stEIP1153-transientStorage/20_oogUndoesTransientStoreInCall.json
+6 −6 GeneralStateTests/stStaticCall/static_InternlCallStoreClearsOOG.json
+6 −6 GeneralStateTests/stTransactionTest/InternlCallStoreClearsOOG.json
+6 −6 GeneralStateTests/stTransactionTest/InternlCallStoreClearsSucces.json
+6 −6 GeneralStateTests/stTransactionTest/StoreClearsAndInternlCallStoreClearsOOG.json
+6 −6 GeneralStateTests/stTransactionTest/StoreClearsAndInternlCallStoreClearsSuccess.json
+6 −6 GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCall.json
+6 −6 GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCallFailed.json
+6 −6 GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesOOG.json
+6 −6 GeneralStateTests/stTransactionTest/SuicidesAndInternlCallSuicidesSuccess.json
+1 −1 LegacyTests
+42 −0 src/EOFTestsFiller/efValidation/EOF1_returncontract_invalid_Copier.json
+30 −0 src/EOFTestsFiller/efValidation/EOF1_returncontract_valid_Copier.json
+2 −3 src/EOFTestsFiller/efValidation/EOF1_undefined_opcodes_Copier.json
+54 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxnFiller.yml
+55 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/02_tloadAfterTstoreFiller.yml
+58 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/03_tloadAfterStoreIs0Filler.yml
+81 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/04_tloadAfterCallFiller.yml
+89 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/05_tloadReentrancyFiller.yml
+94 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/06_tstoreInReentrancyCallFiller.yml
+89 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/07_tloadAfterReentrancyStoreFiller.yml
+90 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/08_revertUndoesTransientStoreFiller.yml
+95 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/09_revertUndoesAllFiller.yml
+90 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/11_tstoreDelegateCallFiller.yml
+67 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/12_tloadDelegateCallFiller.yml
+109 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/13_tloadStaticCallFiller.yml
+61 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/16_tloadGasFiller.yml
+56 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/18_tloadAfterStoreFiller.yml
+75 −0 src/GeneralStateTestsFiller/Cancun/stEIP1153-transientStorage/20_oogUndoesTransientStoreInCallFiller.yml
+1 −1 src/GeneralStateTestsFiller/stStaticCall/static_InternlCallStoreClearsOOGFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/InternlCallStoreClearsOOGFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/InternlCallStoreClearsSuccesFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/StoreClearsAndInternlCallStoreClearsOOGFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/StoreClearsAndInternlCallStoreClearsSuccessFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCallFailedFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/SuicidesAndInternlCallSuicidesBonusGasAtCallFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/SuicidesAndInternlCallSuicidesOOGFiller.json
+1 −1 src/GeneralStateTestsFiller/stTransactionTest/SuicidesAndInternlCallSuicidesSuccessFiller.json