Skip to content

Conversation

luke-jr
Copy link
Member

@luke-jr luke-jr commented Jul 9, 2023

Regression introduced by #27626

Adds new tests

@DrahtBot
Copy link
Contributor

DrahtBot commented Jul 9, 2023

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage

For detailed information about the code coverage, see the test coverage report.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

No conflicts as of last run.

Copy link
Member

@instagibbs instagibbs left a comment

Choose a reason for hiding this comment

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

The result of this PR would be that it would return an error IFF that particular block was requested by that specific peer last. If you request the block from another peer, the behavior would be unchanged. Is that acceptable?

slow_peer_id = peers[2]["id"]
assert_equal(self.nodes[0].getblockfrompeer(short_tip, slow_peer_id), {})
assert_raises_rpc_error(-1, "Already requested from this peer", self.nodes[0].getblockfrompeer, short_tip, slow_peer_id)

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
self.log.info("But every fetch to another peer causes us to forget previous attempts for same block")
self.nodes[0].add_p2p_connection(P2PInterface())
peers = self.nodes[0].getpeerinfo()
assert_equal(len(peers), 4)
slow_peer_id_2 = peers[3]["id"]
assert_equal(self.nodes[0].getblockfrompeer(short_tip, slow_peer_id_2), {})
assert_equal(self.nodes[0].getblockfrompeer(short_tip, slow_peer_id), {})

Copy link
Member

Choose a reason for hiding this comment

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

example test covering the behavior I'm mentioning

Copy link
Contributor

@mzumsande mzumsande left a comment

Choose a reason for hiding this comment

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

The result of this PR would be that it would return an error IFF that particular block was requested by that specific peer last. If you request the block from another peer, the behavior would be unchanged. Is that acceptable?

I think that I would find that acceptable.
I guess one alternative would be to drop the "Already requested from this peer" error that is currently not triggerable, and just forget about the prior request unconditionally on a new request.

@fanquake fanquake added this to the 25.1 milestone Jul 12, 2023
@Sjors
Copy link
Member

Sjors commented Jul 13, 2023

I think @mzumsande's suggestion is better. But the current PR, with @instagibbs's tests to document the existing weirdness, is fine too.

Either behaviour is "covered" by the RPC doc warning:

Subsequent calls for the same block may cause the response from the previous peer to be ignored.

Could be improved by saying:

Subsequent calls for the same block may cause the response from the previous peer request to be ignored.

Comment on lines +1801 to +1807
if (IsBlockRequestedFromPeer(hash, peer_id)) return "Already requested from this peer";

// Forget about all prior requests
RemoveBlockRequest(block_index.GetBlockHash(), std::nullopt);
RemoveBlockRequest(hash, std::nullopt);

// Mark block as in-flight
if (!BlockRequested(peer_id, block_index)) return "Already requested from this peer";
Assume(BlockRequested(peer_id, block_index));
Copy link
Member

Choose a reason for hiding this comment

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

In 2b67ea4:

Instead of adding the new function, could just delete the RemoveBlockRequest() line and directly call BlockRequested(). Failing with a Already requested from this peer if the call return false.

BlockRequested() only fails when the block is already in-flight for that peer (it does the same as your new IsBlockRequestedFromPeer() function).

@fanquake
Copy link
Member

@luke-jr are you going to followup with the questions, test suggestions, code-review and general feedback here?

@fanquake
Copy link
Member

ping @luke-jr.

@fanquake fanquake removed this from the 25.1 milestone Oct 2, 2023
@fanquake
Copy link
Member

fanquake commented Oct 2, 2023

Discussed this with some other contributors, and for now, I'm removing this from the 25.1 milestone. I don't currently consider this a blocker for 25.1, and, it cannot be merged or reviewed in any case, until the review feedback is addressed.

@maflcko
Copy link
Member

maflcko commented Oct 25, 2023

Can be marked as draft, while it is waiting on the author?

Copy link
Member

@furszy furszy left a comment

Choose a reason for hiding this comment

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

I could take this forward if there's no progress here. I actually fixed the issue before this PR was created, in #27837 (27a2592). So, it would just be matter of gathering this PR test commits with my little fix commit in a new PR.

Side shilling note, would be nice to progress on #28170 and #28170 bug fixes.

@fanquake
Copy link
Member

I could take this forward if there's no progress here.

I don't think it's clear that is something that actually needs fixing, or that we want to change at this point.

@furszy
Copy link
Member

furszy commented Oct 25, 2023

I could take this forward if there's no progress here.

I don't think it's clear that is something that actually needs fixing, or that we want to change at this point.

well, if the node has requested a block from a certain peer and is waiting for the response. It should not allow the user (or an external software) to re-request the same block multiple times. It is a waste of bandwidth and the other peer could end up banning the node for misbehaving. It's better to notify the misbehavior rather than get silently banned from the network.

@DrahtBot
Copy link
Contributor

DrahtBot commented Feb 5, 2024

🤔 There hasn't been much activity lately and the CI seems to be failing.

If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in.

@fanquake fanquake marked this pull request as draft March 6, 2024 17:22
@DrahtBot
Copy link
Contributor

🤔 There hasn't been much activity lately and the CI seems to be failing.

If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in.

@DrahtBot
Copy link
Contributor

🤔 There hasn't been much activity lately and the CI seems to be failing.

If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in.

@fanquake
Copy link
Member

Closing, given no followup.

@fanquake fanquake closed this Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants