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

fully validate a block before publishing #4168

Closed
wants to merge 21 commits into from

Conversation

realbigsean
Copy link
Member

Issue Addressed

Which issue # does this PR address?

Proposed Changes

Please list or describe the changes introduced by this PR.

Additional Info

Please provide any additional information. For example, future considerations
or information useful for reviewers.

@realbigsean realbigsean changed the base branch from stable to unstable April 5, 2023 16:50
@realbigsean realbigsean changed the base branch from unstable to stable April 5, 2023 16:51
Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

Just a quick fly-by review on my phone. I'm still not fully across the ObservedProposers concept though.

beacon_node/http_api/src/publish_blocks.rs Outdated Show resolved Hide resolved
@realbigsean
Copy link
Member Author

The ObservedProposals cache is meant to track slashable proposals and stop the node from publishing if the block would be slashable. This stops a slashable block's transactions from being revealed because otherwise you could double sign and broadcast your block locally first, view the revealed transactions and steal them or whatever in the next block

@michaelsproul
Copy link
Member

I think we could replace observed_block_producers by the observed_proposers cache, i.e. add the block hash to the previous cache. We could preserve the prior behaviour of rejecting any duplicate proposal seen on gossip by checking which hashes are present in the cache. The intent of the gossip rule is to block slashable blocks and the same-hash-duplicate case would only be reachable via the observed_block_producers/proposers very rarely because we check for duplicates immediately prior:

if chain
.canonical_head
.fork_choice_read_lock()
.contains_block(&block_root)
{
return Err(BlockError::BlockIsAlreadyKnown);
}

Copy link
Member

@paulhauner paulhauner left a comment

Choose a reason for hiding this comment

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

I've had another look over this and I'm feeling good about it. Not necessarily for merging it into unstable, but it looks good for a hot-fix for the relays. Nice work!

I think returning an error on the HTTP API if a conflicting/slashable block has been observed (like you have implemented) is good. This should prevent the relays from revealing their payloads if the proposer has started some sort of nefarious double-proposal work already.

@michaelsproul
Copy link
Member

Closing this now that #4293 is resolved.

@realbigsean realbigsean deleted the lighthouse-relay branch November 21, 2023 16:15
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.

3 participants