stacks-network / stacks-core

The Stacks blockchain implementation
https://docs.stacks.co
GNU General Public License v3.0
3.01k stars 672 forks source link

feat: always broadcast a BlockResponse, even if globally accepted #5454

Closed hstove closed 2 days ago

hstove commented 1 week ago

Changes signer behavior to broadcast a BlockResponse, even if the signer has already marked the block as GloballyAccepted or GloballyRejected

jcnelson commented 1 week ago

I just want to make sure there's no DoS risk here. What stops the signer from broadcasting the same BlockResponse over and over forever? Do we do this only once per proposal?

hstove commented 1 week ago

I just want to make sure there's no DoS risk here. What stops the signer from broadcasting the same BlockResponse over and over forever? Do we do this only once per proposal?

Yes, the signer only broadcasts once per proposal. This code path is also only after the signer gets a block validation response - so any DOS vector would already be spamming the node's block validation endpoint

jcnelson commented 1 week ago

That's what I thought; just wanted to make sure.

hstove commented 2 days ago

I've updated the code to not re-broadcast if the block is LocallyAccepted or LocallyRejected. So, this PR is essentially changing the check from "if globally X, ignore" to "if locally X, ignore"