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

feat(ampd): add Stacks handlers #728

Open
wants to merge 32 commits into
base: main
Choose a base branch
from

Conversation

raress96
Copy link
Contributor

@raress96 raress96 commented Dec 16, 2024

Description

Stacks verify msg & verify verifier set handlers.

feat(ampd): custom ITS logic for Stacks
… contract deployment by any contract on Stacks.
Comment on lines 61 to 76
pub async fn verify_contract_code(
http_client: &Client,
reference_address: PrincipalData,
contract_address: PrincipalData,
) -> Result<bool, Box<dyn std::error::Error>> {
let reference_contract_code = http_client
.get_contract_info(format!("{}", reference_address.to_string()).as_str())
.await?;

let actual_contract_code = http_client
.get_contract_info(format!("{}", contract_address.to_string()).as_str())
.await?;

Ok(reference_contract_code.source_code == actual_contract_code.source_code)
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I am worried about the performance implications of this. As far as I can tell, this is downloading two sets of source code and then comparing them? Is it comparing a hash of the source code or the full bytes of the source code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer applicable

Comment on lines 217 to 219
// In case message is from Stacks -> Stacks and the same contract to itself,
// try to see if we need to verify if a contract was deployed
let result = get_verify_contract_params(event);
Copy link
Contributor

Choose a reason for hiding this comment

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

I still don't think this functionality should exist in ampd. Suddenly now ampd is doing something different than what it normally does (verify gmp messages and verify verifier set rotations). This change opens the door for ampd to start doing all kinds of custom logic, and just makes the code and system more complicated to reason about and maintain. Even from a performance perspective, we need to be aware of the overhead of attempting to verify contract deployments now. I don't think we should go down this route.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, I am wondering why this functionality needs to utilize axelar at all? It doesn't need to be a cross chain call. The contract being verified is on stacks, and the ITS contract that needs to react to the verification is also on stacks. So can this system can and should, in my opinion, be built entirely on stacks, and not utilize the amplifier/axelar protocol at all. Unless I am missing something.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The contract verification logic was removed, no custom logic for Stacks is now in ampd.

@raress96 raress96 requested a review from cjcobb23 January 13, 2025 11:04
@raress96 raress96 changed the title feat(ampd): add Stacks handlers with verify logic for contract deployments feat(ampd): add Stacks handlers Jan 13, 2025
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.

2 participants