Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-implement randomness server in rust #50

Merged
merged 93 commits into from
Apr 24, 2023
Merged

Re-implement randomness server in rust #50

merged 93 commits into from
Apr 24, 2023

Commits on Nov 3, 2022

  1. Add renovate.json

    renovate[bot] authored Nov 3, 2022
    Configuration menu
    Copy the full SHA
    61683a6 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2022

  1. Stub out a axum-based rust web service.

    The new version of the nitriding framework can proxy http traffic
    to a separate server running inside the enclave. This allows us
    to replace the ffi calls from golang with a pure-rust server
    implementation, which is less error-prone.
    rillian committed Dec 15, 2022
    Configuration menu
    Copy the full SHA
    abeaa61 View commit details
    Browse the repository at this point in the history

Commits on Jan 10, 2023

  1. Stub out axum routes

    rillian committed Jan 10, 2023
    Configuration menu
    Copy the full SHA
    0676723 View commit details
    Browse the repository at this point in the history

Commits on Jan 27, 2023

  1. Fix up logging

    Use the `info!` convenience macro with the default logger,
    which reads the `RUST_LOG` environment variable. So run with:
    
        RUST_LOG=tower_http=trace,star_randsrv=debug cargo run
    
    for reasonable output.
    
    By default it's `ERROR` level only, so there's no convenience
    info about requests or listening port; would be nice to default
    to `star_randsrv=info` or something like that.
    rillian committed Jan 27, 2023
    Configuration menu
    Copy the full SHA
    5d1233a View commit details
    Browse the repository at this point in the history

Commits on Jan 30, 2023

  1. Stub out the /randomness endpoint

    Define structs for the request and response and plumb them
    through with a dummy response value.
    rillian committed Jan 30, 2023
    Configuration menu
    Copy the full SHA
    2b98c57 View commit details
    Browse the repository at this point in the history

Commits on Feb 1, 2023

  1. Stub out /randomness endpoint

    FIXME: only processes the first point.
    
    Note that the `State` argument must come *before* the request,
    not after!
    rillian committed Feb 1, 2023
    Configuration menu
    Copy the full SHA
    1e755ee View commit details
    Browse the repository at this point in the history

Commits on Feb 3, 2023

  1. Processes all submitted points.

    Needs better error handling.
    rillian committed Feb 3, 2023
    Configuration menu
    Copy the full SHA
    6aacdae View commit details
    Browse the repository at this point in the history

Commits on Feb 7, 2023

  1. cargo fmt

    rillian committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    3975a2f View commit details
    Browse the repository at this point in the history
  2. Update rust deps

    Use the current version of the ppoprf which cleans up some
    unneeded dependencies. Bump everything else to the latest
    compatible version.
    rillian committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    e621f9b View commit details
    Browse the repository at this point in the history
  3. Replace Mutex with RwLock.

    This allows multiple concurrent reads to the ppoprf struct for
    evaluations. We only need exclusive access to reset or puncture.
    rillian committed Feb 7, 2023
    Configuration menu
    Copy the full SHA
    5b63a76 View commit details
    Browse the repository at this point in the history

Commits on Feb 9, 2023

  1. Add basic comments to types

    Make the API docs slightly less sparse
    rillian committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    23c4e9b View commit details
    Browse the repository at this point in the history
  2. Stub out background epoch rotation task

    Spawn a background task to advance the current epoch on a fixed
    schedule. When it runs out of epochs it eventually panics the
    main thread instead of re-initializing the ppoprf state.
    rillian committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    a0137ca View commit details
    Browse the repository at this point in the history
  3. Rotate OPRF key when epoch list is exhausted.

    Instead of leaving all epochs puctured and later panicking, create
    and fresh OPRFServer instance with the same set of epochs and
    continue with that.
    
    Abstract the struct initialization into OPRFServer::new() so it
    can be called from both locations, Move the `future_epochs`
    initialization inside the background loop so the same code
    can be used each time a new state is initialized.
    rillian committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    a0cf909 View commit details
    Browse the repository at this point in the history
  4. Add error handling

    Define a response type for errors and convert various unwrap()
    and expect() calls to return that instead.
    
    Replace the iterator chain in the randomness handler with an
    explicit loop so we can return early if there's an error in
    the request data.
    rillian committed Feb 9, 2023
    Configuration menu
    Copy the full SHA
    48ce3cf View commit details
    Browse the repository at this point in the history

Commits on Feb 10, 2023

  1. Fix clippy lints

    Turns out enum variants with inner values don't just look like
    functions, they actually work as a FnOnce!
    
    Also stonger camelcasing.
    rillian committed Feb 10, 2023
    Configuration menu
    Copy the full SHA
    0896f57 View commit details
    Browse the repository at this point in the history

Commits on Feb 13, 2023

  1. Fix OPRF key rotation

    The previous code reset the `future_epochs` vector before the
    empty check that was supposed to trigger re-initialization.
    So OprfServer.epoch was updated, but the actual set of viable
    epochs was punctured, resulting in perpetual "No prefix found"
    errors.
    
    Instead, assume we'll use contiguous blocks of epoch numbers
    and store them as a Range, which is smaller and more convenient.
    `EpochRange` never needs to change and can be passed to
    `OprfServer::new` each time the key is rotated.
    
    Note that because `Range` and `InclusiveRange` are different
    types, we can't both keep the range as `u8` and include epoch
    255. I though code simplicity was more important here.
    rillian committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    e77eeec View commit details
    Browse the repository at this point in the history
  2. Remove old nitriding implementation

    Instead of linking over ffi from the go nitriding framework,
    build it as a separate proxy daemon which runs inside the
    the same container as star-randsrv.
    rillian committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    acdb3fb View commit details
    Browse the repository at this point in the history
  3. Update Dockerfile to build the new configuration.

    Having `nitriding` as a submodule complicates copying just
    that subtree to the go-builder, so we copy everything, which
    is slow if there are local build files.
    rillian committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    49c118b View commit details
    Browse the repository at this point in the history
  4. Update Makefile

    Build and lint the local application. Assume the nitriding
    repo takes care of itself.
    rillian committed Feb 13, 2023
    Configuration menu
    Copy the full SHA
    4a54a87 View commit details
    Browse the repository at this point in the history

Commits on Feb 14, 2023

  1. Don't lint nitriding

    Rather than installing golangci-lint so the default Makefile
    target in nitriding/cmd can run it, just build the `nitriding`
    target directly. This is a faster build and follows our earlier
    policy of treating the submodule as a separate unit for testing.
    rillian committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    3dc48a1 View commit details
    Browse the repository at this point in the history
  2. Fix build path

    Copy `star-randsrv` from the correct path so both executables
    are present in the final container.
    rillian committed Feb 14, 2023
    Configuration menu
    Copy the full SHA
    d5652ed View commit details
    Browse the repository at this point in the history

Commits on Feb 15, 2023

  1. Base container on debian:slim

    This is 5x larger than the alpine containers, but provides
    the expected execution environment.
    rillian committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    b3daa78 View commit details
    Browse the repository at this point in the history
  2. Use static builds with the docker container.

    Go back to using alpine linux for the runtime, which requires
    building with CGO disabled, and on the rust:alpine build
    container to avoid dependencies on glibc.
    
    This is about 25% the size of the debian:slim runtime container.
    rillian committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    c529e8c View commit details
    Browse the repository at this point in the history
  3. Use nitriding's static build

    Which to a revision of `nitriding` that builds a static executable
    by default so we can invoke the Makefile but still use it with
    our alpine runtime container.
    rillian committed Feb 15, 2023
    Configuration menu
    Copy the full SHA
    fa22c5f View commit details
    Browse the repository at this point in the history

Commits on Feb 17, 2023

  1. Implement /info endoint

    Doesn't return the timestamp at the end of the epoch.
    
    We don't support returning the zk proofs, so returning the public
    key isn't useful, but neither does the current golang version,
    and I wanted to match its api. I expect that to change when we
    implement batch proofs anyway.
    rillian committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    c0b0395 View commit details
    Browse the repository at this point in the history
  2. Enforce current epoch and max points per request.

    Instead of accepting any unpunctured epoch, and letting the
    ppoprf eval fail for punctured ones, filter out non-current
    epochs when the request is processed.
    
    Also enforce the MAX_POINTS limit on requests. By this point
    the point vec has already been constructed, so this doesn't
    affect the amount of memory consumed, but it still limits
    the cpu cost of each request, making any denial-of-service
    mitigation based on network flows more effective.
    rillian committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    0951a7b View commit details
    Browse the repository at this point in the history
  3. Add a test for the root endpoint

    Set up a testing framework inside the main implementation to check
    the handlers without the overhead of a network socket. Based on
    the `testing` example from the axum repository.
    
    Test that the `/` route returns some text.
    rillian committed Feb 17, 2023
    Configuration menu
    Copy the full SHA
    1c6477e View commit details
    Browse the repository at this point in the history

Commits on Feb 27, 2023

  1. Update to Rust edition 2021.

    `TryFrom` will be useful for making `ppoprf::Point` creation
    properly fallible. Also makes future updates smoother.
    rillian committed Feb 27, 2023
    Configuration menu
    Copy the full SHA
    7dc91bf View commit details
    Browse the repository at this point in the history
  2. Update Dockerfile to use golang:1.20

    Co-authored-by: Philipp Winter <[email protected]>
    rillian and Philipp Winter authored Feb 27, 2023
    Configuration menu
    Copy the full SHA
    41ed6ed View commit details
    Browse the repository at this point in the history
  3. Update start.sh with dev deployment fqdn

    Co-authored-by: Philipp Winter <[email protected]>
    rillian and Philipp Winter authored Feb 27, 2023
    Configuration menu
    Copy the full SHA
    5074c17 View commit details
    Browse the repository at this point in the history
  4. Fix typo

    Co-authored-by: Philipp Winter <[email protected]>
    rillian and Philipp Winter authored Feb 27, 2023
    Configuration menu
    Copy the full SHA
    86231bb View commit details
    Browse the repository at this point in the history
  5. fix typo

    Co-authored-by: Philipp Winter <[email protected]>
    rillian and Philipp Winter authored Feb 27, 2023
    Configuration menu
    Copy the full SHA
    f56033e View commit details
    Browse the repository at this point in the history
  6. Merge remote-tracking branch 'origin/main' into rust

    Dependency updates on the obsolete go side.
    rillian committed Feb 27, 2023
    Configuration menu
    Copy the full SHA
    1cf8794 View commit details
    Browse the repository at this point in the history
  7. Merge remote-tracking branch 'origin/main' into rust

    Resolve Cargo.lock conflicts omitted in the previous
    commit.
    rillian committed Feb 27, 2023
    Configuration menu
    Copy the full SHA
    000b9f8 View commit details
    Browse the repository at this point in the history
  8. Use thiserror to derive error messages

    Previously I implemented the stringification manually to keep
    things shallow for auditors, but this makes the source more
    compact without adding much functionality.
    
    This adds about 4k to the release binary size.
    rillian committed Feb 27, 2023
    Configuration menu
    Copy the full SHA
    91a361c View commit details
    Browse the repository at this point in the history
  9. Remove map_err calls

    Use the `From` impl with the `?` operator to map errors implicitly.
    This simplifies reading the code, but I'm not convinced it's better
    for auditing, where all the paths need to be traced.
    rillian committed Feb 27, 2023
    Configuration menu
    Copy the full SHA
    d7f7f92 View commit details
    Browse the repository at this point in the history

Commits on Mar 6, 2023

  1. Configuration menu
    Copy the full SHA
    6fa4ea9 View commit details
    Browse the repository at this point in the history
  2. cargo fmt

    Reformat to fix layout nits.
    Used `cargo fmt -- --config max_width=78`
    rillian committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    0ed4bf4 View commit details
    Browse the repository at this point in the history
  3. Add command line switches

    Use the `clap` crate to derive a parser and help text for setting
    the webservice config options through command-line switches.
    
    > STAR randomness webservice
    >
    > Usage: star-randsrv [OPTIONS]
    >
    > Options:
    >       --epoch-seconds <EPOCH_SECONDS>  Duration of each randomness epoch [default: 5]
    >       --first-epoch <FIRST_EPOCH>      First epoch tag to make available [default: 0]
    >       --last-epoch <LAST_EPOCH>        Last epoch tag to make available [default: 255]
    >   -h, --help                           Print help
    >   -V, --version                        Print version
    rillian committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    981e66a View commit details
    Browse the repository at this point in the history
  4. cargo fmt

    rillian committed Mar 6, 2023
    Configuration menu
    Copy the full SHA
    eec9dcd View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2023

  1. Add test for the /info endpoint

    Confirm we get valid json with the correct keys and types.
    rillian committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    46f9c42 View commit details
    Browse the repository at this point in the history
  2. Verify we can parse the server public key

    Undo the two layers of encoding to recover the original
    struct, throwing if any of the steps fails. This gives
    some basic confirmation that the `/info` endpoint returned
    something plausible.
    rillian committed Mar 7, 2023
    Configuration menu
    Copy the full SHA
    0e1a3a8 View commit details
    Browse the repository at this point in the history

Commits on Mar 8, 2023

  1. Add test for the /randomness endpoint

    Submit a random RistrettoPoint and confirm we get one back
    under the correct epoch.
    rillian committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    e8a43dc View commit details
    Browse the repository at this point in the history
  2. Consolitate test app into a helper

    Use the same config for each test and call a helper function
    to construct the `app` axum router state for testing. This
    removes duplication and makes the test code more compact.
    rillian committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    d98b622 View commit details
    Browse the repository at this point in the history
  3. Consolidate request building.

    Move the redundant parts of generating a request for an endpoint
    into a helper function. If a payload is included, the request
    is POSTed as application/json.
    
    This doesn't save any code really, but makes the tests a bit
    easier to read since we lose the conversion code to build the
    request.
    rillian committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    d4fec5b View commit details
    Browse the repository at this point in the history
  4. Verify welcome message is utf-8.

    We want something human-readable there.
    rillian committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    75319f9 View commit details
    Browse the repository at this point in the history
  5. Shorten test names.

    We don't have unit tests other than for the endpoints,
    so might as well be brief.
    rillian committed Mar 8, 2023
    Configuration menu
    Copy the full SHA
    a263104 View commit details
    Browse the repository at this point in the history

Commits on Mar 22, 2023

  1. Report the next epoch rotation time

    Fill in the `nextEpochTime` field in the `/info` response with
    the RFC 3339 timestamp of the next rotation. Make the field
    optional so we can set it on one place inside the update loop.
    rillian committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    cd2caf0 View commit details
    Browse the repository at this point in the history
  2. Truncate nextEpochTime to the nearest second.

    Just to shorten the timestamp string, which doesn't need
    nanosecond precision.
    rillian committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    3cdfd2d View commit details
    Browse the repository at this point in the history
  3. Update InfoResponse test for nextEpochTime field

    Fill in a dummy timestamp whem making a test OPRFServer state.
    This is sufficient to pass the simple `is_string` check in the
    endpoint unit test.
    rillian committed Mar 22, 2023
    Configuration menu
    Copy the full SHA
    7373b39 View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2023

  1. Improve comments

    Fix typos and elaborate on more fields for clarity.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    5f67b3e View commit details
    Browse the repository at this point in the history
  2. Merge remote-tracking branch 'origin/main' into rust

    Merge upstream Cargo.lock changes by just re-running
    `cargo update` on this branch as well.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    cd8efb0 View commit details
    Browse the repository at this point in the history
  3. cargo fmt

    Apply standard formatting with a 78-character line length.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    0b559de View commit details
    Browse the repository at this point in the history
  4. Use fewer temporaries constructing InfoResponse

    Save a couple of lines by setting response values from short
    expressions inside the struct constructor.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    163f726 View commit details
    Browse the repository at this point in the history
  5. Verify maxPoints and nextEpochTime in InfoResponse test

    Check that the values we use in `test_app` make it into
    the response.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    2b0af3f View commit details
    Browse the repository at this point in the history
  6. Makefile: remove unused deps

    These are no longer needed since we're building the two servers
    separately.
    rillian committed Mar 23, 2023
    Configuration menu
    Copy the full SHA
    0ca2733 View commit details
    Browse the repository at this point in the history

Commits on Mar 29, 2023

  1. Use is_empty() instead of len() > 0

    Change the welcome endpoint test to match the others.
    Addresses a clippy lint.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    db8c47a View commit details
    Browse the repository at this point in the history
  2. Test submitting multiple points

    Abstract some of the test code for the /randomness endpoint into
    helper functions and call it from additional tests to verify
    multiple point submissions in the same request are processed.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    033c20a View commit details
    Browse the repository at this point in the history
  3. Test specifying an epoch

    The /randomness endpoint allows specifying a specific epoch tag
    to support the same route offering multiple valid epochs at the
    same time. For example this could be two series with different
    cadences or an overlap to prevent failed queries close to the
    rotation time.
    
    Verify that the current epoch can be accepted, but that earlier
    and later epochs are rejected.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    5f0c872 View commit details
    Browse the repository at this point in the history
  4. Bump container base image versions

    Use the latest stable rust toolchain and alpine runtime release
    for the linux container image build.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    9265c40 View commit details
    Browse the repository at this point in the history
  5. Bump rust dependencies

    Run `cargo update` to bump Cargo.lock to the latest compatible
    releases.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    33b5d54 View commit details
    Browse the repository at this point in the history
  6. Use port 443 for the exported https interface

    Have the nitriding proxy listen on standard port 443. The daemons
    run as root inside the container so there's no reason to use a
    non-privileged port.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    b75c690 View commit details
    Browse the repository at this point in the history
  7. Bump nitriding to v2.0.1

    Pick up recent fixes and depend on an actual tag rather than
    a random commit.
    rillian committed Mar 29, 2023
    Configuration menu
    Copy the full SHA
    b6f41f9 View commit details
    Browse the repository at this point in the history

Commits on Mar 31, 2023

  1. Hoist timestamp calculation

    Un-indent the part of the next_epoch_time calculation which doesn't
    require the lock guard for better readability. Still prefer an
    scope block around the lock section to an explicit drop since
    it's harder for it to become disconnected from the following code.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    bc8ac6d View commit details
    Browse the repository at this point in the history
  2. Let tracing log the config object directly

    This might make pulling the object out of the structured log
    easier? Addresses a review comment.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    19c5953 View commit details
    Browse the repository at this point in the history
  3. Mark trace events from epoch_update_loop

    Clarify where these messages are from by declaring a span for them.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    633dc29 View commit details
    Browse the repository at this point in the history
  4. Add --listen command line switch

    Allow setting the server's listening ip address and port from
    the command line, rather than hard-coding it. The default is
    the same behaviour as before: ipv4 localhost port 8080.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    0fb7d89 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    0a58ab0 View commit details
    Browse the repository at this point in the history
  6. Move the tests module to a separate source file

    Break things up so the individual files are shorter and save
    an indent level.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    4ad8295 View commit details
    Browse the repository at this point in the history
  7. cargo fmt

    Saving an indent level lets us expand a wrapped line.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    dbc753f View commit details
    Browse the repository at this point in the history
  8. Move the epoch rotation function to a separate module.

    Split server into smaller files. Addresses review feedback.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    6cf590d View commit details
    Browse the repository at this point in the history
  9. Move request handlers into a separate module

    Split the implementation across multiple source files in response
    to review feedback.
    
    The `OPRF*` and `Error` types are directly-related to the implementation
    of these particular handlers, so I kept those together. They need to
    be public so the main application can call them, but otherwise are
    just interfacing with the axum::route machinery.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    93288d2 View commit details
    Browse the repository at this point in the history
  10. Allow clippy::assertions_on_constants in tests::epoch

    The epoch test has assertion that the epoch test values it uses
    are distinct from the accepted value. These compile to nothing
    because they are const expressions. However, it's nice to have
    the assertion in case the base constant changes in an incompatible
    way.
    
    `cargo clippy --all-targets` warns about this test, so silence
    the lint for a clean report while keeping the assertion.
    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    ff0a318 View commit details
    Browse the repository at this point in the history
  11. cargo fmt

    rillian committed Mar 31, 2023
    Configuration menu
    Copy the full SHA
    c47465c View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2023

  1. Use the Amazon Web Services container registry

    This fetches the Docker image from Amazon's container registry instead of Docker's, which prevents the frequent rate limits in our reproducible build pipeline. At the time of commit, at least, the `docker/library` path is a mirror of the docker.io registry with identical images hashes for these
    three tags.
    
    Co-authored-by: Philipp Winter <[email protected]>
    rillian and Philipp Winter authored Apr 4, 2023
    Configuration menu
    Copy the full SHA
    d9b26ee View commit details
    Browse the repository at this point in the history
  2. Invoke start.sh from the full path.

    /usr/local/bin isn't in path in the alpine runtime container,
    so it needs to be run from the absolute path.
    rillian committed Apr 4, 2023
    Configuration menu
    Copy the full SHA
    def73b1 View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2023

  1. Update Makefile

    Adjust Makefile to build a versioned eif file in docker, which
    shortcuts for deployment. Some of this is style changes, but
    other parts are functional; the previous `ko` build didn't
    work for the non-go parts of the container.
    
    This reduces the memory cap to 512 MB to match the default
    allocation limit. This simplifies testing, especially since
    bumping the limit has been failing occasionaly in my testing.
    It's certainly enough memory for verifying deployment, but
    benchmarking is needed to see if it's sufficient to handle
    a full network load.
    rillian committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    896e4a2 View commit details
    Browse the repository at this point in the history
  2. Update nitriding for the buildcvs=false fix

    This fixes an issue building the container image under kaniko.
    rillian committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    0f800e7 View commit details
    Browse the repository at this point in the history
  3. Add a makefile step to update the nitriding submodule

    This is a little hacky since we don't generate complete dependency
    information, but use nitriding/cmd/Makefile, invoked by the
    Dockerfile build, as a stamp for having the submodule available.
    
    Assumes we're running out of a git repository.
    rillian committed Apr 5, 2023
    Configuration menu
    Copy the full SHA
    67369ed View commit details
    Browse the repository at this point in the history

Commits on Apr 6, 2023

  1. Place OPRFState and friends together with the update update loop.

    Keep the state structs and their maintenance code together to
    avoid cross-importing between `handler` and the old `update`
    module. Export just the wrapped version through the top-level
    to shorten references there and in the handlers.
    rillian committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    c517bb8 View commit details
    Browse the repository at this point in the history
  2. Pass prove as a false value to ppoprf::server::eval

    Save a line by not declaring this and pass a `false` literal
    directly. Requested in review.
    rillian committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    76bca6f View commit details
    Browse the repository at this point in the history
  3. github actions: initialize submodules before building

    Automatic image building was failing because the nitriding submodule
    wasn't initialized before invoking kaniko. This option should make
    the checkout action also checkout any submodules.
    rillian committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    f2dd246 View commit details
    Browse the repository at this point in the history
  4. Test deployment from the rust branch.

    Check the build script is working before merging into main.
    rillian committed Apr 6, 2023
    Configuration menu
    Copy the full SHA
    347c8a7 View commit details
    Browse the repository at this point in the history

Commits on Apr 11, 2023

  1. Make star-randsrv build reproducibly.

    This commit makes two changes:
    
    1. Invoke kaniko with the flag '--custom-platform linux/amd64'.  This is
       necessary when building star-randsrv on non-Linux, non-amd64
       platforms like macOS.
    
    2. Use an intermediate build layer to add start.sh.  If we don't do
       this, we may end up with a build layer that contains inconsistent
       file permissions from the host operating system.
    
    With the above two changes, it's now possible to arrive at identical
    image IDs, even when building star-randsrv on Linux (amd64) and macOS
    (arm64).
    Philipp Winter committed Apr 11, 2023
    Configuration menu
    Copy the full SHA
    9cbcaef View commit details
    Browse the repository at this point in the history

Commits on Apr 14, 2023

  1. Merge pull request #55 from brave/reproducible-build

    Make star-randsrv build reproducibly.
    Philipp Winter authored Apr 14, 2023
    Configuration menu
    Copy the full SHA
    368be97 View commit details
    Browse the repository at this point in the history

Commits on Apr 17, 2023

  1. Return 500 Internal Server Error on LockFailure

    If this happens it indicates an internal problem with the state
    management, and the server likely needs to be restarted. Signal
    this so the more serious error case is obvious.
    
    Other error variants should be the result of bad client input
    and don't affect the usability of the service.
    rillian committed Apr 17, 2023
    Configuration menu
    Copy the full SHA
    8c5363c View commit details
    Browse the repository at this point in the history

Commits on Apr 18, 2023

  1. Check for overflow incrementing the epoch.

    The ppoprf epoch tag is a `u8`. When using the full epoch range
    0..=255, the final increment would overflow. In debug builds this
    would panic. In release builds, it would roll over unchecked, then
    panic at the end of the next interval when it tried to puncture
    the already-punctured starting epoch value. In either case, the
    panic happened while the write lock was held, poisoning it.
    
    The tokio thread runner would catch the panic, but with the
    `RwLock` poisoned, it couldn't respond to further queries.
    
    Instead, check for overflow and use that to trigger key rotation,
    just as we do when the epoch is out of the configure range. This
    is more localized than promoting the epoch counter and range to
    u16 and narrowing at the ppoprf calls.
    rillian committed Apr 18, 2023
    Configuration menu
    Copy the full SHA
    64367e1 View commit details
    Browse the repository at this point in the history
  2. cargo fmt

    rillian committed Apr 18, 2023
    Configuration menu
    Copy the full SHA
    2adf203 View commit details
    Browse the repository at this point in the history
  3. Remove unnecessary borrow.

    Addresses a clippy lint.
    rillian committed Apr 18, 2023
    Configuration menu
    Copy the full SHA
    0f2fb25 View commit details
    Browse the repository at this point in the history

Commits on Apr 19, 2023

  1. github actions: remove golang config

    The default makefile target just builds, tests, lints and
    audits the rust application, so we no longer need a go
    environment for this job.
    rillian committed Apr 19, 2023
    Configuration menu
    Copy the full SHA
    e75c152 View commit details
    Browse the repository at this point in the history

Commits on Apr 20, 2023

  1. Merge pull request #46 from brave/renovate/configure

    Configure Renovate
    rillian authored Apr 20, 2023
    Configuration menu
    Copy the full SHA
    80ed097 View commit details
    Browse the repository at this point in the history
  2. Don't deploy from the rust branch

    This was for testing with the deployable container build pipeline
    during development. Remove before merging into the default branch
    since it will no longer be needed there.
    rillian committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    334bb06 View commit details
    Browse the repository at this point in the history
  3. Don't checkout submodules for deployment builds.

    I'm told this is no longer necessary as the pipeline is using
    a different solution.
    rillian committed Apr 20, 2023
    Configuration menu
    Copy the full SHA
    ae95895 View commit details
    Browse the repository at this point in the history