Summary
miden_node_proto::clients::Builder builds the Accept header value in Interceptor::new. When both with_metadata_version(..) and with_metadata_genesis(..) are set, the (Some(version), Some(genesis)) arm emits
application/vnd.miden; version=X, genesis=0x...
The comma starts a second media range, so the server-side negotiation in crates/rpc/src/server/accept.rs sees two candidates: application/vnd.miden; version=X (no genesis, so it is skipped for methods with GenesisNegotiation::Mandatory) and genesis=0x..., which is not a media type and fails to parse. SubmitProvenTransaction / SubmitProvenTransactionBatch are rejected with
INVALID_ARGUMENT: accept header's media type could not be parsed
caused by: Invalid type name
The unit test in crates/proto/src/clients/mod.rs pins the wrong string, so CI does not catch it. Parameters of one media range must be separated with ; (the rust-sdk builds its own header that way, which is why it does not hit this).
Where
crates/proto/src/clients/mod.rs, impl Interceptor, fn new (the format! with "{}; {}={version}, {}={genesis}").
Reproduction
- Unit test in
crates/rpc/src/server/accept.rs: feed the value the builder produces for version = "0.2.3", genesis = 0x...deadbeef to negotiate(...) with mandatory genesis:
accept value "application/vnd.miden; version=0.2.3, genesis=0x0000…deadbeef" was rejected: accept header's media type could not be parsed
- End-to-end test in
crates/rpc/src/tests.rs: build a client with Builder::new(..).with_metadata_version(..).with_metadata_genesis(..) against the in-process RPC server and call submit_proven_transaction:
expected the request to reach the handler, got: code: 'Client specified an invalid argument', message: "accept header's media type could not be parsed\ncaused by: Invalid type name"
Impact
Any client built with the published Builder and both metadata options cannot submit anything; the error points at the header syntax rather than at the builder.
Proposed fix
Use ; as the separator in the (Some, Some) arm and fix the unit test that pins the current value. It is worth checking the builder output against the real negotiator in the rpc crate's tests (a small Interceptor::new_for_tests helper is enough) so the two sides cannot drift again.
I have the change and the two tests ready (miden-node-rpc + miden-node-proto: 173 tests pass, clippy clean) and can open a PR if this is assigned to me.
Summary
miden_node_proto::clients::Builderbuilds theAcceptheader value inInterceptor::new. When bothwith_metadata_version(..)andwith_metadata_genesis(..)are set, the(Some(version), Some(genesis))arm emitsThe comma starts a second media range, so the server-side negotiation in
crates/rpc/src/server/accept.rssees two candidates:application/vnd.miden; version=X(no genesis, so it is skipped for methods withGenesisNegotiation::Mandatory) andgenesis=0x..., which is not a media type and fails to parse.SubmitProvenTransaction/SubmitProvenTransactionBatchare rejected withThe unit test in
crates/proto/src/clients/mod.rspins the wrong string, so CI does not catch it. Parameters of one media range must be separated with;(the rust-sdk builds its own header that way, which is why it does not hit this).Where
crates/proto/src/clients/mod.rs,impl Interceptor,fn new(theformat!with"{}; {}={version}, {}={genesis}").Reproduction
crates/rpc/src/server/accept.rs: feed the value the builder produces forversion = "0.2.3",genesis = 0x...deadbeeftonegotiate(...)with mandatory genesis:crates/rpc/src/tests.rs: build a client withBuilder::new(..).with_metadata_version(..).with_metadata_genesis(..)against the in-process RPC server and callsubmit_proven_transaction:Impact
Any client built with the published
Builderand both metadata options cannot submit anything; the error points at the header syntax rather than at the builder.Proposed fix
Use
;as the separator in the(Some, Some)arm and fix the unit test that pins the current value. It is worth checking the builder output against the real negotiator in the rpc crate's tests (a smallInterceptor::new_for_testshelper is enough) so the two sides cannot drift again.I have the change and the two tests ready (
miden-node-rpc+miden-node-proto: 173 tests pass, clippy clean) and can open a PR if this is assigned to me.