diff --git a/smart-contract-verifier/smart-contract-verifier-proto/build.rs b/smart-contract-verifier/smart-contract-verifier-proto/build.rs index 5fe2fe6c1..26170c8ae 100644 --- a/smart-contract-verifier/smart-contract-verifier-proto/build.rs +++ b/smart-contract-verifier/smart-contract-verifier-proto/build.rs @@ -21,6 +21,14 @@ fn compile( .field_attribute( ".blockscout.smartContractVerifier.v2.VerifyVyperMultiPartRequest.interfaces", "#[serde(default)]" + ) + .field_attribute( + ".blockscout.smartContractVerifier.v2.VerifySolidityMultiPartRequest.post_actions", + "#[serde(default)]" + ) + .field_attribute( + ".blockscout.smartContractVerifier.v2.VerifySolidityStandardJsonRequest.post_actions", + "#[serde(default)]" ); config.compile_protos(protos, includes)?; Ok(()) diff --git a/smart-contract-verifier/smart-contract-verifier-proto/proto/v2/smart-contract-verifier.proto b/smart-contract-verifier/smart-contract-verifier-proto/proto/v2/smart-contract-verifier.proto index 34cdddf12..0f2d82152 100644 --- a/smart-contract-verifier/smart-contract-verifier-proto/proto/v2/smart-contract-verifier.proto +++ b/smart-contract-verifier/smart-contract-verifier-proto/proto/v2/smart-contract-verifier.proto @@ -113,6 +113,10 @@ message VerifySolidityMultiPartRequest { /// An optional field to be filled by explorers optional VerificationMetadata metadata = 8; + + /// Additional actions the client wants the result to be returned. + /// Currently supports only: "lookup-methods" for Solidity contracts. + repeated string post_actions = 9; } message VerifySolidityStandardJsonRequest { @@ -127,6 +131,10 @@ message VerifySolidityStandardJsonRequest { /// An optional field to be filled by explorers optional VerificationMetadata metadata = 5; + + /// Additional actions the client wants the result to be returned. + /// Currently supports only: "lookup-methods" for Solidity contracts. + repeated string post_actions = 9; } message VerifyVyperMultiPartRequest { @@ -190,6 +198,13 @@ message VerifyResponse { repeated BytecodePart local_deployed_bytecode_parts = 2; } ExtraData extra_data = 4; + + message PostActionResponses { + /// If requested, will contain the response for + /// 'lookup-methods' processing applied to the verified contract. + optional LookupMethodsResponse lookup_methods = 1; + } + PostActionResponses post_action_responses = 5; } message VerifySourcifyRequest { diff --git a/smart-contract-verifier/smart-contract-verifier-proto/swagger/v2/smart-contract-verifier.swagger.yaml b/smart-contract-verifier/smart-contract-verifier-proto/swagger/v2/smart-contract-verifier.swagger.yaml index 42013a0d2..62286cfda 100644 --- a/smart-contract-verifier/smart-contract-verifier-proto/swagger/v2/smart-contract-verifier.swagger.yaml +++ b/smart-contract-verifier/smart-contract-verifier-proto/swagger/v2/smart-contract-verifier.swagger.yaml @@ -253,6 +253,7 @@ definitions: localCreationInputParts: type: array items: + type: object $ref: '#/definitions/ExtraDataBytecodePart' description: |- / Creation transaction input resultant from local compilation @@ -260,10 +261,19 @@ definitions: localDeployedBytecodeParts: type: array items: + type: object $ref: '#/definitions/ExtraDataBytecodePart' description: |- / Deployed bytecode resultant from local compilation / parsed and split on Main and Meta parts. Is empty for Sourcify verification. + VerifyResponsePostActionResponses: + type: object + properties: + lookupMethods: + $ref: '#/definitions/v2LookupMethodsResponse' + description: |- + / If requested, will contain the response for + / 'lookup-methods' processing applied to the verified contract. googlerpcStatus: type: object properties: @@ -275,6 +285,7 @@ definitions: details: type: array items: + type: object $ref: '#/definitions/protobufAny' protobufAny: type: object @@ -400,6 +411,8 @@ definitions: $ref: '#/definitions/v2Source' extraData: $ref: '#/definitions/VerifyResponseExtraData' + postActionResponses: + $ref: '#/definitions/VerifyResponsePostActionResponses' v2VerifyResponseStatus: type: string enum: @@ -441,6 +454,13 @@ definitions: metadata: $ref: '#/definitions/v2VerificationMetadata' title: / An optional field to be filled by explorers + postActions: + type: array + items: + type: string + description: |- + / Additional actions the client wants the result to be returned. + / Currently supports only: "lookup-methods" for Solidity contracts. v2VerifySolidityStandardJsonRequest: type: object properties: @@ -459,6 +479,13 @@ definitions: metadata: $ref: '#/definitions/v2VerificationMetadata' title: / An optional field to be filled by explorers + postActions: + type: array + items: + type: string + description: |- + / Additional actions the client wants the result to be returned. + / Currently supports only: "lookup-methods" for Solidity contracts. v2VerifySourcifyRequest: type: object properties: diff --git a/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_multi_part.rs b/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_multi_part.rs index 626cde814..0a5da85b1 100644 --- a/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_multi_part.rs +++ b/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_multi_part.rs @@ -111,6 +111,7 @@ mod tests { chain_id: Some("1".into()), contract_address: Some("0xcafecafecafecafecafecafecafecafecafecafe".into()), }), + post_actions: vec![], }; let mut expected = VerificationRequest { @@ -156,6 +157,7 @@ mod tests { optimization_runs: None, libraries: Default::default(), metadata: None, + post_actions: vec![], }; let verification_request: VerificationRequest = @@ -181,6 +183,7 @@ mod tests { optimization_runs: None, libraries: Default::default(), metadata: None, + post_actions: vec![], }; let verification_request: VerificationRequest = @@ -205,6 +208,7 @@ mod tests { optimization_runs: None, libraries: Default::default(), metadata: None, + post_actions: vec![], }; let verification_request: VerificationRequest = diff --git a/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_standard_json.rs b/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_standard_json.rs index 08af3535f..6aa470b7b 100644 --- a/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_standard_json.rs +++ b/smart-contract-verifier/smart-contract-verifier-server/src/types/solidity_standard_json.rs @@ -87,6 +87,7 @@ mod tests { chain_id: Some("1".into()), contract_address: Some("0xcafecafecafecafecafecafecafecafecafecafe".into()) }), + post_actions: vec![], }; let input: CompilerInput = serde_json::from_str(&request.input).unwrap(); @@ -149,6 +150,7 @@ mod tests { compiler_version: "v0.8.17+commit.8df45f5f".to_string(), input: "{\"language\": \"Solidity\", \"sources\": {\"./src/contracts/Foo.sol\": {\"content\": \"pragma solidity ^0.8.2;\\n\\ncontract Foo {\\n function bar() external pure returns (uint256) {\\n return 42;\\n }\\n}\\n\"}}, \"settings\": {\"metadata\": {\"useLiteralContent\": true}, \"optimizer\": {\"enabled\": true, \"runs\": 200}, \"outputSelection\": {\"*\": {\"*\": [\"abi\", \"evm.bytecode\", \"evm.deployedBytecode\", \"evm.methodIdentifiers\"], \"\": [\"id\", \"ast\"]}}}}".to_string(), metadata: None, + post_actions: vec![], }; let verification_request: VerificationRequest = diff --git a/smart-contract-verifier/smart-contract-verifier-server/src/types/verify_response.rs b/smart-contract-verifier/smart-contract-verifier-server/src/types/verify_response.rs index 3e36f7798..a4627fd3e 100644 --- a/smart-contract-verifier/smart-contract-verifier-server/src/types/verify_response.rs +++ b/smart-contract-verifier/smart-contract-verifier-server/src/types/verify_response.rs @@ -1,5 +1,5 @@ use crate::proto::{ - verify_response::{ExtraData, Status}, + verify_response::{ExtraData, PostActionResponses, Status}, Source, VerifyResponse, }; use serde::{Deserialize, Serialize}; @@ -91,6 +91,9 @@ impl VerifyResponseWrapper { status: Status::Success.into(), source: Some(source), extra_data: Some(extra_data), + post_action_responses: Some(PostActionResponses { + lookup_methods: None, + }), } .into() } @@ -101,6 +104,7 @@ impl VerifyResponseWrapper { status: Status::Failure.into(), source: None, extra_data: None, + post_action_responses: None, } .into() } @@ -198,6 +202,9 @@ mod tests { local_creation_input_parts: vec![], local_deployed_bytecode_parts: vec![], }), + post_action_responses: Some(PostActionResponses { + lookup_methods: None, + }), }; assert_eq!(expected, response); @@ -211,6 +218,7 @@ mod tests { status: Status::Failure.into(), source: None, extra_data: None, + post_action_responses: None, }; assert_eq!(expected, response); }