ergoplatform / oracle-core

Core off-chain component of Oracle Pools
Apache License 2.0
62 stars 37 forks source link

[300 SigmaUSD] Fix artifact build on Windows #90

Closed greenhat closed 2 years ago

greenhat commented 2 years ago

Build failed due to the errors building openssl-sys crate - https://github.com/ergoplatform/oracle-core/runs/7742607564?check_suite_focus=true

kettlebell commented 2 years ago

After much fiddling, I've got it working; see https://github.com/kettlebell/rust_hello_world/releases/tag/v6.2.

Couldn't get openssl to build on windows in GA, but we can install it externally using the vcpkg manager (see https://github.com/kettlebell/rust_hello_world/blob/eb5584024e1a864f2ff3476bf16c94c6e4a10df7/.github/workflows/release.yml#L41-L43). Now I tracked dependencies and openssl is relied on in ergo-node-interface-rust, but never gets used from what I can see. We can simplify things by removing it entirely.

Another issue I ran into in Windows is that we need to make big changes to the REST API in core/src/api.rs. It's using the sincere framework which hasn't been updated for many years. But the real problem is that sincere doesn't work under windows. One of its dependencies uses a libc call that is not available under windows. I suggest to comment it out for now and replace it with something more modern like axum, but this will makes things async.

What do you reckon?

greenhat commented 2 years ago

I appreciate you digging into this issue! I think we can safely ditch SSL support in ergo-node-interface-rust for now. In the future, we could use a Rust implementation or hide it behind a feature. I like the idea of switching to axum and I made #99 for it.

greenhat commented 2 years ago

I put a bounty on this issue. I'm closing #99 in favor of this issue.

kettlebell commented 2 years ago

Great, thank you. Yeah with SSL I believe many crates can plug in rustls, which effectively replaces openssl . Also, operators may choose to put the oracle behind a proxy like nginx.

greenhat commented 2 years ago

The bounty is sent. Thank you!