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

Make Trin compilable/(not crash) on Windows + Add check CI #923

Merged
merged 3 commits into from
Sep 26, 2023

Conversation

KolbyML
Copy link
Member

@KolbyML KolbyML commented Sep 17, 2023

What was wrong?

Certain parts of Trin either won't compile on Windows or crash because rust doesn't support windows Unix IPC

How was it fixed?

By adding #![cfg(unix)] in files that should only be compile on windows and by adding an error if someone tries to use IPC on Windows.

Reth added #[cfg(unix)] a few months back so the reth-ipc library will compile it will just crash when we try to use ipc functions.

I also added a CI using check instead of build
https://doc.rust-lang.org/cargo/commands/cargo-check.html

TL:DR it has all the CI benefits of building but without the codegen part. So it is a lot quicker for the result we want.

@KolbyML KolbyML requested review from carver and ogenev September 17, 2023 23:49
@KolbyML KolbyML self-assigned this Sep 17, 2023
@KolbyML KolbyML force-pushed the make-trin-windows-compilable-2 branch from 96e72a7 to 46b9070 Compare September 18, 2023 00:21
@KolbyML KolbyML changed the title Make Trin compilable/(not crash) on Windows Make Trin compilable/(not crash) on Windows + Add check CI Sep 18, 2023
@KolbyML KolbyML force-pushed the make-trin-windows-compilable-2 branch from 3759cc0 to 1810a38 Compare September 18, 2023 02:14
@KolbyML KolbyML marked this pull request as ready for review September 18, 2023 02:17
Copy link
Collaborator

@carver carver left a comment

Choose a reason for hiding this comment

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

What do you think about moving the check to panic on Windows to the beginning of run_trin?

Comment on lines +1143 to +1144
drop(storage);
drop(new_storage);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why were the explicit drops necessary?

Copy link
Member Author

@KolbyML KolbyML Sep 19, 2023

Choose a reason for hiding this comment

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

They are in the tests below and above. This change isn't related to the PR. Without these drops the test will panic on certain operating systems. If you read the doc for .close() on the line below there is a comment in the doc's example about this.

src/main.rs Outdated Show resolved Hide resolved
@carver
Copy link
Collaborator

carver commented Sep 18, 2023

I also added a CI using check instead of build
https://doc.rust-lang.org/cargo/commands/cargo-check.html

Yeah, this makes a lot of sense. I'm even wondering if we should switch the build job to use check too. What do you think? 👍🏻 if you want to add it

@KolbyML KolbyML force-pushed the make-trin-windows-compilable-2 branch from 1810a38 to ecdaacb Compare September 19, 2023 00:12
@KolbyML
Copy link
Member Author

KolbyML commented Sep 19, 2023

What do you think about moving the check to panic on Windows to the beginning of run_trin?

resolved

Yeah, this makes a lot of sense. I'm even wondering if we should switch the build job to use check too. What do you think? 👍🏻 if you want to add it

I am fine with that, would that belong in a different PR then?

@KolbyML KolbyML force-pushed the make-trin-windows-compilable-2 branch from ecdaacb to 2256426 Compare September 19, 2023 00:34
@ogenev
Copy link
Member

ogenev commented Sep 20, 2023

If I understand this correctly, the claim here is that windows does not support IPC? If this is the case, I'm curious what is this support for: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ ? Also saw this after googling: https://batsov.com/articles/2022/01/20/unix-sockets-are-now-supported-on-windows/

@KolbyML
Copy link
Member Author

KolbyML commented Sep 20, 2023

If I understand this correctly, the claim here is that windows does not support IPC? If this is the case, I'm curious what is this support for: https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/ ? Also saw this after googling: https://batsov.com/articles/2022/01/20/unix-sockets-are-now-supported-on-windows/

I never claimed Windows didn't support IPC I clearified Rust in my PR intro Certain parts of Trin either won't compile on Windows or crash because rust doesn't support windows Unix IPC --> rust doesn't support windows Unix IPC

I am working on a PR to change this tokio-rs/mio#1667

You asked the exact same question in my last support Windows PR 4 months ago so instead of answering it here I will link to the time I already answered this #739 (comment)

@KolbyML KolbyML requested a review from carver September 20, 2023 17:04
Copy link
Member

@ogenev ogenev left a comment

Choose a reason for hiding this comment

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

I never claimed Windows didn't support IPC I clearified Rust in my PR intro Certain parts of Trin either won't compile on Windows or crash because rust doesn't support windows Unix IPC --> rust doesn't support windows Unix IPC

I remember now the discussion about Tokio and windows uds. By claim, I was referring to the message in this panic: https://github.com/ethereum/trin/pull/923/files#diff-b1a35a68f14e696205874893c07fd24fdb88882b47c23cc0e0c80a30c7d53759R34.

It was weird because it seems Rust supports windows Unix IPC, it is Tokio that has some issues with it. So I guess fixing the PR description and the panic will make it less confusing?

@KolbyML
Copy link
Member Author

KolbyML commented Sep 21, 2023

That is the library we used to use 2 years ago.

@KolbyML
Copy link
Member Author

KolbyML commented Sep 21, 2023

Oh that panic error. Oh ok my bad I will fix that. I should really read panic errors I steal from my old PRs. Thank you for bringing it to light.

@KolbyML
Copy link
Member Author

KolbyML commented Sep 22, 2023

Ok I resolved the panic error issue

Copy link
Collaborator

@carver carver left a comment

Choose a reason for hiding this comment

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

LGTM 🚢

👍🏻 Yeah, switching from build to check can go in another PR.

@KolbyML KolbyML merged commit c5047d0 into ethereum:master Sep 26, 2023
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.

3 participants