Skip to content

Commit

Permalink
propose verification spec changes (#2336)
Browse files Browse the repository at this point in the history
<!-- Reference any GitHub issues resolved by this PR -->

## Introduced changes

<!-- A brief description of the changes -->

This PR introduces changes to verification proposal document mainly as
follows:
1. Actual verification to be performed on class level
2. Keep `contract_address` (user should be able to provide
contract_address, which we resolve to `class_hash`)
Add `class_hash`
** Either contract_address or class_hash should be provided by user
3. Change `contract_name` to `class_name` OR keep `contract_name`

## Checklist

<!-- Make sure all of these are complete -->

- [ ] Linked relevant issue
- [x] Updated relevant documentation
- [ ] Added relevant tests
- [x] Performed self-review of the code
- [ ] Added changes to `CHANGELOG.md`
  • Loading branch information
rjnrohit authored Aug 7, 2024
1 parent 01725b8 commit 23883bc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/forge/tests/e2e/running.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn simple_package_with_git_dependency() {

temp.copy_from("tests/data/simple_package", &["**/*.cairo", "**/*.toml"])
.unwrap();
let remote_url = get_remote_url();
let remote_url = get_remote_url().to_lowercase();
let branch = get_current_branch();
let manifest_path = temp.child("Scarb.toml");
manifest_path
Expand Down
17 changes: 13 additions & 4 deletions design_documents/contract_verification.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The `verify` command will perform following actions:

#### Parameters

#### `--contract-name`
#### `--class-name`

Required.
Name of the contract to be submitted for verification.
Expand All @@ -36,6 +36,11 @@ Name of the contract to be submitted for verification.
Required.
Address of the contract to be submitted for verification.

#### `--class-hash`

Required.
Address of the contract to be submitted for verification.

#### `--verifier <VERIFIER NAME>`

Required.
Expand All @@ -61,11 +66,14 @@ To implement contract verification for a specific explorer, it is required to im
#### Request

- `ContractAddress` - `ContractAddress`
- `ContractName` - `String`
- `ClassHash` - `String`
- `ClassName` - `String`
- `SourceCode` - collection of file records (`.cairo` files + `Scarb.toml`):
- `FilePath` - `String`
- `FileContent` - `String`

Note: `ContractAddress` and `ClassHash` are mutually exclusive. One of them must be provided.

#### Response

- `VerificationStatus` - `Enum` (`OK`, `Error`)
Expand All @@ -81,8 +89,9 @@ A sample request in the Voyager API adapter implementation will look as follows:
const url = `${voyager.testnet.url}/contract/`

const payload = serde_json::json!({
"contract_address": "0x0",
"contract_name": "balance",
"contract_address": "0x0", // this is optional if class_hash is provided
"class_hash": "0x0", // this is optional if contract_address is provided
"class_name": "balance",
"source_code": {
"Scarb.toml" : {
"""
Expand Down

0 comments on commit 23883bc

Please sign in to comment.