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

feat: use checked arithmetic in vesting contract #40

Closed
wants to merge 1 commit into from

Conversation

0xf333
Copy link
Contributor

@0xf333 0xf333 commented Aug 26, 2023

Description

  • Introduced enhanced error handling.
  • Introduced checked arithmetic for safer calculations.

Impact

This PR addresses issue #36 and improves #34

@0xf333 0xf333 force-pushed the 0xf333/improve_vesting_contract branch 2 times, most recently from 988dce8 to 3f1656a Compare August 27, 2023 23:56
@0xf333
Copy link
Contributor Author

0xf333 commented Sep 4, 2023

@ascjones

Copy link
Collaborator

@ascjones ascjones left a comment

Choose a reason for hiding this comment

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

In general I would avoid mapping to generic error variants for the arithmetic errors, and prefer enforcing the invariants which prevent the arithmetic errors in the first place. In most cases you can then just panic via expect or unwrap. In other cases you can use specific errors. IMO Error variants should be used for specific error cases that are descriptive and possibly can be handled via a client.

I've highlighted a couple of places where the improvements could be made.

vesting/lib.rs Outdated Show resolved Hide resolved
vesting/lib.rs Outdated Show resolved Hide resolved
vesting/lib.rs Outdated Show resolved Hide resolved
0xf333 added a commit to 0xf333/ink-examples that referenced this pull request Sep 11, 2023
Description
============
- Introduced enhanced error handling.
- Introduced checked arithmetic for
  safer calculations.

Impact
======
This commit addresses issue use-ink#36

* fix: Implement changes based on PR feedback
feedback link:
use-ink#40 (review)
@0xf333 0xf333 force-pushed the 0xf333/improve_vesting_contract branch from 3f1656a to ea2efed Compare September 11, 2023 10:21
0xf333 added a commit to 0xf333/ink-examples that referenced this pull request Sep 11, 2023
Description
============
- Introduced enhanced error handling.
- Introduced checked arithmetic for
  safer calculations.

Impact
======
This commit addresses issue use-ink#36

* fix: Implement changes based on PR feedback
feedback link:
use-ink#40 (review)
@0xf333 0xf333 force-pushed the 0xf333/improve_vesting_contract branch from ea2efed to 50d7a8a Compare September 11, 2023 19:05
Description
============
- Introduced enhanced error handling.
- Introduced checked arithmetic for
  safer calculations.

Impact
======
This commit addresses issue use-ink#36

* fix: Implement changes based on PR feedback
feedback link:
use-ink#40 (review)
@0xf333 0xf333 force-pushed the 0xf333/improve_vesting_contract branch from 50d7a8a to 1ec4142 Compare September 11, 2023 19:08
@0xf333 0xf333 closed this May 9, 2024
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