add shadow-compatible quinn-udp fallback#109
Conversation
| codegen-units = 1 | ||
|
|
||
| [patch.crates-io] | ||
| quinn-udp = { path = "rust/patch/quinn-udp" } |
There was a problem hiding this comment.
I'm completely lost - this is for testing, right? Why is it patched for everything - including prod builds?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
I dropped a dm on Tg on this
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Shadow