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

Improve rule evaluation errors #36

Merged
merged 1 commit into from
Apr 18, 2024
Merged

Improve rule evaluation errors #36

merged 1 commit into from
Apr 18, 2024

Conversation

ligustah
Copy link
Collaborator

@ligustah ligustah commented Apr 18, 2024

  • implement Display, Serialize and Error for Results type
  • wrap the Results in the returned error (so it can be inspected further up the stack)

Error is now looking like this:

WARN mintpool::controller: Invalid premint, not broadcasting: Premint failed validation

Caused by:
    Metadata::token_uri_length: Accept
    Metadata::existing_token_uri: Accept
    Metadata::signer_matches: Ignore (No existing premint)
    Metadata::version_is_higher: Ignore (No existing premint)
    PremintTypes::ZoraV2::is_authorized_to_create_premint: Accept
    PremintTypes::ZoraV2::is_valid_signature: Reject (Invalid signature for contract admin 0xD272a3cB66bea1fa7547DAD5B420D5ebE14222E5)
    PremintTypes::ZoraV2::is_chain_supported: Accept
    PremintTypes::ZoraV2::not_minted: Accept
    PremintTypes::ZoraV2::premint_version_supported: Accept

JSON looks like this:

[
  {
    "result": "accept",
    "reason": null,
    "rule_name": "Metadata::token_uri_length"
  },
  {
    "result": "accept",
    "reason": null,
    "rule_name": "Metadata::existing_token_uri"
  },
  {
    "result": "ignore",
    "reason": "No existing premint",
    "rule_name": "Metadata::signer_matches"
  },
  {
    "result": "ignore",
    "reason": "No existing premint",
    "rule_name": "Metadata::version_is_higher"
  },
  {
    "result": "accept",
    "reason": null,
    "rule_name": "PremintTypes::ZoraV2::is_authorized_to_create_premint"
  },
  {
    "result": "reject",
    "reason": "Invalid signature for contract admin 0xD272a3cB66bea1fa7547DAD5B420D5ebE14222E5",
    "rule_name": "PremintTypes::ZoraV2::is_valid_signature"
  },
  {
    "result": "accept",
    "reason": null,
    "rule_name": "PremintTypes::ZoraV2::is_chain_supported"
  },
  {
    "result": "accept",
    "reason": null,
    "rule_name": "PremintTypes::ZoraV2::not_minted"
  },
  {
    "result": "accept",
    "reason": null,
    "rule_name": "PremintTypes::ZoraV2::premint_version_supported"
  }
]

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @ligustah and the rest of your teammates on Graphite Graphite

@ligustah ligustah marked this pull request as ready for review April 18, 2024 14:53
@ligustah ligustah merged commit 25afc36 into main Apr 18, 2024
3 checks passed
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.

2 participants