{"record":{"id":"2c117c9bb2054d57","repo":"nautechsystems/nautilus_trader","slug":"proxy-target-role-or-code-hash-conflicts-with-its","errorCode":null,"errorMessage":"Proxy target role or code hash conflicts with its deployment identity","messagePattern":"Proxy target role or code hash conflicts with its deployment identity","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/rpc/verification.rs","lineNumber":1330,"sourceCode":"            Bytes::from_str(&probe.expected_output)\n                .map_err(|_| anyhow::anyhow!(\"Manifest probe output is invalid\"))?;\n        }\n    }\n\n    for contract in &manifest.contracts {\n        let Some(proxy) = &contract.proxy else {\n            continue;\n        };\n        let target =\n            Address::from_str(&proxy.target_address).expect(\"validated proxy target address\");\n        let target_contract = manifest\n            .contracts\n            .iter()\n            .find(|candidate| Address::from_str(&candidate.address).ok() == Some(target))\n            .ok_or_else(|| {\n                anyhow::anyhow!(\"Proxy target has no unique deployment manifest identity\")\n            })?;\n        anyhow::ensure!(\n            target_contract.role == BlockchainContractRole::Implementation\n                && target_contract\n                    .runtime_code_hash\n                    .eq_ignore_ascii_case(&proxy.target_code_hash),\n            \"Proxy target role or code hash conflicts with its deployment identity\"\n        );\n    }\n\n    for required in [\n        BlockchainContractRole::Router,\n        BlockchainContractRole::Factory,\n        BlockchainContractRole::WrappedNative,\n        BlockchainContractRole::Quote,\n        BlockchainContractRole::Token,\n        BlockchainContractRole::Pool,\n    ] {\n        anyhow::ensure!(\n            roles.contains(&required),","sourceCodeStart":1312,"sourceCodeEnd":1348,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/rpc/verification.rs#L1312-L1348","documentation":"For each proxy, the verifier requires its target contract entry to have role == Implementation and a runtime_code_hash byte-for-byte equal (case-insensitively) to the proxy's target_code_hash. This error means the pinned target exists but its declared role or code hash contradicts what the proxy claims, so the proxy would resolve to the wrong or an unverified implementation.","triggerScenarios":"Manifest verification where the contract entry at proxy.target_address has a role other than Implementation, or its runtime_code_hash differs from proxy.target_code_hash — e.g. stale code hash after the implementation was redeployed, or the target entry describes a different contract role (router, pool, etc.).","commonSituations":"Upgrading the implementation (new code hash) without updating either the target entry or the proxy's target_code_hash; mislabeling the implementation's role in a hand-edited manifest; copying the code hash of the proxy instead of the implementation; hex case handled inconsistently (this check is case-insensitive, so casing alone is not the cause).","solutions":["Set the target contract's role to Implementation and update its runtime_code_hash to the current implementation's runtime code hash","Update proxy.target_code_hash to match the target entry's runtime_code_hash","Regenerate the manifest from deployment tooling and recompute the manifest digest"],"exampleFix":"// before\n{\"address\": \"0ximpl...\", \"role\": \"router\", \"runtime_code_hash\": \"0xold...\"}\n// after\n{\"address\": \"0ximpl...\", \"role\": \"implementation\", \"runtime_code_hash\": \"0xnew...\"}","handlingStrategy":"validation","validationCode":"fn proxy_target_consistent(manifest: &Manifest) -> bool {\n    manifest.contracts.iter().filter_map(|c| c.proxy.as_ref()).all(|p| {\n        let target = Address::from_str(&p.target_address).expect(\"valid target\");\n        manifest.contracts.iter().find_map(|c| {\n            (Address::from_str(&c.address).ok() == Some(target)).then(||\n                c.role == Role::Implementation && c.runtime_code_hash.eq_ignore_ascii_case(&p.target_code_hash)\n            )\n        }) == Some(true)\n    })\n}","typeGuard":null,"tryCatchPattern":"match validate_manifest(&config) {\n    Err(e) if e.to_string().contains(\"role or code hash conflicts\") => {\n        eprintln!(\"sync target contract role/runtime_code_hash with proxy.target_code_hash: {e}\");\n    }\n    Err(e) => return Err(e),\n    Ok(v) => v,\n}","preventionTips":["Refresh runtime_code_hash (both the contract entry and proxy.target_code_hash) after every implementation redeploy","Label implementations with role Implementation only — never reuse another role's entry as a proxy target","Derive code hashes from the deployed bytecode at verify time instead of caching them"],"tags":["validation","manifest","proxy","consistency"],"backgroundTag":"schema-validation-failed","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}