diff --git a/core/bin/contract-verifier/src/verifier.rs b/core/bin/contract-verifier/src/verifier.rs index f75d69bbc342..ab9451240f78 100644 --- a/core/bin/contract-verifier/src/verifier.rs +++ b/core/bin/contract-verifier/src/verifier.rs @@ -310,6 +310,7 @@ impl ContractVerifier { let settings = Settings { output_selection: Some(default_output_selection), is_system: request.req.is_system, + force_evmla: request.req.force_evmla, other: serde_json::Value::Object( vec![("optimizer".to_string(), optimizer_value)] .into_iter() diff --git a/core/bin/contract-verifier/src/zksolc_utils.rs b/core/bin/contract-verifier/src/zksolc_utils.rs index db1fcf0a96d7..16dd47d08ea4 100644 --- a/core/bin/contract-verifier/src/zksolc_utils.rs +++ b/core/bin/contract-verifier/src/zksolc_utils.rs @@ -35,7 +35,7 @@ pub struct Source { } /// Compiler settings. -/// There are fields like `output_selection` and `is_system` which are accessed by contract verifier explicitly. +/// There are fields like `output_selection`, `is_system`, `force_evmla` which are accessed by contract verifier explicitly. /// Other fields are accumulated in `other`, this way every field that was in the original request will be passed to a compiler. #[derive(Debug, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] @@ -45,6 +45,9 @@ pub struct Settings { /// Flag for system compilation mode. #[serde(default)] pub is_system: bool, + /// Flag to force evmla IR. + #[serde(default)] + pub force_evmla: bool, /// Other fields. #[serde(flatten)] pub other: serde_json::Value, @@ -103,6 +106,9 @@ impl ZkSolc { if input.settings.is_system { command.arg("--system-mode"); } + if input.settings.force_evmla { + command.arg("--force-evmla"); + } } command .arg("--solc") diff --git a/core/lib/dal/.sqlx/query-1d6b698b241cb6c5efd070a98165f6760cfeac185330d1d9c5cdb5b383ed8ed4.json b/core/lib/dal/.sqlx/query-40c17194a2089a7d3fa6b7923c9e03def94f4bf4674def1893e2232be80f57a0.json similarity index 68% rename from core/lib/dal/.sqlx/query-1d6b698b241cb6c5efd070a98165f6760cfeac185330d1d9c5cdb5b383ed8ed4.json rename to core/lib/dal/.sqlx/query-40c17194a2089a7d3fa6b7923c9e03def94f4bf4674def1893e2232be80f57a0.json index 7531f7ed4c00..c655704fd842 100644 --- a/core/lib/dal/.sqlx/query-1d6b698b241cb6c5efd070a98165f6760cfeac185330d1d9c5cdb5b383ed8ed4.json +++ b/core/lib/dal/.sqlx/query-40c17194a2089a7d3fa6b7923c9e03def94f4bf4674def1893e2232be80f57a0.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n INSERT INTO\n contract_verification_requests (\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n status,\n created_at,\n updated_at\n )\n VALUES\n ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'queued', NOW(), NOW())\n RETURNING\n id\n ", + "query": "\n INSERT INTO\n contract_verification_requests (\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n force_evmla,\n status,\n created_at,\n updated_at\n )\n VALUES\n ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, 'queued', NOW(), NOW())\n RETURNING\n id\n ", "describe": { "columns": [ { @@ -19,6 +19,7 @@ "Bool", "Text", "Bytea", + "Bool", "Bool" ] }, @@ -26,5 +27,5 @@ false ] }, - "hash": "1d6b698b241cb6c5efd070a98165f6760cfeac185330d1d9c5cdb5b383ed8ed4" + "hash": "40c17194a2089a7d3fa6b7923c9e03def94f4bf4674def1893e2232be80f57a0" } diff --git a/core/lib/dal/.sqlx/query-1c60010ded4e79886890a745a050fa6d65c05d8144bdfd143480834ead4bd8d5.json b/core/lib/dal/.sqlx/query-5d341e334cbc2d38efc8a060325677d57040037da0e07cef2c7b7246851a3703.json similarity index 90% rename from core/lib/dal/.sqlx/query-1c60010ded4e79886890a745a050fa6d65c05d8144bdfd143480834ead4bd8d5.json rename to core/lib/dal/.sqlx/query-5d341e334cbc2d38efc8a060325677d57040037da0e07cef2c7b7246851a3703.json index a9d5b42d2148..f0d8b01d57c0 100644 --- a/core/lib/dal/.sqlx/query-1c60010ded4e79886890a745a050fa6d65c05d8144bdfd143480834ead4bd8d5.json +++ b/core/lib/dal/.sqlx/query-5d341e334cbc2d38efc8a060325677d57040037da0e07cef2c7b7246851a3703.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n UPDATE contract_verification_requests\n SET\n status = 'in_progress',\n attempts = attempts + 1,\n updated_at = NOW(),\n processing_started_at = NOW()\n WHERE\n id = (\n SELECT\n id\n FROM\n contract_verification_requests\n WHERE\n status = 'queued'\n OR (\n status = 'in_progress'\n AND processing_started_at < NOW() - $1::INTERVAL\n )\n ORDER BY\n created_at\n LIMIT\n 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING\n id,\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system\n ", + "query": "\n UPDATE contract_verification_requests\n SET\n status = 'in_progress',\n attempts = attempts + 1,\n updated_at = NOW(),\n processing_started_at = NOW()\n WHERE\n id = (\n SELECT\n id\n FROM\n contract_verification_requests\n WHERE\n status = 'queued'\n OR (\n status = 'in_progress'\n AND processing_started_at < NOW() - $1::INTERVAL\n )\n ORDER BY\n created_at\n LIMIT\n 1\n FOR UPDATE\n SKIP LOCKED\n )\n RETURNING\n id,\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n force_evmla\n ", "describe": { "columns": [ { @@ -52,6 +52,11 @@ "ordinal": 9, "name": "is_system", "type_info": "Bool" + }, + { + "ordinal": 10, + "name": "force_evmla", + "type_info": "Bool" } ], "parameters": { @@ -69,8 +74,9 @@ false, true, false, + false, false ] }, - "hash": "1c60010ded4e79886890a745a050fa6d65c05d8144bdfd143480834ead4bd8d5" + "hash": "5d341e334cbc2d38efc8a060325677d57040037da0e07cef2c7b7246851a3703" } diff --git a/core/lib/dal/.sqlx/query-5f6885b5457aaa78e10917ae5b8cd0bc0e8923a6bae64f22f09242766835ee0c.json b/core/lib/dal/.sqlx/query-a115f795672787fe25bfaa8fd345094de508af93f4085be7cf3b54b1e8ecdadd.json similarity index 78% rename from core/lib/dal/.sqlx/query-5f6885b5457aaa78e10917ae5b8cd0bc0e8923a6bae64f22f09242766835ee0c.json rename to core/lib/dal/.sqlx/query-a115f795672787fe25bfaa8fd345094de508af93f4085be7cf3b54b1e8ecdadd.json index b57400c28f5e..ebe8ce232cfb 100644 --- a/core/lib/dal/.sqlx/query-5f6885b5457aaa78e10917ae5b8cd0bc0e8923a6bae64f22f09242766835ee0c.json +++ b/core/lib/dal/.sqlx/query-a115f795672787fe25bfaa8fd345094de508af93f4085be7cf3b54b1e8ecdadd.json @@ -1,6 +1,6 @@ { "db_name": "PostgreSQL", - "query": "\n SELECT\n id,\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system\n FROM\n contract_verification_requests\n WHERE\n status = 'successful'\n ORDER BY\n id\n ", + "query": "\n SELECT\n id,\n contract_address,\n source_code,\n contract_name,\n zk_compiler_version,\n compiler_version,\n optimization_used,\n optimizer_mode,\n constructor_arguments,\n is_system,\n force_evmla\n FROM\n contract_verification_requests\n WHERE\n status = 'successful'\n ORDER BY\n id\n ", "describe": { "columns": [ { @@ -52,6 +52,11 @@ "ordinal": 9, "name": "is_system", "type_info": "Bool" + }, + { + "ordinal": 10, + "name": "force_evmla", + "type_info": "Bool" } ], "parameters": { @@ -67,8 +72,9 @@ false, true, false, + false, false ] }, - "hash": "5f6885b5457aaa78e10917ae5b8cd0bc0e8923a6bae64f22f09242766835ee0c" + "hash": "a115f795672787fe25bfaa8fd345094de508af93f4085be7cf3b54b1e8ecdadd" } diff --git a/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.down.sql b/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.down.sql new file mode 100644 index 000000000000..48bb0390490f --- /dev/null +++ b/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.down.sql @@ -0,0 +1 @@ +ALTER TABLE contract_verification_requests DROP COLUMN force_evmla; diff --git a/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.up.sql b/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.up.sql new file mode 100644 index 000000000000..e4dad0a0a435 --- /dev/null +++ b/core/lib/dal/migrations/20240221155945_add_force_evmla_to_contract_verification_req.up.sql @@ -0,0 +1 @@ +ALTER TABLE contract_verification_requests ADD COLUMN IF NOT EXISTS force_evmla BOOLEAN NOT NULL DEFAULT false; diff --git a/core/lib/dal/src/contract_verification_dal.rs b/core/lib/dal/src/contract_verification_dal.rs index af4f3188a2dd..d3776a15cd7f 100644 --- a/core/lib/dal/src/contract_verification_dal.rs +++ b/core/lib/dal/src/contract_verification_dal.rs @@ -73,12 +73,13 @@ impl ContractVerificationDal<'_, '_> { optimizer_mode, constructor_arguments, is_system, + force_evmla, status, created_at, updated_at ) VALUES - ($1, $2, $3, $4, $5, $6, $7, $8, $9, 'queued', NOW(), NOW()) + ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, 'queued', NOW(), NOW()) RETURNING id "#, @@ -92,6 +93,7 @@ impl ContractVerificationDal<'_, '_> { query.optimizer_mode, query.constructor_arguments.0, query.is_system, + query.force_evmla, ) .fetch_one(self.storage.conn()) .await @@ -149,7 +151,8 @@ impl ContractVerificationDal<'_, '_> { optimization_used, optimizer_mode, constructor_arguments, - is_system + is_system, + force_evmla "#, &processing_timeout ) @@ -469,7 +472,8 @@ impl ContractVerificationDal<'_, '_> { optimization_used, optimizer_mode, constructor_arguments, - is_system + is_system, + force_evmla FROM contract_verification_requests WHERE diff --git a/core/lib/dal/src/models/storage_verification_request.rs b/core/lib/dal/src/models/storage_verification_request.rs index e6c68ca16fd9..61895fab76d3 100644 --- a/core/lib/dal/src/models/storage_verification_request.rs +++ b/core/lib/dal/src/models/storage_verification_request.rs @@ -18,6 +18,7 @@ pub struct StorageVerificationRequest { pub optimizer_mode: Option, pub constructor_arguments: Vec, pub is_system: bool, + pub force_evmla: bool, } impl From for VerificationRequest { @@ -44,6 +45,7 @@ impl From for VerificationRequest { optimizer_mode: value.optimizer_mode, constructor_arguments: value.constructor_arguments.into(), is_system: value.is_system, + force_evmla: value.force_evmla, }, } } diff --git a/core/lib/types/src/contract_verification_api.rs b/core/lib/types/src/contract_verification_api.rs index 02a5bef727dc..5be7a18be0eb 100644 --- a/core/lib/types/src/contract_verification_api.rs +++ b/core/lib/types/src/contract_verification_api.rs @@ -142,6 +142,8 @@ pub struct VerificationIncomingRequest { pub constructor_arguments: Bytes, #[serde(default)] pub is_system: bool, + #[serde(default)] + pub force_evmla: bool, } #[derive(Debug, Eq, PartialEq, Clone, Copy)]