Skip to content

Commit

Permalink
fix(contract-verifier): Check for 0x in zkvyper output (#2693)
Browse files Browse the repository at this point in the history
## What ❔

Check for 0x in zkvyper output

## Why ❔

Don't panic when bytecode is 0x prefixed

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] 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`.
  • Loading branch information
perekopskiy authored Aug 20, 2024
1 parent 97aa6fb commit 0d77588
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/lib/contract_verifier/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 0d77588

Please sign in to comment.