gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
839 stars 342 forks source link

feat(gnokey): update gnokey verify and tests #2333

Open thinhnx-var opened 2 weeks ago

thinhnx-var commented 2 weeks ago
Contributors' checklist... - [ ] Added new tests, or not needed, or not feasible - [ ] Provided an example (e.g. screenshot) to aid review or the PR is self-explanatory - [ ] Updated the official documentation or not needed - [ ] No breaking changes were made, or a `BREAKING CHANGE: xxx` message was included in the description - [ ] Added references to related issues and PRs - [ ] Provided any useful hints for running manual tests - [ ] Added new benchmarks to [generated graphs](https://gnoland.github.io/benchmarks), if any. More info [here](https://github.com/gnolang/gno/blob/master/.benchmarks/README.md).

Link to this issue: #2311 This PR changes the Verify() to read the signed doc, verify the exactly original message hash that was signed. It also adds chainid, account-number, account-sequence config flag to the gnokey verify command.

The sign function now expose the hex-format of signature to the IO in oder to feed the verify as an argument. I think we need better way for user to verify their signed document, which currently need this hex-format (#2272)

What do you think about this change?

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 85.18519% with 4 lines in your changes missing coverage. Please review.

Project coverage is 54.63%. Comparing base (e7e47d2) to head (5e9d999).

Files Patch % Lines
tm2/pkg/crypto/keys/client/verify.go 84.61% 2 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2333 +/- ## ========================================== + Coverage 54.62% 54.63% +0.01% ========================================== Files 581 581 Lines 77955 77979 +24 ========================================== + Hits 42584 42606 +22 Misses 32194 32194 - Partials 3177 3179 +2 ``` | [Flag](https://app.codecov.io/gh/gnolang/gno/pull/2333/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | Coverage Δ | | |---|---|---| | [tm2](https://app.codecov.io/gh/gnolang/gno/pull/2333/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang) | `54.41% <85.18%> (-0.05%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=gnolang#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

leohhhn commented 2 weeks ago

Hey @thinhnx-var thanks for this - can you please check why the CI is failing and fix it?

thinhnx-var commented 2 weeks ago

@leohhhn yeah sure. Maybe CI failed because CI-Lint. I gonna fix it up.