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

Limit the size of reject network message strings #4632

Closed
teor2345 opened this issue Jun 16, 2022 · 4 comments · Fixed by #4687
Closed

Limit the size of reject network message strings #4632

teor2345 opened this issue Jun 16, 2022 · 4 comments · Fixed by #4687
Assignees
Labels
A-network Area: Network protocol updates or fixes C-bug Category: This is a bug C-security Category: Security issues I-heavy Problems with excessive memory, disk, or CPU usage I-remote-node-overload Zebra can overload other nodes on the network

Comments

@teor2345
Copy link
Contributor

Motivation

We want to avoid sending large error messages on the network.

zcashd does this with a limit of 111, we might want ours to be slightly smaller:
https://github.com/zcash/zcash/blob/1b5ab4a06e52c23aca48afb1ebb72a25ef5dd3ca/src/main.cpp#L7334-L7335

Specifications

Bitcoin doesn't say much about limits:
https://en.bitcoin.it/wiki/Protocol_documentation#reject

@teor2345 teor2345 added C-bug Category: This is a bug S-needs-triage Status: A bug report needs triage P-Low ❄️ C-security Category: Security issues I-heavy Problems with excessive memory, disk, or CPU usage I-remote-node-overload Zebra can overload other nodes on the network A-network Area: Network protocol updates or fixes labels Jun 16, 2022
@ftm1000 ftm1000 removed the S-needs-triage Status: A bug report needs triage label Jun 23, 2022
@daira
Copy link
Contributor

daira commented Jun 25, 2022

zcashd does this with a limit of 111, we might want ours to be slightly smaller

Why so? I don't know why the limit is 111, and of course Bitcoin Core doesn't document it, but if I had to guess it would be either:

  • just an arbitrary magic number, or
  • some calculated limit on actual message size.

@teor2345
Copy link
Contributor Author

zcashd does this with a limit of 111, we might want ours to be slightly smaller

Why so? I don't know why the limit is 111, and of course Bitcoin Core doesn't document it, but if I had to guess it would be either:
* just an arbitrary magic number, or
* some calculated limit on actual message size.

Is the zcashd limit in bytes or UTF-8 characters?

Zebra's is in UTF-8 characters right now, because that's how Rust counts things.

@oxarbitrage
Copy link
Contributor

I just removed the entire from code:

impl<E> From<E> for Message
where
    E: Error,
{
    fn from(e: E) -> Self {
...
    }
}

And zebra compiles. This means this code is not used at all at the moment. May lower the priority of this PR and some testings we wanted to do.

@teor2345
Copy link
Contributor Author

Thanks, I made ticket #4633 optional priority.

@mergify mergify bot closed this as completed in #4687 Jun 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-network Area: Network protocol updates or fixes C-bug Category: This is a bug C-security Category: Security issues I-heavy Problems with excessive memory, disk, or CPU usage I-remote-node-overload Zebra can overload other nodes on the network
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants