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

[Supplier] refactor: supplier module errors #265

Merged
merged 38 commits into from
Jan 10, 2024

Conversation

bryanchriswhite
Copy link
Contributor

@bryanchriswhite bryanchriswhite commented Dec 12, 2023

Summary

Human Summary

Refactors supplier module error usage to be consistent with respect to:

  • Returning a gRPC "status" error only when returning from an on-chain message/query handler.
  • Always using sentinel errors.

It also makes "tighter" assertions about the error types/messages in failure test cases.

Issue

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

  • Run all unit tests: make go_develop_and_test
  • Run E2E tests locally: make test_e2e
  • Run E2E tests on DevNet: Add the devnet-test-e2e label to the PR. This is VERY expensive, only do it after all the reviews are complete.

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have performed a self-review of my own code
  • I have commented my code, updated documentation and left TODOs throughout the codebase

@bryanchriswhite bryanchriswhite self-assigned this Dec 12, 2023
@bryanchriswhite bryanchriswhite added on-chain On-chain business logic code health Cleans up some code labels Dec 12, 2023
@bryanchriswhite bryanchriswhite added this to the Shannon TestNet milestone Dec 12, 2023
@bryanchriswhite bryanchriswhite force-pushed the issues/141/refactor/supplier-errors branch from a789bb3 to 7c961b5 Compare December 12, 2023 17:09
@bryanchriswhite bryanchriswhite linked an issue Dec 13, 2023 that may be closed by this pull request
8 tasks
@bryanchriswhite bryanchriswhite force-pushed the issues/141/refactor/supplier-errors branch 2 times, most recently from 9f31147 to 190b58b Compare December 13, 2023 13:29
@bryanchriswhite bryanchriswhite changed the title refactor: supplier module errors [Supplier] refactor: supplier module errors Dec 13, 2023
@bryanchriswhite bryanchriswhite added the supplier Changes related to the Supplier actor label Dec 13, 2023
@bryanchriswhite bryanchriswhite linked an issue Dec 13, 2023 that may be closed by this pull request
8 tasks
@bryanchriswhite bryanchriswhite force-pushed the issues/141/refactor/supplier-errors branch from 6ebd664 to 6817364 Compare December 13, 2023 22:06
@bryanchriswhite bryanchriswhite marked this pull request as ready for review December 13, 2023 22:07
x/supplier/client/cli/query_claim_test.go Show resolved Hide resolved
x/supplier/client/cli/query_claim_test.go Outdated Show resolved Hide resolved
// NB: this is *NOT* a gRPC status error because the bech32 parse
// error occurs during request validation (i.e. client-side).
expectedErr: types.ErrSupplierInvalidAddress.Wrapf(
// TODO_CONSIDERATION: prefer using "%q" in error format strings
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 an awesome idea. Let's start doing this!

Might just be worth @mentioning protocol-dev on discord and we'll adopt it over time.

x/supplier/keeper/query_claim_test.go Show resolved Hide resolved
bryanchriswhite and others added 2 commits December 22, 2023 14:36
Co-authored-by: harry <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: Daniel Olshansky <[email protected]>
Co-authored-by: harry <[email protected]>
@@ -9,7 +9,7 @@ import (
// x/supplier module sentinel errors
var (
ErrSupplierInvalidStake = sdkerrors.Register(ModuleName, 1, "invalid supplier stake")
ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid supplier address")
ErrSupplierInvalidAddress = sdkerrors.Register(ModuleName, 2, "invalid address")
Copy link
Member

Choose a reason for hiding this comment

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

NIT: revert?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The intention behind this change is to avoid creating an additional supplier module error which represents an invalid application address. As we're already wrapping these errors with formatted messages (#Wrapf()), it seemed more appropriate to me to generalize the message here. Additionally, my understanding of the purpose of naming the errors after their modules was to easily signal which module an error came from.

Copy link

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks.

@bryanchriswhite bryanchriswhite removed push-image CI related - pushes images to ghcr.io devnet devnet-test-e2e labels Jan 10, 2024
…im-proof

* pokt/main:
  [Supplier] refactor: claim & proof protobufs + (#263)
…plier-keys

* pokt/main:
  [Supplier] refactor: supplier module keys (#264)
@bryanchriswhite bryanchriswhite changed the base branch from issues/141/refactor/supplier-keys to main January 10, 2024 12:47
…ctor/supplier-errors

* issues/141/refactor/supplier-keys:
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
@bryanchriswhite bryanchriswhite merged commit e39ba19 into main Jan 10, 2024
10 checks passed
bryanchriswhite added a commit that referenced this pull request Jan 10, 2024
…plier-errors

* pokt/main:
  [Supplier] refactor: supplier module errors (#265)
bryanchriswhite added a commit that referenced this pull request Jan 10, 2024
…ep/in-memory-network

* issues/141/refactor/supplier-errors:
  [Supplier] refactor: supplier module errors (#265)
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
bryanchriswhite added a commit that referenced this pull request Jan 10, 2024
…/in-memory-network

* issues/141/prep/in-memory-network:
  [Testing, Tooling] chore: in-memory network interface & config types (#289)
  trigger CI
  [Supplier] refactor: supplier module errors (#265)
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
  chore: review feedback improvements
  [Configs] feat: Add staking config parser of gateway staking (#302)
  chore: review feedback improvements
  fix: usage raw string literal
  chore: review feedback improvements
  [RingCache] Invalidate Cache On Redelegation Events (#239)
bryanchriswhite added a commit that referenced this pull request Jan 12, 2024
…ctor/in-memory-network

* issues/141/feat/in-memory-network:
  chore: review feedback improvements
  feat: update SMT to v0.9.2 (#311)
  fix: linter errors
  fixup! chore: review feedback improvements
  chore: review feedback improvements
  chore: review feedback improvements
  [Testing, Tooling] chore: in-memory network interface & config types (#289)
  trigger CI
  [Supplier] refactor: supplier module errors (#265)
  [Supplier] refactor: supplier module keys (#264)
  [Supplier] refactor: claim & proof protobufs + (#263)
  chore: review feedback improvements
  [Configs] feat: Add staking config parser of gateway staking (#302)
  chore: review feedback improvements
  fix: usage raw string literal
  chore: review feedback improvements
  [RingCache] Invalidate Cache On Redelegation Events (#239)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Cleans up some code on-chain On-chain business logic supplier Changes related to the Supplier actor
Projects
Status: ✅ Done
2 participants