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(cli) - fix wrong condition check in contracts deployment #763

Merged
merged 7 commits into from
Nov 1, 2023

Conversation

ctrlc03
Copy link
Collaborator

@ctrlc03 ctrlc03 commented Oct 22, 2023

fix #762

@ctrlc03 ctrlc03 self-assigned this Oct 22, 2023
@ctrlc03 ctrlc03 requested a review from 0xjei October 23, 2023 08:52
@ctrlc03 ctrlc03 assigned baumstern and unassigned baumstern Oct 23, 2023
let initialVoiceCreditProxyContractAddress: string
if (initialVoiceCreditProxy === undefined) {
// check if we have the amount of credits to set, or use the default
const initialVoiceCredits = args.initial_voice_credits ? args.initial_voice_credits : DEFAULT_INITIAL_VOICE_CREDITS
Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind that DEFAULT_INITIAL_VOICE_CREDITS is being imported fromdefaults.ts. Even though it's intended to serve as a default value here, there's no guarantee that it will always be defined in the external file. It's worth ensuring that there's a safeguard or check in place to handle potential undefined values from external imports.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

if someone goes out of their way to remove the entry from defaults.ts then the code will not compile as create.ts it's importing something that does not exist

Copy link
Member

Choose a reason for hiding this comment

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

yeah this isn't a major issue, but optionally, for the sake of robustness, you might consider adding a safeguard for DEFAULT_INITIAL_VOICE_CREDITS. Even if defaults.ts is present and being imported, there's no strict guarantee that DEFAULT_INITIAL_VOICE_CREDITS will be consistently defined within that file. A safeguard or a check could make the code more resilient and aligned with best practices of treating external dependencies with caution.

@ctrlc03 ctrlc03 requested a review from baumstern October 24, 2023 09:35
@baumstern
Copy link
Member

Re-triggered the failed e2e test. Once that passes, this PR should be good to go for merging.

@ctrlc03
Copy link
Collaborator Author

ctrlc03 commented Oct 30, 2023

Re-triggered the failed e2e test. Once that passes, this PR should be good to go for merging.

I'm debugging the failure, so will probably fail again. will let you know once it's fixed.

Copy link
Member

@baumstern baumstern left a comment

Choose a reason for hiding this comment

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

LGTM

@baumstern baumstern merged commit ac04d42 into dev Nov 1, 2023
8 checks passed
@ctrlc03 ctrlc03 deleted the fix/voice-credits-cli branch November 1, 2023 10:26
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.

The 'create' cli fails if initialVoiceCreditProxy is passed as an argument
2 participants