Skip to content
This repository was archived by the owner on Apr 12, 2023. It is now read-only.

Tlino msc io spec 2#64

Open
LinoTelschow wants to merge 27 commits intotlino-msc-io-specfrom
tlino-msc-io-spec-2
Open

Tlino msc io spec 2#64
LinoTelschow wants to merge 27 commits intotlino-msc-io-specfrom
tlino-msc-io-spec-2

Conversation

@LinoTelschow
Copy link
Collaborator

No description provided.

pure func ToAbsIA(ia addr.IA) AbsIA

ghost
requires acc(path.HopFieldInv(hop), _)
Copy link
Owner

Choose a reason for hiding this comment

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

we are not establishing any functional relation between the result and the original hop (e.g., that they have the same egressID). Is the plan to change that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think we can do this, at the moment it is a bit tricky to relate the current hop to its abstraction within the processSCION method. But i think it can be done by adding a absHop entry to the scionPacketProcessor struct and keep their relation with help of the Mem predicate of scionPacketProcessor

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But I first need to know if the rest of the code is fine before proceeding

LinoTelschow and others added 9 commits March 4, 2022 12:38
* added helper functons to speedup verification

* added additional ghost state to distinguish address sources

* improved performance of processOHP2

* defined addrFromSCIONPkt as non ghost

* outlined another method

* added comments

* adapted some comments
Copy link
Owner

@jcp19 jcp19 left a comment

Choose a reason for hiding this comment

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

I'm still going through it, but I have some comments already

ghost
requires verifyutils.BytesAcc(b)
decreases _
pure func ToAbsBytes2(b []byte) (res AbsBytes)
Copy link
Owner

Choose a reason for hiding this comment

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

you can specify here that the result of this operation is equal to the result of calling ToAbsBytes with b

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this was my first idea, but this significantly increases the verification time.

Copy link
Owner

Choose a reason for hiding this comment

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

Hmm, how big was the increase in verification time?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I stopped after 20 minutes
Before it was around 90 seconds

Comment on lines +149 to +155
// lemmas
ghost
requires acc(verifyutils.BytesAcc(b), _)
requires absBytes == unfolding acc(verifyutils.BytesAcc(b), _) in ToAbsBytes(b)
ensures absBytes == ToAbsBytes2(b)
decreases _
pure func relateByteAccess(b []byte, absBytes AbsBytes) bool No newline at end of file
Copy link
Owner

Choose a reason for hiding this comment

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

this is probably not necessary, look at my comment for the ToAbsBytes2 function

ghost
requires scn.Mem()
requires data == unfolding scn.Mem() in scn.RawPkt
ensures absBytes == GetAbsSCIONRawPkt(ToAbsSCION(scn))
Copy link
Owner

Choose a reason for hiding this comment

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

You could probably move this postcondition (with some editing) to the ToAbsSCION function. Is there any reason to not do so?

Copy link
Owner

Choose a reason for hiding this comment

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

You can probably do something similar for the other lemmas here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe i can move this postcondtion, but we have to be very careful.
Like in the case for the ToAbsBytes2 method, an unfolding in the contract can increase the verification time.
And the SCION type requires a lot of nested unfoldings.
Thus, I have decided to use only lemma methods to specify the getter methods of abstract types

Copy link
Owner

Choose a reason for hiding this comment

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

Ok, it is also fine to keep the lemma methods. However, they are currently implemented as pure functions which means that they introduce new axioms, and we cannot control very well when they are brought into context. Let's use non-pure functions for that

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I have tested it with non-pure functions,
It is about 3 minutes slower, but I guess its still ok.
Btw, what do you mean exactly by "they introduce new axioms, and we cannot control very well when they are brought into context."?

@jcp19 jcp19 marked this pull request as ready for review March 11, 2022 16:56
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants