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
Update Ethereum Node Record When We Pass Network Upgrade Blocks #1998
Conversation
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
…-dynamic-update
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
&& addressBytes.equals(nodeRecord.get(EnrField.IP_V4)) | ||
&& discoveryPort.equals(nodeRecord.get(EnrField.UDP)) | ||
&& listeningPort.equals(nodeRecord.get(EnrField.TCP)) | ||
&& forkIdSupplier.get().equals(nodeRecord.get("eth"))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
non-blocking feedback: would be nice to have an enum rather than "eth" magic string. I see that it is an existing practice from 1893 though. Any reason not to add this to EnrField?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, non-blocking feedback
final Integer discoveryPort = localNode.get().getEnodeURL().getDiscoveryPortOrZero(); | ||
final Integer listeningPort = localNode.get().getEnodeURL().getListeningPortOrZero(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this is public now and could theoretically be called before start()
, perhaps it would be safer to:
Optional<EnodeURL> enodeUrl = localNode.flatMap(DiscoveryPeer::getEnodeURL)
final Integer discoveryPort = enodeURL.flatMap(EnodeURL::getDiscoveryPort).orElse(0);
final Integer listeningPort = enodeURL.flatMap(EnodeURL::getListeningPort).orElse(0);
it would avoid the potential for NoSuchElementException
assertThat( | ||
storageProvider | ||
.getStorageBySegmentIdentifier(BLOCKCHAIN) | ||
.get("local-enr-seqno".getBytes(StandardCharsets.UTF_8))) | ||
.isNotNull(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this actually checking that the sequence has incremented or just that it isn't null? could we assert that it has gone from 0 -> 1 ? (or rather null -> 1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really glad you mentioned this because in looking at it I actually found out I had an unrelated test bug (nulls vs optionals). I also expanded it a bit to update multiple times.
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
…-dynamic-update
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code this seems good to me. I wonder if it is possible to take advantage of the next goerli fork to verify that this feature works as we want?
Good idea, I should add a log line anyways. |
Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
…-dynamic-update
…rledger#1998) Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com> Signed-off-by: Richard Hart <richardhart92@gmail.com>
…rledger#1998) Signed-off-by: Ratan Rai Sur <ratan.r.sur@gmail.com>
Fixed Issue(s)
#1998
Changelog