Outputs ENR text representation in admin.nodeInfo RPC#5701
Outputs ENR text representation in admin.nodeInfo RPC#5701gumb0 merged 5 commits intoethereum:masterfrom
Conversation
gumb0
left a comment
There was a problem hiding this comment.
Looks good, just several minor stylistic changes needed.
Also, could you please in a separate commit (can be this same PR) convert all tabs to spaces in the file Base64.cpp?
And yes, a unit test would be appreciated.
libdevcore/Base64.cpp
Outdated
| } | ||
|
|
||
| string dev::toBase64(bytesConstRef _in) | ||
| string toBase64Encoding(bytesConstRef _in, char const* base64_chars, bool _pad) |
There was a problem hiding this comment.
| string toBase64Encoding(bytesConstRef _in, char const* base64_chars, bool _pad) | |
| string toBase64Encoding(bytesConstRef _in, char const* _base64_chars, bool _pad) |
libdevcore/Base64.cpp
Outdated
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
| "abcdefghijklmnopqrstuvwxyz" | ||
| "0123456789+/"; | ||
| bool _pad = true; |
There was a problem hiding this comment.
| bool _pad = true; | |
| bool const pad = true; |
libdevcore/Base64.cpp
Outdated
| "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | ||
| "abcdefghijklmnopqrstuvwxyz" | ||
| "0123456789-_"; | ||
| bool _pad = false; |
There was a problem hiding this comment.
| bool _pad = false; | |
| bool const pad = false; |
libdevcore/Base64.cpp
Outdated
|
|
||
| string dev::toBase64(bytesConstRef _in) | ||
| { | ||
| static const char base64_chars[] = |
There was a problem hiding this comment.
| static const char base64_chars[] = | |
| static char const base64_chars[] = |
libdevcore/Base64.cpp
Outdated
|
|
||
| string dev::toBase64URLSafe(bytesConstRef _in) | ||
| { | ||
| static const char base64_chars[] = |
There was a problem hiding this comment.
| static const char base64_chars[] = | |
| static char const base64_chars[] = |
libp2p/ENR.cpp
Outdated
| std::string ENR::textEncoding() const | ||
| { | ||
| RLPStream s; | ||
| this->streamRLP(s); |
There was a problem hiding this comment.
| this->streamRLP(s); | |
| streamRLP(s); |
libp2p/ENR.cpp
Outdated
| { | ||
| RLPStream s; | ||
| this->streamRLP(s); | ||
| return toBase64URLSafe(std::string(s.out().begin(), s.out().end())); |
There was a problem hiding this comment.
I think something like
| return toBase64URLSafe(std::string(s.out().begin(), s.out().end())); | |
| return toBase64URLSafe(ref(s.out())); |
should work
libp2p/Host.h
Outdated
| p2p::NodeInfo nodeInfo() const { return NodeInfo(id(), (networkConfig().publicIPAddress.empty() ? m_tcpPublic.address().to_string() : networkConfig().publicIPAddress), m_tcpPublic.port(), m_clientVersion); } | ||
| p2p::NodeInfo nodeInfo() const | ||
| { | ||
| auto e = enr(); |
There was a problem hiding this comment.
| auto e = enr(); | |
| auto const e = enr(); |
gumb0
left a comment
There was a problem hiding this comment.
Ah, one more thing: you need to add a prefix enr: in function ENR::textEncoding()
See the spec https://github.com/ethereum/EIPs/blob/master/EIPS/eip-778.md#text-encoding
|
For unit test add a check that aleth/test/unittests/libp2p/ENRTest.cpp Line 24 in b212789 (this is a test vector from EIP spec) |
Codecov Report
@@ Coverage Diff @@
## master #5701 +/- ##
==========================================
- Coverage 63.05% 63.05% -0.01%
==========================================
Files 353 351 -2
Lines 30110 30015 -95
Branches 3378 3362 -16
==========================================
- Hits 18987 18926 -61
+ Misses 9894 9880 -14
+ Partials 1229 1209 -20 |
@gumb0 |
@gumb0 |
Yes, just return
Let's add just this one check to the end of the test I linked, I think that would be enough for this PR. |
|
Also please add an item to CHANGELOG.md |
b40faf5 to
9e54363
Compare
|
@gumb0 |
gumb0
left a comment
There was a problem hiding this comment.
Looks good, please fix just one last minor naming issue and changelog, then it's ready
libdevcore/Base64.cpp
Outdated
| } | ||
|
|
||
| return ret; | ||
| static char const _base64_chars[] = |
There was a problem hiding this comment.
| static char const _base64_chars[] = | |
| static char const c_base64_chars[] = |
libdevcore/Base64.cpp
Outdated
|
|
||
| string dev::toBase64URLSafe(bytesConstRef _in) | ||
| { | ||
| static char const _base64_chars[] = |
There was a problem hiding this comment.
| static char const _base64_chars[] = | |
| static char const c_base64_chars[] = |
CHANGELOG.md
Outdated
| - Added: [#5634](https://github.com/ethereum/aleth/pull/5634) Bootnodes for Rinkeby and Goerli. | ||
| - Added: [#5640](https://github.com/ethereum/aleth/pull/5640) Istanbul support: EIP-1702 Generalized Account Versioning Scheme. | ||
| - Added: [#5690](https://github.com/ethereum/aleth/issues/5690) Istanbul support: EIP-2028 transaction data gas cost reduction. | ||
| - Added: [#5622](https://github.com/ethereum/aleth/issues/5622) Outputs ENR text representation in admin.nodeInfo RPC. |
There was a problem hiding this comment.
Please link this to this PR instead of an issue
9e54363 to
542646b
Compare
|
Merge? |
Fixes #5622
Old PR #5697