Skip to content

Commit

Permalink
move mc-crypto-rand to be a dev-dependency of mc-transaction-core (#717)
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
cbeck88 committed Feb 10, 2021
1 parent c6dcb5c commit 7f2128f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
1 change: 0 additions & 1 deletion consensus/enclave/trusted/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion transaction/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ mc-crypto-box = { path = "../../crypto/box" }
mc-crypto-digestible = { path = "../../crypto/digestible", features = ["dalek", "derive"] }
mc-crypto-hashes = { path = "../../crypto/hashes" }
mc-crypto-keys = { path = "../../crypto/keys", default-features = false }
mc-crypto-rand = { path = "../../crypto/rand" }
mc-util-from-random = { path = "../../util/from-random" }
mc-util-repr-bytes = { path = "../../util/repr-bytes" }
mc-util-serial = { path = "../../util/serial" }
Expand All @@ -50,6 +49,7 @@ tempdir = "0.3"
time = "0.1"

mc-crypto-digestible-test-utils = { path = "../../crypto/digestible/test-utils" }
mc-crypto-rand = { path = "../../crypto/rand" }
mc-ledger-db = { path = "../../ledger/db" }
mc-transaction-core-test-utils = { path = "../../transaction/core/test-utils" }
mc-util-serial = { path = "../../util/serial", features = ["std"] }
Expand Down

0 comments on commit 7f2128f

Please sign in to comment.