From 0d7758884f84d7fa7b033b98d301c8b13d7d40ad Mon Sep 17 00:00:00 2001 From: perekopskiy <53865202+perekopskiy@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:06:40 +0300 Subject: [PATCH] fix(contract-verifier): Check for 0x in zkvyper output (#2693) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What ❔ Check for 0x in zkvyper output ## Why ❔ Don't panic when bytecode is 0x prefixed ## Checklist - [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [ ] Code has been formatted via `zk fmt` and `zk lint`. --- core/lib/contract_verifier/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/contract_verifier/src/lib.rs b/core/lib/contract_verifier/src/lib.rs index 30901729fc54..82751d4c9754 100644 --- a/core/lib/contract_verifier/src/lib.rs +++ b/core/lib/contract_verifier/src/lib.rs @@ -271,7 +271,9 @@ impl ContractVerifier { let bytecode_str = artifact["bytecode"] .as_str() .ok_or(ContractVerifierError::InternalError)?; - let bytecode = hex::decode(bytecode_str).unwrap(); + let bytecode_without_prefix = + bytecode_str.strip_prefix("0x").unwrap_or(bytecode_str); + let bytecode = hex::decode(bytecode_without_prefix).unwrap(); return Ok(CompilationArtifacts { abi: artifact["abi"].clone(), bytecode,