Sharing proofs for faster test execution

Many tests in neptune-core rely on cryptographic STARK proofs of correct program execution generated by Triton VM. It's time consuming to generate all the proofs required for the test suite. For this reason, the tests that require STARK-proofs should deterministic such that proofs can be reused across test runs.

In order to run the tests on machines that cannot produce the proofs easily, a proof server can be used. This proof server is a simple HTTP file server that has the proofs stored as files.

Getting the proofs from a proof server

Ask someone involved with the project for a URL and put the URL into the proof_servers.txt file.

Running a proof server

If you have a powerful machine you can generate all proofs yourself. You can then run a file server that serves files that match the name of the files that were produced (and placed in neptune-core/test_data/) during the execution of the test suite.

Such a server can e.g. be run as an nginx file server with the following settings:

limit_req_zone $binary_remote_addr zone=file_rate_limit:10m rate=1r/s;
limit_req_zone $server_name zone=global_rate_limit:10m rate=2r/s;

server {
    listen 42580;       # IPv4 listener
    listen [::]:42580;  # IPv6 listener
    server_name <ip_or_url>;

    # Block access to the root URL
    location = / {
        return 404;  # Return 404 for the root URL
    }

    # Serve .proof files from the directory
    location ~* ^/[a-z0-9]+\.proof$ {
        alias /var/www/neptune-core-proofs/;
        autoindex off;
        autoindex_exact_size off;
        autoindex_localtime off;

        # Limit allowed HTTP methods to GET
        limit_except GET {
            deny all;  # Block all other methods
        }

        # Ensure no trailing slash is appended to the URL
        try_files $uri =404;

        # Per-client rate limit
        limit_req zone=file_rate_limit burst=1 nodelay;

        # Global rate limit
        limit_req zone=global_rate_limit burst=1 nodelay;
    }

    # Restrictive robots.txt
    location = /robots.txt {
        return 200 "User-agent: *\nDisallow: /\n";
        add_header Content-Type text/plain;

        # Limit allowed HTTP methods to GET
        limit_except GET {
            deny all;  # Block all other methods
        }

        # Per-client rate limit
        limit_req zone=file_rate_limit burst=1 nodelay;

        # Global rate limit
        limit_req zone=global_rate_limit burst=1 nodelay;
    }
}

If you want to serve your proofs directly from your neptune-core repository, you can change the alias argument above.