Skip to content

Commit eee0dd4

Browse files
fix: verifier request schema (#4326)
## What ❔ Two changes to the verification request schema: 1. Change the type of the optimizer runs from `u16` to `usize`. This allows values larger than 65535 to be passed and matches foundry's type for the field. 2. Add a default value for `optimization_used`. Currently, it's tedious that even for the JSON standard verification request, this field is required but ignored. Additionally, there is a DB migration to requeue some Etherscan verifications, as Etherscan has fixed the issues on their end. ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- The `Why` has to be clear to non-Matter Labs entities running their own ZK Chain --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> 1. Currently, there is no way to submit a request using the single file format with optimizer runs greater than 65535. 2. To provide a better UX when working with the verification endpoint. 3. To verify contracts on Etherscan that previously failed due to bugs in their API. ## Is this a breaking change? - [ ] Yes - [X] No ## Operational changes <!-- Any config changes? Any new flags? Any changes to any scripts? --> <!-- Please add anything that non-Matter Labs entities running their own ZK Chain may need to know --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [X] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [X] Tests for the changes have been added / updated. - [ ] Documentation comments have been added / updated. - [X] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
1 parent 048753f commit eee0dd4

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

core/lib/contract_verifier/src/tests/real.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,10 @@ async fn using_standalone_solc(specify_contract_file: bool) {
226226

227227
#[test_casing(3, [(Some(100), None), (None, Some("shanghai")), (Some(200), Some("paris"))])]
228228
#[tokio::test]
229-
async fn using_standalone_solc_with_custom_settings(runs: Option<u16>, evm_version: Option<&str>) {
229+
async fn using_standalone_solc_with_custom_settings(
230+
runs: Option<usize>,
231+
evm_version: Option<&str>,
232+
) {
230233
let (compiler_resolver, supported_compilers) = real_resolver!();
231234

232235
let version = &supported_compilers.solc;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
-- Add down migration script here
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
-- Requeue failed Etherscan verification requests after Etherscan has fixed the underlying issue.
2+
-- We have just a few failed requests, so the performance of the query is not a concern.
3+
UPDATE etherscan_verification_requests
4+
SET
5+
status = 'queued',
6+
etherscan_verification_id = NULL,
7+
processing_started_at = NULL,
8+
error = NULL,
9+
attempts = 0
10+
WHERE error LIKE '%Source code exceeds max accepted (500k chars) length%'
11+
OR error LIKE '%Invalid or not supported solc version%'
12+
OR error LIKE '%Invalid zksolc version%';

core/lib/types/src/contract_verification/api.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub struct VerificationIncomingRequest {
136136
pub contract_name: String,
137137
#[serde(flatten)]
138138
pub compiler_versions: CompilerVersions,
139+
#[serde(default)]
139140
pub optimization_used: bool,
140141
/// Optimization mode used for the contract. Semantics depends on the compiler used; e.g., for `vyper`,
141142
/// allowed values are `gas` (default), `codesize` or `none`.
@@ -201,7 +202,7 @@ pub struct VerificationEvmSettings {
201202
#[serde(default, skip_serializing_if = "Option::is_none")]
202203
pub evm_version: Option<String>,
203204
#[serde(default, skip_serializing_if = "Option::is_none")]
204-
pub optimizer_runs: Option<u16>,
205+
pub optimizer_runs: Option<usize>,
205206
}
206207

207208
#[derive(Debug, Eq, PartialEq, Clone, Copy)]

0 commit comments

Comments
 (0)