Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

Handle Out-of-Order Messages #33

Open
tyurek opened this issue May 30, 2022 · 0 comments
Open

Handle Out-of-Order Messages #33

tyurek opened this issue May 30, 2022 · 0 comments

Comments

@tyurek
Copy link
Contributor

tyurek commented May 30, 2022

The current test program for protocol.rs simulates the random message ordering of distributed protocols by arbitrarily choosing a player to act at each step. However, this is not sufficient to model arbitrary message ordering as if message A causes message B, B will appear later in the message queue.

To fix the test, change

let message: Message = deserialize!(&self.inbox.remove(0))?;

to

let index = rng.gen_range(0..self.inbox.len());
let message: Message = deserialize!(&self.inbox.remove(index))?;

in process_single_message()

This change reveals some bugs in the protocol implementation (both on the main branch and in PR #32). Namely, an out-of-order message will cause a player to attempt to retrieve data from storage that has not yet been put into storage, causing a runtime BailError("Could not find StorableIndex {[omitted]} when getting from storage"). Most of the time, the program will crash attempting to retrieve a missing RoundOnePrivate, but occasionally the execution gets far enough to crash on a missing RoundOnePublic. Fixing these may likely reveal additional issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant