Skip to content

add shadow-compatible quinn-udp fallback#109

Open
bomanaps wants to merge 2 commits into
grandinetech:devnet-5from
bomanaps:devnet5-shadow
Open

add shadow-compatible quinn-udp fallback#109
bomanaps wants to merge 2 commits into
grandinetech:devnet-5from
bomanaps:devnet5-shadow

Conversation

@bomanaps

Copy link
Copy Markdown
Contributor

Shadow

Comment thread lean_client/Cargo.toml Outdated
codegen-units = 1

[patch.crates-io]
quinn-udp = { path = "rust/patch/quinn-udp" }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm completely lost - this is for testing, right? Why is it patched for everything - including prod builds?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This pr should be in it own branch with a separate image tag its just for shadow related work not to be merged in main or devnet 5 branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I dropped a dm on Tg on this

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ah right, now I understand. However, I think maintaining two different versions can be too much burden. I think it should be possible to configure this via separate profile (https://doc.rust-lang.org/cargo/reference/profiles.html). Then, we can merge this, and build two images for all devnet-* branches

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Profiles can't toggle [patch.crates-io] they only control codegen flags, but we can drop the patch block from Cargo.toml and have CI apply it only for the shadow image via cargo build --release --config 'patch.crates-io.quinn-udp.path="rust/patch/quinn-udp"' so we have one branch, two images, no source divergence if this will be better?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

ye it is better, but still not good enough. First of all, better to keep this stuff in Makefile, so it can be executed locally. Second, you probably can do some trick like:

# Root Cargo.toml
[profile.shadow]
rustflags = ["--cfg", "shadow_mode"]

# P2P crate's Cargo.toml
[target.'cfg(shadow_mode)'.dependencies]
quinn-udp = { path = '..some path..' }

[target.'cfg(not(shadow_mode))'.dependencies]
quinn-udp = '..some version..'

This will probably be more maintainable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the pointer, but that cfg-target swap only works when a crate directly depends on quinn-udp here we pull it in transitively through libp2p-quic, so there's nothing in our Cargo.toml files to swap, to redirect a transitive dependency, Cargo will only gives us [patch.crates-io], so I will keep the patch block out of source and apply it via --config from a make shadow-* target this way the same command works locally and in CI, while production stays untouched.

@bomanaps bomanaps requested a review from ArtiomTr July 1, 2026 09:25
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