GithubHelp home page GithubHelp logo

Length of frames about coq-http2 HOT 14 CLOSED

liyishuai avatar liyishuai commented on August 17, 2024
Length of frames

from coq-http2.

Comments (14)

liyishuai avatar liyishuai commented on August 17, 2024 1

I think 16M is a reasonable constant limit here. The static bound-checking tells if the frame can be valid in any context, and the runtime checking decides whether this frame is valid under current context.

from coq-http2.

liyishuai avatar liyishuai commented on August 17, 2024

Does Coq have a bounded integer library? I'm a bit reluctant to depend on external packages.

from coq-http2.

lastland avatar lastland commented on August 17, 2024

One way to encode bounded integers in Coq is using subset types {n: nat | n < ... }. Then by using Program Definition, etc., you can reuse most of the functions provided by nat, with obligations to prove that if the result is also a bounded integer, it is within the bound.

However, many people would suggest reconsidering the options before using that because reasoning about dependent types (for example, when doing unification, etc.) in Coq can be painful...

from coq-http2.

liyishuai avatar liyishuai commented on August 17, 2024

Also, considering that SETTINGS_MAX_FRAME_SIZE can go up to 16M, we should use binary numbers rather than nat in most cases.

from coq-http2.

favonia avatar favonia commented on August 17, 2024

I think that Sigma type encoding {nat | ...} should work, even if not the best solution.

Re: 16M: maybe we can also define 16K and 16M to be some large enough unknown constants.

from coq-http2.

liyishuai avatar liyishuai commented on August 17, 2024

SETTINGS_MAX_FRAME_SIZE varies during runtime. Is this a reason against limiting the frame size at type level? A frame cannot be guaranteed to be valid at compile time at all.

from coq-http2.

favonia avatar favonia commented on August 17, 2024

Well, our client or server can always fix the bound to exactly 16384, the default value.

from coq-http2.

lastland avatar lastland commented on August 17, 2024

If we treat SETTINGS_MAX_FRAME_SIZE as an opaque value, it should not matter how big it is, right? Or am I missing something?

from coq-http2.

lastland avatar lastland commented on August 17, 2024

But anyway, I do not have a strong opinion on this. If you decided to use the binary format N, remember to check out peano_ind...

from coq-http2.

favonia avatar favonia commented on August 17, 2024

If we treat SETTINGS_MAX_FRAME_SIZE as an opaque value, it should not matter how big it is, right? Or am I missing something?

I believe that is the case. We only have to make sure proper bound-checking is enforced with respect to some "reasonable" constants.

from coq-http2.

liyishuai avatar liyishuai commented on August 17, 2024

This value can be modified by SETTINGS frames. I don't think it's proper to make it opaque.
I'm somehow ambitious to make this library general enough to reason about all implementations rather than ours.

from coq-http2.

lastland avatar lastland commented on August 17, 2024

You will want to say something like, for all values we can give to the settings, some properties hold. And reasoning about the setting should not rely on it being a particular value. Therefore, the values of settings remain abstract all the time and there is no concrete number that we need to worry about.

I am not suggesting to keep using nat though, I just don't think this should be the reason behind the decision.

from coq-http2.

lastland avatar lastland commented on August 17, 2024

And although I have heard a lot of arguments against using sigma types, I would actually be interested to see how they would play out here...

from coq-http2.

liyishuai avatar liyishuai commented on August 17, 2024

You will want to say something like, for all values we can give to the settings, some properties hold.

To be concrete, what would a running checker look like?

from coq-http2.

Related Issues (9)

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.