{"id":20267852,"url":"https://github.com/mit-pdos/daisy-nfsd","last_synced_at":"2025-03-03T22:13:56.592Z","repository":{"id":53715210,"uuid":"325077883","full_name":"mit-pdos/daisy-nfsd","owner":"mit-pdos","description":"DaisyNFS is an NFS server verified using Dafny and Perennial.","archived":false,"fork":false,"pushed_at":"2024-10-16T23:35:08.000Z","size":1917,"stargazers_count":35,"open_issues_count":0,"forks_count":5,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-01-14T05:24:08.136Z","etag":null,"topics":["dafny","verification"],"latest_commit_sha":null,"homepage":"","language":"Dafny","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mit-pdos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-28T17:45:09.000Z","updated_at":"2025-01-09T21:26:30.000Z","dependencies_parsed_at":"2024-01-11T20:37:37.986Z","dependency_job_id":"ff922d54-cb80-4513-b214-579575ff89f1","html_url":"https://github.com/mit-pdos/daisy-nfsd","commit_stats":null,"previous_names":["mit-pdos/dafny-nfsd","mit-pdos/dafny-jrnl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-pdos%2Fdaisy-nfsd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-pdos%2Fdaisy-nfsd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-pdos%2Fdaisy-nfsd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mit-pdos%2Fdaisy-nfsd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mit-pdos","download_url":"https://codeload.github.com/mit-pdos/daisy-nfsd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241746795,"owners_count":20013165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dafny","verification"],"created_at":"2024-11-14T12:15:37.952Z","updated_at":"2025-03-03T22:13:56.562Z","avatar_url":"https://github.com/mit-pdos.png","language":"Dafny","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DaisyNFS\n\n[![CI](https://github.com/mit-pdos/daisy-nfsd/actions/workflows/main.yml/badge.svg)](https://github.com/mit-pdos/daisy-nfsd/actions/workflows/main.yml)\n\nA verified crash-safe, concurrent NFS server. The idea is to make operations\natomic with a verified transaction system from\n[GoTxn](https://github.com/mit-pdos/go-journal), and then verify the atomic\nbehavior of each operation in Dafny. The atomicity justifies using sequential\nproofs in Dafny to reason about the body of each transaction, which we prove\nimplements an NFS server. This proof strategy combines interactive theorem\nproving in Perennial, to reason about the tricky concurrency and crash safety in\nthe transaction system, with automated proofs in Dafny for the file-system code.\n\n## Architecture\n\nThere are three main components:\n\n- The Dafny file-system implementation in [`src/fs`](src/fs/)\n- The Go interfaces assumed by the Dafny code implemented in\n  [`dafny_go`](dafny_go/) (the jrnl API is a thin wrapper around the\n  github.com/mit-pdos/go-journal/txn package).\n- The NFS server binary that calls the verified Dafny code is implemented\n  between [`nfsd`](nfsd/) and [`cmd/daisy-nfsd`](cmd/daisy-nfsd/).\n\nThe Dafny proof is split into three parts:\n\n- external interfaces only assumed in Dafny via `{:extern}`:\n  [`src/jrnl`](src/jrnl) (the transaction system) and\n  [`src/machine`](src/machine) (Go primitives)\n- verified helper libraries in [`src/util`](src/util) that would basically be in\n  a decent Dafny standard library\n- the actual file-system proof, documented in its own [README](src/fs/README.md)\n\nAt the top level of the repo we also have various scripts. [`eval`](eval/) and\n[`bench`](bench/) have scripts to run performance experiments (see the [eval\nREADME](eval/README.md) for more details). [`artifact`](artifact/) has an older\nsetup for running the evaluation on a VM; these days we use an AWS setup.\n[`etc`](etc/) has miscellaneous scripts used for debugging and to implement\ncontinuous integration.\n\n## Compiling\n\nRun `make` to compile and verify everything, or `make compile` to just compile\nfrom Dafny to Go. Then you can build the server with `go build ./cmd/daisy-nfsd`.\n\nYou'll need Dafny 4:\n\n- On Arch Linux you can get `dafny-bin` from the AUR\n- On macOS use `brew install dafny`\n- For other systems the easiest solution is to download a binary release from\n  \u003chttps://github.com/dafny-lang/dafny/releases\u003e, extract it, and add it to your\n  $PATH (this is what we have to do in CI, which runs on Ubuntu 22.04).\n\nCompilation additionally depends on `goimports` to remove unused imports:\n\n```sh\ngo install golang.org/x/tools/cmd/goimports@latest\n```\n\nThen you can run some sanity tests over the bank and file-system examples.\nThese are ordinary Go tests that import the code generated from Dafny and\nrun it, linking with [go-nfsd](https://github.com/mit-pdos/go-nfsd),\nspecifically with its `twophase` package. To run these tests,\nafter compiling with `make compile`, run:\n\n```sh\ngo test -v ./tests\n```\n\n## Running the NFS server\n\n### Linux\n\nYou'll need some basic utilities: the rpcbind service to tell the server what\nport to run on, and the NFS client utilities to mount the file system. On Arch\nLinux these are available using `pacman -S rpcbind nfs-utils` and on Ubuntu you\ncan use `apt-get install rpcbind nfs-common`.\n\nYou might need to start the rpcbind service with `systemctl start rpcbind`. It\nseems to help if you also run `systemctl start rpc-statd` (it should be\nauto-launched when needed, though). The `rpcinfo -p` command is useful for\nverifying that an `portmapper` service is running on port 111.\n\nNow run `go run ./cmd/daisy-nfsd` to start the server (with an in-memory disk)\nand `sudo mount localhost:/ /mnt/nfs` to mount it using the Linux NFS client.\n\nIf you encounter an error with the message `Too many levels of symbolic links.`,\ndon't panic! This is actually due to a bug in the Linux NFS client, which was\nfixed in December 2020 in [commit\n3b2a09f127e02](https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=3b2a09f127e025674945e82c1ec0c88d6740280e).\nIf a READDIR result was larger than a page, Linux would simply discard the extra\ndata, resulting in a corrupted response. You'll need at least version 5.11 of\nthe kernel to get the fix (you can check what you have with `uname -r`).\n\n### macOS\n\nOn macOS you already have `rpcbind` and the NFS client utilities, but you'll\nneed to start a couple services with:\n\n```sh\nsudo launchctl start com.apple.rpcbind\nsudo launchctl start com.apple.lockd\n```\n\nYou can mount with `sudo mount localhost:/ /mnt/nfs` as for Linux, or without\nbecoming root in Finder with Go \u003e Connect to server... and connecting to\n`nfs://localhost/`.\n\n## Developing\n\nWe provide a library at `dafny_go` that exports some external APIs that are\naxiomatized using `{:extern}` modules, classes, and methods in Dafny. Some of\nthese are core primitives, like `[]byte` and little-endian encoding, while the\nbig one is the `jrnl` package which interfaces between Dafny and\n`github.com/mit-pdos/go-nfsd/txn`.\n\nThe support library is trusted and hence its agreement with the Dafny spec is\nimportant.\n\nYou can run tests for this support library with `go test`:\n\n```sh\ngo test ./dafny_go/...\n```\n\n## Checking verification performance\n\nTo time verification and analyze the results easily, we have a script to process timing from Dafny's `/trace` option. Use it with the following fish function:\n\n```fish\nfunction dafny_time\n  set -l file $argv[1]\n  dafny /timeLimit:10 /compile:0 /arith:5 /noNLarith /trace $file $argv[2..-1] \u003e .timing.prof\n  cat .timing.prof | ./etc/summarize-timing\nend\n```\n\nThe timing infrastructure itself is implemented as a library in `etc/`. It even\nhas tests, which you can run with `pytest`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmit-pdos%2Fdaisy-nfsd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmit-pdos%2Fdaisy-nfsd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmit-pdos%2Fdaisy-nfsd/lists"}