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

feat(test):sign result #53

Merged
merged 17 commits into from
Apr 28, 2021
Merged

feat(test):sign result #53

merged 17 commits into from
Apr 28, 2021

Conversation

ggutoski
Copy link
Contributor

@ggutoski ggutoski commented Apr 23, 2021

This PR is a repeat of #44 . That PR was reverted due to #50 . Build is broken in this branch after merging #52 . I rebased onto master.

Copy link
Contributor

@sdaveas sdaveas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed the breaking code and added meaningful checks of sign result.

@sdaveas sdaveas self-requested a review April 26, 2021 14:14
@sdaveas
Copy link
Contributor

sdaveas commented Apr 26, 2021

closes #42

src/tests/mod.rs Outdated Show resolved Hide resolved
src/tests/mod.rs Outdated Show resolved Hide resolved
src/tests/mod.rs Outdated
// get criminal list
let mut criminals = criminal_list.criminals;
// remove duplicates
criminals.dedup();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you ever observe duplicates? We should probably fail the test here if this list contains duplicates.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there is a single entry for each share of the malicious party.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, more investigation is needed here. Each party runs multiple shares, but this code breaks on the first occurrence of SignResult, so we should only ever see one copy of the result. (Hence we should not have duplicates in the criminals list.) Perhaps we should switch to a wait group here similar to what's in production code. In any case, we don't have an explanation for why you are observing duplicates in the criminals list.

Copy link
Contributor

@sdaveas sdaveas Apr 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The result contains the uid of the criminal one time for each of his shares. I think it's logical because all shares that belong to the malicious party are registered as individual criminals, and multiple shares map to the same uid.

Example: if a malicious party A has shares with tofn indices 0,1,2, the criminal_list will contain [0:Malicious, 1:Malicious, 2:Malicious] (which correspond to [tofn_index, CrimeType] for each pair).

In tofnd, we examine the uid of the criminal, rather than his tofn share indices. This means that the criminal vector will become [A:Malicious, A:Malicious, A:Malicious] (which correspond to [tofnd_index, CrimeType] for each pair).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The conversion from tofnd to tofn index happens here:

let (criminal_index, _) = map_tofn_to_tofnd_idx(c.index, all_share_counts)
.expect("failure to recover tofnd party index from tofn share index");
ProtoCriminal {
party_uid: participant_uids[criminal_index].clone(),
crime_type: ProtoCrimeType::from(c.crime_type) as i32, // why `as i32`? https://github.com/danburkert/prost#enumerations
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! As discussed, we need to decide how to report the criminals list to axelar-core:

  • Criminals[A:0, A:1, B:0, B:1], or
  • Criminals[A, B]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related: we also need to decide how tofnd should implement malicious behaviour over multiple subshares:

  • all subshares do the same malicious behaviour
  • only one subshare is malicious (eg. the 0th subshare), all other's are honest
  • something else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option 1 is the simplest case for the current codebase in tofnd. Let's start with that and see if we need to fallback to option 2?

src/tests/mod.rs Outdated Show resolved Hide resolved
src/tests/tofnd_party.rs Show resolved Hide resolved
@ggutoski
Copy link
Contributor Author

Reminder: Please do not merge until we've run a local cluster test with axelar-core.

@ggutoski ggutoski marked this pull request as draft April 26, 2021 21:10
sdaveas added a commit that referenced this pull request Apr 28, 2021
@sdaveas sdaveas removed their assignment Apr 28, 2021
@ggutoski ggutoski marked this pull request as ready for review April 28, 2021 14:32
@sdaveas sdaveas merged commit 7b0c2d4 into master Apr 28, 2021
@sdaveas sdaveas deleted the feat/check-sign-result-in-tests branch April 28, 2021 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants