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

Rework kernel error categories #914

Open
PhilippGackstatter opened this issue Oct 9, 2024 · 0 comments
Open

Rework kernel error categories #914

PhilippGackstatter opened this issue Oct 9, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@PhilippGackstatter
Copy link
Contributor

What should be done?

We should consider reworking how transaction kernel errors are structured on a category level. Category here means account, prologue, epilogue, faucet, ... These errors are already grouped in tx_kernel_errors.rs:

pub const ERR_ACCOUNT_CODE_COMMITMENT_MISMATCH: u32 = 0x0002004c;
pub const ERR_ACCOUNT_CODE_IS_NOT_UPDATABLE: u32 = 0x0002003d;
pub const ERR_ACCOUNT_...

pub const ERR_FUNGIBLE_ASSET_AMOUNT_EXCEEDS_MAX_ALLOWED_AMOUNT: u32 = 0x00020042;
pub const ERR_FUNGIBLE_ASSET_DISTRIBUTE_WOULD_CAUSE_MAX_SUPPLY_TO_BE_EXCEEDED: u32 = 0x00020021;
pub const ERR_FUNGIBLE_ASSET_...

Here they are grouped by the category in the name but the error code does not reflect the categories.

How should it be done?

It would be nice to be able to programmatically determine the category of an error from the error code, similar to how one can determine from an HTTP status code (1xx, 2xx, 3xx, ...) the category (Informational, Success, Redirect, ...).

For that, we might want to come up with ranges for categories, for example:

  • ERR_ACCOUNT_* might be within 0x00020040 - 0x00020050
  • ERR_FUNGIBLE_ASSET_* within 0x00020050 - 0x00020060
  • and so on...

The task is to figure out what range size makes sense and then rewrite the error codes to be within those categories.

When is this task done?

When the errors can be categorized from their code.

Additional context

For reference, the original context where this came up.

@PhilippGackstatter PhilippGackstatter added the enhancement New feature or request label Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant