Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7cca7f9
backup
jcp19 Oct 13, 2024
c7190e3
fix package clause
jcp19 Oct 13, 2024
ffebf55
add //+gobra
jcp19 Oct 13, 2024
c935b45
backup
jcp19 Oct 13, 2024
7a6ea93
backup
jcp19 Nov 14, 2024
b33b6e8
clean-up path packages
jcp19 Nov 14, 2024
c0118eb
backup
jcp19 Nov 14, 2024
6c204c7
backup
jcp19 Nov 14, 2024
b147515
generalize monoset, prevent overflows in monoset
jcp19 Nov 15, 2024
0d92331
gopacket
jcp19 Nov 15, 2024
6293425
backup
jcp19 Nov 15, 2024
557beb3
backup
jcp19 Nov 15, 2024
d5fe88d
slayers
jcp19 Nov 15, 2024
8567157
changes to router invariants
jcp19 Nov 15, 2024
fc06cbf
backup
jcp19 Nov 15, 2024
449b3f9
rename file
jcp19 Nov 15, 2024
37c85e4
cleanup
jcp19 Nov 16, 2024
6a33fab
Merge branch 'master' into minit
jcp19 Jan 17, 2025
679a587
Merge branch 'master' into minit
jcp19 Jan 22, 2025
6c4a0d4
merge with master
jcp19 Mar 25, 2025
b9cfca1
forgot import pres
jcp19 Mar 25, 2025
9461fdc
fix friend paths
jcp19 May 8, 2025
8c2521f
Update pkg/experimental/epic/epic_spec.gobra
jcp19 May 9, 2025
e3fab7f
enable friend clauses in gobra
jcp19 May 9, 2025
441fdb7
start expanding dependencies in the github actions
jcp19 May 9, 2025
90ee509
restore recursive option for dependencies
jcp19 May 9, 2025
3adf72c
exclude yet another package
jcp19 May 9, 2025
d71b3f0
fix CI
jcp19 May 9, 2025
d2b3330
add doc
jcp19 May 9, 2025
b8f8a5b
fix error in CI
jcp19 May 9, 2025
839110f
fix other CI issues
jcp19 May 9, 2025
33509c4
fix other CI issues
jcp19 May 9, 2025
69135c6
fix other CI issues
jcp19 May 9, 2025
9d43214
Update pkg/slayers/path/path_spec.gobra
jcp19 May 9, 2025
acdd1c0
fix verification error
jcp19 May 9, 2025
9a52e60
Merge branch 'minit' of github.com:viperproject/VerifiedSCION into minit
jcp19 May 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 69 additions & 17 deletions .github/workflows/gobra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,40 +21,31 @@ env:
checkConsistency: '1'
imageVersion: 'latest'
mceMode: 'od'
requireTriggers: '1'
# disabled for now, as it is unclear which triggers to
# provide to monoset in a way that it does not severely
# affect perf.
requireTriggers: '0'
useZ3API: '0'
viperBackend: 'SILICON'
disableNL: '0'
unsafeWildcardOptimization: '0'
overflow: '0'
respectFunctionPrePermAmounts: '0'
enableFriendClauses: '1'

jobs:
verify-deps:
verify-third-party-libs:
runs-on: ubuntu-latest
steps:
- name: Checkout the VerifiedSCION repository
uses: actions/checkout@v3
# Skip caching for now, the Github action right now is very limited.
# - name: Cache the verification results
# uses: actions/cache@v3
# env:
# cache-name: gobra-cache
# with:
# path: ${{ runner.workspace }}/.gobra/cache.json
# key: ${{ env.cache-name }}

# We split the verification of the entire repository into
# multiple steps. This provides a more fine-grained log in
# Github Workflow's interface and it allows more fine-grained
# control over the settings applied to each package (this last
# point could be also be solved by adapting the action to allow
# per package config).
- name: Verify the packages in the 'verification' directory
uses: viperproject/gobra-action@main
with:
projectLocation: 'VerifiedSCION/verification'
recursive: 1
## Due to a bug, we cannot use the recursive mode with friend pacakge invariants.
excludePackages: 'layers'
timeout: 5m
headerOnly: ${{ env.headerOnly }}
module: ${{ env.module }}
Expand All @@ -71,6 +62,49 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
# due to the bug mention above, we need to verify this package separately
- name: Verify package 'verification/dependencies/github.com/google/gopacket/layers'
uses: viperproject/gobra-action@main
with:
packages: 'verification/dependencies/github.com/google/gopacket/layers'
timeout: 5m
headerOnly: ${{ env.headerOnly }}
module: ${{ env.module }}
includePaths: 'verification/dependencies/ .' # relative to project location
assumeInjectivityOnInhale: ${{ env.assumeInjectivityOnInhale }}
checkConsistency: ${{ env.checkConsistency }}
parallelizeBranches: ${{ env.parallelizeBranches }}
imageVersion: ${{ env.imageVersion }}
mceMode: ${{ env.mceMode }}
requireTriggers: ${{ env.requireTriggers }}
overflow: ${{ env.overflow }}
useZ3API: ${{ env.useZ3API }}
disableNL: ${{ env.disableNL }}
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
verify-deps:
runs-on: ubuntu-latest
steps:
- name: Checkout the VerifiedSCION repository
uses: actions/checkout@v3
# Skip caching for now, the Github action right now is very limited.
# - name: Cache the verification results
# uses: actions/cache@v3
# env:
# cache-name: gobra-cache
# with:
# path: ${{ runner.workspace }}/.gobra/cache.json
# key: ${{ env.cache-name }}

# We split the verification of the entire repository into
# multiple steps. This provides a more fine-grained log in
# Github Workflow's interface and it allows more fine-grained
# control over the settings applied to each package (this last
# point could be also be solved by adapting the action to allow
# per package config).
- name: Verify package 'pkg/addr'
uses: viperproject/gobra-action@main
with:
Expand All @@ -92,6 +126,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/experimental/epic'
uses: viperproject/gobra-action@main
with:
Expand All @@ -112,6 +147,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/log'
uses: viperproject/gobra-action@main
with:
Expand All @@ -132,6 +168,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/private/serrors'
uses: viperproject/gobra-action@main
with:
Expand All @@ -152,6 +189,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/scrypto'
uses: viperproject/gobra-action@main
with:
Expand All @@ -172,6 +210,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers'
uses: viperproject/gobra-action@main
with:
Expand All @@ -192,6 +231,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers/path'
uses: viperproject/gobra-action@main
with:
Expand All @@ -212,6 +252,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers/path/empty'
uses: viperproject/gobra-action@main
with:
Expand All @@ -232,6 +273,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers/path/epic'
uses: viperproject/gobra-action@main
with:
Expand All @@ -253,6 +295,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers/path/onehop'
uses: viperproject/gobra-action@main
with:
Expand All @@ -273,6 +316,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'pkg/slayers/path/scion'
uses: viperproject/gobra-action@main
with:
Expand All @@ -293,6 +337,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'private/topology'
uses: viperproject/gobra-action@main
with:
Expand All @@ -313,6 +358,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'private/topology/underlay'
uses: viperproject/gobra-action@main
with:
Expand All @@ -333,6 +379,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'private/underlay/conn'
uses: viperproject/gobra-action@main
with:
Expand All @@ -353,6 +400,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'private/underlay/sockctrl'
uses: viperproject/gobra-action@main
with:
Expand All @@ -373,6 +421,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'router/bfd'
uses: viperproject/gobra-action@main
with:
Expand All @@ -393,6 +442,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Verify package 'router/control'
uses: viperproject/gobra-action@main
with:
Expand All @@ -413,6 +463,7 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: ${{ env.unsafeWildcardOptimization }}
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
- name: Upload the verification report
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -446,3 +497,4 @@ jobs:
viperBackend: ${{ env.viperBackend }}
unsafeWildcardOptimization: '0'
respectFunctionPrePermAmounts: ${{ env.respectFunctionPrePermAmounts }}
enableFriendClauses: ${{ env.enableFriendClauses }}
17 changes: 12 additions & 5 deletions pkg/addr/host.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,16 @@

// +gobra

// @ initEnsures ErrBadHostAddrType.ErrorMem()
// @ initEnsures ErrMalformedHostAddrType.ErrorMem()
// @ initEnsures ErrUnsupportedSVCAddress.ErrorMem()
// @ dup pkgInvariant ErrBadHostAddrType != nil &&
// @ ErrMalformedHostAddrType != nil &&
// @ ErrUnsupportedSVCAddress != nil &&
// @ acc(ErrBadHostAddrType.ErrorMem(), _) &&
// @ acc(ErrMalformedHostAddrType.ErrorMem(), _) &&
// @ acc(ErrUnsupportedSVCAddress.ErrorMem(), _) &&
// @ ErrBadHostAddrType.IsDuplicableMem() &&
// @ ErrMalformedHostAddrType.IsDuplicableMem() &&
// @ ErrUnsupportedSVCAddress.IsDuplicableMem()

package addr

import (
Expand Down Expand Up @@ -206,7 +213,7 @@ func (h HostIPv4) IP() (res net.IP) {
func (h HostIPv4) Copy() (res HostAddr) {
//@ unfold acc(h.Mem(), R13)
//@ unfold acc(sl.Bytes(h, 0, len(h)), R13)
var tmp HostIPv4 = HostIPv4(append( /*@ R13, @*/ net.IP(nil), h...))
tmp := HostIPv4(append( /*@ R13, @*/ net.IP(nil), h...))
//@ fold acc(sl.Bytes(h, 0, len(h)), R13)
//@ fold sl.Bytes(tmp, 0, len(tmp))
//@ fold acc(h.Mem(), R13)
Expand Down Expand Up @@ -274,7 +281,7 @@ func (h HostIPv6) IP() (res net.IP) {
func (h HostIPv6) Copy() (res HostAddr) {
//@ unfold acc(h.Mem(), R13)
//@ unfold acc(sl.Bytes(h, 0, len(h)), R13)
var tmp HostIPv6 = HostIPv6(append( /*@ R13, @*/ net.IP(nil), h...))
tmp := HostIPv6(append( /*@ R13, @*/ net.IP(nil), h...))
//@ fold acc(sl.Bytes(h, 0, len(h)), R13)
//@ fold sl.Bytes(tmp, 0, len(tmp))
//@ fold acc(h.Mem(), R13)
Expand Down
25 changes: 25 additions & 0 deletions pkg/addr/host_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package addr
import (
"net"

"github.com/scionproto/scion/verification/utils/errors"
"github.com/scionproto/scion/verification/utils/slices"
)

Expand Down Expand Up @@ -70,3 +71,27 @@ pure func sizeOfHostAddrType(htype HostAddrType) (res int) {
HostLenIPv4 : htype == HostTypeIPv6 ?
HostLenIPv6 : HostLenSVC
}

ghost
ensures ErrBadHostAddrType.ErrorMem()
decreases
func EstablishErrBadHostAddrTypeMem() {
openDupPkgInv
errors.DupErrorsCanBePromoted(ErrBadHostAddrType)
}

ghost
ensures ErrMalformedHostAddrType.ErrorMem()
decreases
func EstablishErrMalformedHostAddrTypeMem() {
openDupPkgInv
errors.DupErrorsCanBePromoted(ErrMalformedHostAddrType)
}

ghost
ensures ErrUnsupportedSVCAddress.ErrorMem()
decreases
func EstablishErrUnsupportedSVCAddressMem() {
openDupPkgInv
errors.DupErrorsCanBePromoted(ErrUnsupportedSVCAddress)
}
2 changes: 1 addition & 1 deletion pkg/experimental/epic/epic.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// +gobra

// @ initEnsures acc(postInitInvariant(), _)
// @ dup pkgInvariant acc(postInitInvariant(), _)
package epic

import (
Expand Down
7 changes: 4 additions & 3 deletions pkg/experimental/epic/epic_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ pred postInitInvariant() {

// learn the invariant established by init
ghost
trusted // TODO: drop after init invs are added
ensures acc(postInitInvariant(), _)
decreases _
func establishPostInitInvariant()
decreases
func establishPostInitInvariant() {
openDupPkgInv
}
3 changes: 3 additions & 0 deletions pkg/private/serrors/serrors_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,8 @@ func WrapStr(msg string, cause error, errCtx ...interface{}) (res error)
preserves forall i int :: { &errCtx[i] } 0 <= i && i < len(errCtx) ==> acc(&errCtx[i], R15)
ensures res != nil && res.ErrorMem()
ensures res.IsDuplicableMem()
// New always returns a pointer to a basicError, thus it
// only produces comparable values
ensures isComparable(res)
decreases
func New(msg string, errCtx ...interface{}) (res error)
10 changes: 4 additions & 6 deletions pkg/slayers/layertypes_spec.gobra
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,11 @@
// +gobra

// To be added on a per-need basis
initEnsures LayerTypeSCION == 1000
dup pkgInvariant LayerTypeSCION == 1000
package slayers

import (
"github.com/google/gopacket"

// the following comes from gopacket/layers instead of gopacket
importRequires gopacket.LayerTypesMem()
importRequires forall t gopacket.LayerType :: { gopacket.Registered(t) } 1000 <= t ==>
!gopacket.Registered(t)
"github.com/google/gopacket/layers"
)

Expand Down Expand Up @@ -60,20 +55,23 @@ var (

// post init properties
ghost
trusted
ensures res === LayerClassSCION
ensures res != nil
ensures res == (gopacket.LayerClass)(gopacket.LayerType(1000))
decreases
func LayerClassSCIONIsLayerType() (res gopacket.LayerClass)

ghost
trusted
ensures res === LayerClassSCMP
ensures res != nil
ensures res == (gopacket.LayerClass)(gopacket.LayerType(1002))
decreases
func LayerClassSCMPIsLayerType() (res gopacket.LayerClass)

ghost
trusted
ensures res === LayerClassHopByHopExtn
ensures res != nil
ensures res == (gopacket.LayerClass)(gopacket.LayerType(1003))
Expand Down
Loading
Loading