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

Fix validation for global params with no default value #836

Closed
wants to merge 1 commit into from

Conversation

zoeyTM
Copy link
Contributor

@zoeyTM zoeyTM commented Nov 20, 2024

resolves #834

@zoeyTM zoeyTM requested review from kanej and alcuadrado November 20, 2024 08:33
@@ -65,7 +65,8 @@ export async function validateNamedContractDeployment(

const missingParams = moduleParams.filter(
(param) =>
deploymentParameters[param.moduleId]?.[param.name] === undefined &&
(deploymentParameters[param.moduleId]?.[param.name] === undefined &&
deploymentParameters.$global[param.name]) === undefined &&
Copy link
Member

Choose a reason for hiding this comment

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

I think this is a bug, the additional brackets are not going to give the value expected.

@@ -80,6 +81,7 @@ export async function validateNamedContractDeployment(
if (isModuleParameterRuntimeValue(future.value)) {
const param =
deploymentParameters[future.value.moduleId]?.[future.value.name] ??
deploymentParameters.$global[future.value.name] ??
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
deploymentParameters.$global[future.value.name] ??
deploymentParameters.$global?.[future.value.name] ??

I think we need to guard against there being no global parameters passed.

Copy link
Member

@kanej kanej left a comment

Choose a reason for hiding this comment

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

We need tests around the new validation paths.
We should also add tests explicitly for the no default value in a module parameter but a valid entry in the global module parameters.

@kanej
Copy link
Member

kanej commented Nov 20, 2024

I closing this in favour of: #832

@kanej kanej closed this Nov 20, 2024
@kanej kanej deleted the fix/global-params-without-default branch December 18, 2024 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

module parameters not working with parameters without defaults
2 participants