Git Product home page Git Product logo

Comments (4)

DavidVorick avatar DavidVorick commented on May 21, 2024

Any chance of this being done by Friday?

from sia.

lukechampine avatar lukechampine commented on May 21, 2024

This would be fairly trivial to implement. The current maxMsgLen is 16MB, but could be lowered to 1MB. I don't think there any other messages that would exceed that size. Alternatively, we could modify AcceptBlock to reject large blocks -- but you'd still need to download the entire block (up to 16MB currently) before rejecting it.

I would suggest lowering maxMsgLen and adding the arbitrary data check to AcceptBlock. The one gap I see here is that it doesn't prevent you from accepting blocks larger than 1MB.

from sia.

DavidVorick avatar DavidVorick commented on May 21, 2024

Yeah I should add something to the consensus package that's aware of maximum sizes. Especially b/c eventually we'll probably be doing some form of compression on our messages. Even 10% size reduction is worthwhile. But the consensus stuff needs to be in perfect agreement about what's acceptable in a block, which means no compression (or at least very strict compression, which is annoying)

from sia.

lukechampine avatar lukechampine commented on May 21, 2024

yeah, that definitely adds another wrinkle. It'd be easy to make a "1MB" block message that's actually a massive zip bomb.

However, my anti-compression stance has softened a bit. It would actually be really easy to do in Go, thanks to the io.Reader and io.Writer interfaces:

_, err := encoding.WriteObject(conn, arg)
err := encoding.ReadObject(conn, resp, maxMsgLen)
// becomes:
_, err := encoding.WriteObject(gzip.NewWriter(conn), arg)
err := encoding.ReadObject(gzip.NewReader(conn), resp, maxMsgLen)

NewWriter wraps conn, such that calling Write will write compressed data to conn. Likewise, calling Read on NewReader(conn) will read decompressed data.

This probably isn't as easy in other languages though, especially C.

from sia.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.