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

move mc-crypto-rand to be a dev-dependency of mc-transaction-core #717

Conversation

cbeck88
Copy link
Contributor

@cbeck88 cbeck88 commented Feb 10, 2021

mc-transaction-core should be as portable as possible, but it had
a dependency on mc-crypto-rand which is not as portable.

Getting an RNG is very hard to do portably -- the approach we use
in mc-crypto-rand is like, use the standard library approach and
the getrandom crate, which still requires an OS, or if you have
RDRAND instruction, use that, and selecting between these
alternatives is what mc-crypto-rand does basically. But this will
not work on embedded devices that don't have an OS or intel chips.
It just happens to work for all our current enclave phone and server
targets. But it may pose a portability problem if someone wanted
to build mc-transaction-core for a more restricted device.

Fortunately the only thing that was creating an RNG directly in
mc-transaction-core, was the code in the FogHint which we removed
in #712
So at this point mc-transaction-core only needs mc-crypto-rand
for tests. Moving it to dev-dependency helps make the transaction core
more portable.

`mc-transaction-core` should be as portable as possible, but it had
a dependency on `mc-crypto-rand` which is not as portable.

Getting an RNG is very hard to do portably -- the approach we use
in `mc-crypto-rand` is like, use the standard library approach and
the getrandom crate, which still requires an OS, or if you have
RDRAND instruction, use that, and selecting between these
alternatives is what `mc-crypto-rand` does basically. But this will
not work on embedded devices that don't have an OS or intel chips.
It just happens to work for all our current enclave phone and server
targets. But it may pose a portability problem if someone wanted
to build `mc-transaction-core` for a more restricted device.

Fortunately the only thing that was creating an RNG directly in
`mc-transaction-core`, was the code in the `FogHint` which we removed
in mobilecoinfoundation#712
So at this point `mc-transaction-core` only needs `mc-crypto-rand`
for tests. Moving it to dev-dependency helps make the transaction core
more portable.
@cbeck88 cbeck88 requested a review from a team February 10, 2021 19:57
Copy link
Contributor

@jcape jcape left a comment

Choose a reason for hiding this comment

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

w00t!

@cbeck88 cbeck88 merged commit 7f2128f into mobilecoinfoundation:master Feb 10, 2021
@cbeck88 cbeck88 deleted the move-mc-crypto-rand-to-dev-dependency branch February 10, 2021 21:34
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.

None yet

3 participants