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(cli): print relevant values when comparing fails #585

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

baumstern
Copy link
Member

Better Logging

Before: only error message has been printed
After: error message and relevant values will be printed

@samajammin
Copy link
Member

@gurrpi what's the status on this? Do you think this is worth finishing/merging? Or should we close this out?

@baumstern baumstern changed the base branch from v1 to dev October 16, 2023 17:58
@baumstern
Copy link
Member Author

@gurrpi what's the status on this? Do you think this is worth finishing/merging? Or should we close this out?

I've just triggered a new CI run. Once the checks pass, I think this is worth merging.

@ctrlc03
Copy link
Collaborator

ctrlc03 commented Oct 18, 2023

@gurrpi what's the status on this? Do you think this is worth finishing/merging? Or should we close this out?

I've just triggered a new CI run. Once the checks pass, I think this is worth merging.

please could you check what is causing all workflows to fail on build :) CI is fixed, needs rebase/merge into your branch and fix conflicts

@samajammin
Copy link
Member

Nudge on this @baumstern

@baumstern baumstern force-pushed the print branch 2 times, most recently from 909d4e2 to 639f561 Compare November 1, 2023 04:27
@baumstern
Copy link
Member Author

@ctrlc03 PTAL

cli/ts/utils.ts Outdated
@@ -142,6 +142,21 @@ const isPathExist = (paths: Array<string>): [boolean, string] => {
return [true, null]
}

const CompareOnchainValue = (
Copy link
Member

@samajammin samajammin Nov 2, 2023

Choose a reason for hiding this comment

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

Suggested change
const CompareOnchainValue = (
const compareOnChainValue = (

General convention - functions should always be camelCase, ya?

Noting this commit suggestion would require updating all uses of this function...

Copy link
Member

Choose a reason for hiding this comment

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

Edit - also capitalized the "C". See comment below for context

Copy link
Member Author

@baumstern baumstern Nov 3, 2023

Choose a reason for hiding this comment

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

General convention - functions should always be camelCase, ya?

Noting this commit suggestion would require updating all uses of this function...

Good catch! Reflected in 974ab46

@samajammin
Copy link
Member

@baumstern any particular reason you PR'd from your fork vs. creating a branch directly off the repo?

@@ -380,6 +375,7 @@ const proveOnChain = async (args: any) => {
return
}

const txErr = 'Error: processMessages() failed'
Copy link
Member

Choose a reason for hiding this comment

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

Another consistency nitpick - looks like you're using a mix of single quotes & double quotes. Do we have a convention on this? I don't have a strong preference... just that we be consistent

cli/ts/utils.ts Outdated
): boolean => {
if (onChainValue !== offChainValue) {
console.error(`Error: ${name} mismatch.`)
console.error(" onChainValue: " + onChainValue)
Copy link
Member

Choose a reason for hiding this comment

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

Why the spacing on these logs?

Copy link
Member Author

Choose a reason for hiding this comment

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

The spacing in these logs is intended to make the output more noticeable and easier to read.

Copy link
Member

@samajammin samajammin left a comment

Choose a reason for hiding this comment

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

A few styling nitpicks - see my comments

@baumstern
Copy link
Member Author

baumstern commented Nov 3, 2023

@baumstern any particular reason you PR'd from your fork vs. creating a branch directly off the repo?

I think I didn't dare to add a branch to the upstream repo at that moment 😂

@baumstern
Copy link
Member Author

baumstern commented Nov 3, 2023

A few styling nitpicks - see my comments

The inconsistency has been inherited from legacy code. I believe it would be better to address the codebase's overall consistency, so I have filed separate issues to tackle this:

@samajammin
Copy link
Member

The inconsistency has been inherited from legacy code

I'm just referring to your changes in this PR - you use both Onchain & OnChain, as well as single/double quotes. So I'd start by just addressing this PR. i.e. be consistent with your individual commits.

But agree, would be good to unify across the codebase as well 👍

@baumstern
Copy link
Member Author

The inconsistency has been inherited from legacy code

I'm just referring to your changes in this PR - you use both Onchain & OnChain, as well as single/double quotes. So I'd start by just addressing this PR. i.e. be consistent with your individual commits.

But agree, would be good to unify across the codebase as well 👍

That's reasonable. Fixed the inconsitency of this PR in 2e26126 to uses double quotes and OnChain across the change.

Lint errors such as those in #457 should be fixed and automatically enforced linting in pre-commit hook would ensure us to have consistent style after that.

@baumstern baumstern mentioned this pull request Nov 6, 2023
@baumstern baumstern requested a review from samajammin November 7, 2023 05:31
@samajammin samajammin merged commit cd1df8d into privacy-scaling-explorations:dev Nov 7, 2023
8 checks passed
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.

3 participants