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

2022 add validation scripts after contract deployments #2081

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

Conversation

alysiahuggins
Copy link
Contributor

@alysiahuggins alysiahuggins commented Sep 26, 2024

Closes #1198

This PR:

  • adds proxy admin validation after light client and fee contract proxy deploys

Key places to review:

  • newly added functions
  • locations of tests

How to test this PR:

  • cargo test service --all-features
    Or more precisely
  • cargo test test_fail_validate_light_contract_proxy --all-features
  • cargo test test_validate_light_contract_is_not_a_proxy --all-features

@alysiahuggins alysiahuggins linked an issue Sep 26, 2024 that may be closed by this pull request
@alysiahuggins alysiahuggins requested review from sveitser, jbearer and imabdulbasit and removed request for sveitser, jbearer and imabdulbasit September 26, 2024 16:38
@@ -472,6 +625,30 @@ pub async fn is_proxy_contract(
Ok(implementation_address != H160::zero())
}

pub async fn is_valid_admin_light_client_proxy<M: Middleware + 'static>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since the implementation of the function is the same and we only call the owner function of (I think) OwnableUpgradable we could create the bindings for OwnableUpgradable and instantiate that rust contract type. Then we can use the same function for all our proxy contracts and don't have to duplicate the function implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

great call e44b49f

@@ -307,6 +307,143 @@ pub async fn deploy_mock_light_client_contract<M: Middleware + 'static>(
Ok(contract.address())
}

/// Deployment `LightClientMock.sol` as proxy for testing
pub async fn deploy_light_client_contract_as_proxy_for_test<M: Middleware + 'static>(
Copy link
Collaborator

Choose a reason for hiding this comment

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

It looks like this should be feature gated with #[cfg(any(test, feature = "testing"))]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good call! Thank you!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that function appeared to be duplicated as it was already in a test module . Removed duplicates here: 58a9890

@sveitser
Copy link
Collaborator

@alysiahuggins It seems part of this PR is already on main. If the PR is still relevant, could you sync it with main?

justfile Outdated
@@ -76,7 +76,7 @@ build-docker-images:
scripts/build-docker-images-native

# generate rust bindings for contracts
REGEXP := "^LightClient$|^LightClientStateUpdateVK$|^FeeContract$|PlonkVerifier$|^ERC1967Proxy$|^LightClientMock$|^LightClientStateUpdateVKMock$|^PlonkVerifier2$"
REGEXP := "^LightClient$|^LightClientStateUpdateVK$|^FeeContract$|^HotShot$|PlonkVerifier$|^ERC1967Proxy$|^OwnableUpgradeable$|^LightClientMock$|^LightClientStateUpdateVKMock$|^PlonkVerifier2$"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The HotShot contract has been removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, i missed that handling a merge conflict beeb04b

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