Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor verification crate & add voyager interface #2288

Closed
wants to merge 15 commits into from

Conversation

rjnrohit
Copy link
Contributor

@rjnrohit rjnrohit commented Jul 9, 2024

Closes #2287

Introduced changes

Add voyager verifier to the sncast verify command.

Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@rjnrohit rjnrohit changed the title add voyager interface refactor verification crate & add voyager interface Aug 8, 2024
base: BaseVerificationInterface,
}

#[async_trait]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#[async_trait] attribute is not required


#[derive(Parser)]
#[command(about = "Verify a contract through a block explorer")]
pub struct Verify {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add descriptions of all parameters to display in help

}

fn gen_explorer_url(&self) -> Result<String> {
let api_base_url = env::var("VOYAGER_API_URL")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would like to unify the wole configuration to a TOML file. Could you please redesign the url acquisition logic to use an enum provied via CastConfig rather than an environmental variable?

#[async_trait]
pub trait VerificationInterface {
fn new(network: Network, workspace_dir: Utf8PathBuf) -> Self;
async fn verify(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both implementations of this method are identical. You can make it a default implementation

class_hash: Option<FieldElement>,
class_name: String,
) -> Result<VerifyResponse>;
fn gen_explorer_url(&self) -> Result<String>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Similarly to verify, implementations of this method differ only with the url source. How about introducing a new trait method, let's say get_base_url, implementing it manually on both types and using in a default implementation of gen_explorer_url?
  2. This method never fails. Are there any reasons for it to return a Result?

@integraledelebesgue
Copy link
Member

Hi @rjnrohit! Please let us know if you are still working on these features.

@integraledelebesgue
Copy link
Member

Closing because of lack of activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add voyager verification interface to the verify command
2 participants