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

Test safe arithmetic checks in blockchain.rs #202

Merged
21 commits merged into from
Sep 21, 2022

Conversation

ghost
Copy link

@ghost ghost commented Sep 1, 2022

Closes issue #201

vlopes11 and others added 8 commits August 16, 2022 19:02
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
@ghost ghost requested a review from vlopes11 September 1, 2022 20:25
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>

# Conflicts:
#	src/interpreter/blockchain.rs
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
@ghost ghost marked this pull request as ready for review September 2, 2022 12:19
@ghost ghost self-assigned this Sep 5, 2022
@ghost ghost added the enhancement New feature or request label Sep 5, 2022
@ghost ghost requested review from Dentosal and Voxelot September 9, 2022 14:43
@ghost ghost linked an issue Sep 12, 2022 that may be closed by this pull request
@ghost ghost requested a review from vlopes11 September 12, 2022 20:21
Copy link
Contributor

@vlopes11 vlopes11 left a comment

Choose a reason for hiding this comment

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

looks good overall; small nit

Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
@ghost ghost requested a review from vlopes11 September 15, 2022 14:41
Voxelot
Voxelot previously approved these changes Sep 15, 2022
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
@ghost ghost requested a review from Voxelot September 16, 2022 11:25
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
Voxelot
Voxelot previously approved these changes Sep 16, 2022
@ghost ghost enabled auto-merge (squash) September 21, 2022 12:45
Copy link
Contributor

@vlopes11 vlopes11 left a comment

Choose a reason for hiding this comment

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

last nit

Signed-off-by: Mitch Martin <mitch.martin@fuel.sh>
@ghost ghost merged commit a08d826 into master Sep 21, 2022
@ghost ghost deleted the mitch-fuel/test-safe-arith-blockchain branch September 21, 2022 14:37
ControlCplusControlV pushed a commit that referenced this pull request Nov 24, 2022
* Moved anonymous structures from `Transaction` to own types  `Script` and `Create`.

Moved all getters from `Transaction` to `Create` and `Script`.

Splitted the previous logic of the transaction into traits and implemented traits for `Create` and `Script`.

Adapted tests to use generic code or code with exactly expected types.

Prepared the code to easily integrate a new `Mint` transaction.

TODO: Add support of metadata

* Fixed the build for different targets

* Make clippy happy

* Add some comments

* Renamed `Validatable` into `Checkable` and all `validate` into `check`
Re-worked `CheckedTransaction`. Introduced a new `Checked` wrapper that allows to wrap any data in generic way.
Added covertion to "checked" enum for `Transaction`

* Make CI happy

* Make clippy happy

* Make clippy happy

* Added comments.
Fixed bug with size of the `Transaciton`

* Added static offset methods for fields that supports it.
Implemented `Default` for `Script`.
Made checked metadata public.
Made `Stage` also public to allow writing a generic code.
Added input argument to `ConsensusParameters::tx_offset` to highlight breaking work with offsets.

* Add support of metadata for offsets

* Added check for `serialized_size`

* Fix build for all platforms

* Added some help functions after integration with `fuel-core`

* Added some help functions after integration with `fuel-core`

* Fix CI

* Highlight that buffer is read here

* Added explicit `discriminant` to `Create` and `Script`

* Fix compilation with `vec`

* Added two helper functions to simplify tests in the `fuel-core`

* Removed `Stage` from the `Checked`, replaced with enum.

* Forgot about `finalize_checked_stateless`

* Removed `discriminant` field after discussion in the PR

* Replaced enum with bitmask. The basic checks it a minimal way to create a `Checked` transaction.

* Make clippy happy

* Private `new`

* Added `Mint` transaction without tests

* Added tests for `Mint`

* Move `TxPointer` to the root, because can be compiled with `alloc`

* Fix compilation erros

* Swap methods to minimize number of changes

* Remove TODO, because it is resovled
ControlCplusControlV pushed a commit that referenced this pull request Dec 1, 2022
* Moved anonymous structures from `Transaction` to own types  `Script` and `Create`.

Moved all getters from `Transaction` to `Create` and `Script`.

Splitted the previous logic of the transaction into traits and implemented traits for `Create` and `Script`.

Adapted tests to use generic code or code with exactly expected types.

Prepared the code to easily integrate a new `Mint` transaction.

TODO: Add support of metadata

* Fixed the build for different targets

* Make clippy happy

* Add some comments

* Renamed `Validatable` into `Checkable` and all `validate` into `check`
Re-worked `CheckedTransaction`. Introduced a new `Checked` wrapper that allows to wrap any data in generic way.
Added covertion to "checked" enum for `Transaction`

* Make CI happy

* Make clippy happy

* Make clippy happy

* Added comments.
Fixed bug with size of the `Transaciton`

* Added static offset methods for fields that supports it.
Implemented `Default` for `Script`.
Made checked metadata public.
Made `Stage` also public to allow writing a generic code.
Added input argument to `ConsensusParameters::tx_offset` to highlight breaking work with offsets.

* Add support of metadata for offsets

* Added check for `serialized_size`

* Fix build for all platforms

* Added some help functions after integration with `fuel-core`

* Added some help functions after integration with `fuel-core`

* Fix CI

* Highlight that buffer is read here

* Added explicit `discriminant` to `Create` and `Script`

* Fix compilation with `vec`

* Added two helper functions to simplify tests in the `fuel-core`

* Removed `Stage` from the `Checked`, replaced with enum.

* Forgot about `finalize_checked_stateless`

* Removed `discriminant` field after discussion in the PR

* Replaced enum with bitmask. The basic checks it a minimal way to create a `Checked` transaction.

* Make clippy happy

* Private `new`

* Added `Mint` transaction without tests

* Added tests for `Mint`

* Move `TxPointer` to the root, because can be compiled with `alloc`

* Fix compilation erros

* Swap methods to minimize number of changes

* Remove TODO, because it is resovled
@mitchmindtree mitchmindtree added the fuel-vm Related to the `fuel-vm` crate. label Dec 9, 2022
xgreenx added a commit that referenced this pull request Dec 20, 2022
* Moved anonymous structures from `Transaction` to own types  `Script` and `Create`.

Moved all getters from `Transaction` to `Create` and `Script`.

Splitted the previous logic of the transaction into traits and implemented traits for `Create` and `Script`.

Adapted tests to use generic code or code with exactly expected types.

Prepared the code to easily integrate a new `Mint` transaction.

TODO: Add support of metadata

* Fixed the build for different targets

* Make clippy happy

* Add some comments

* Renamed `Validatable` into `Checkable` and all `validate` into `check`
Re-worked `CheckedTransaction`. Introduced a new `Checked` wrapper that allows to wrap any data in generic way.
Added covertion to "checked" enum for `Transaction`

* Make CI happy

* Make clippy happy

* Make clippy happy

* Added comments.
Fixed bug with size of the `Transaciton`

* Added static offset methods for fields that supports it.
Implemented `Default` for `Script`.
Made checked metadata public.
Made `Stage` also public to allow writing a generic code.
Added input argument to `ConsensusParameters::tx_offset` to highlight breaking work with offsets.

* Add support of metadata for offsets

* Added check for `serialized_size`

* Fix build for all platforms

* Added some help functions after integration with `fuel-core`

* Added some help functions after integration with `fuel-core`

* Fix CI

* Highlight that buffer is read here

* Added explicit `discriminant` to `Create` and `Script`

* Fix compilation with `vec`

* Added two helper functions to simplify tests in the `fuel-core`

* Removed `Stage` from the `Checked`, replaced with enum.

* Forgot about `finalize_checked_stateless`

* Removed `discriminant` field after discussion in the PR

* Replaced enum with bitmask. The basic checks it a minimal way to create a `Checked` transaction.

* Make clippy happy

* Private `new`

* Added `Mint` transaction without tests

* Added tests for `Mint`

* Move `TxPointer` to the root, because can be compiled with `alloc`

* Fix compilation erros

* Swap methods to minimize number of changes

* Remove TODO, because it is resovled
xgreenx added a commit that referenced this pull request Dec 20, 2022
* Moved anonymous structures from `Transaction` to own types  `Script` and `Create`.

Moved all getters from `Transaction` to `Create` and `Script`.

Splitted the previous logic of the transaction into traits and implemented traits for `Create` and `Script`.

Adapted tests to use generic code or code with exactly expected types.

Prepared the code to easily integrate a new `Mint` transaction.

TODO: Add support of metadata

* Fixed the build for different targets

* Make clippy happy

* Add some comments

* Renamed `Validatable` into `Checkable` and all `validate` into `check`
Re-worked `CheckedTransaction`. Introduced a new `Checked` wrapper that allows to wrap any data in generic way.
Added covertion to "checked" enum for `Transaction`

* Make CI happy

* Make clippy happy

* Make clippy happy

* Added comments.
Fixed bug with size of the `Transaciton`

* Added static offset methods for fields that supports it.
Implemented `Default` for `Script`.
Made checked metadata public.
Made `Stage` also public to allow writing a generic code.
Added input argument to `ConsensusParameters::tx_offset` to highlight breaking work with offsets.

* Add support of metadata for offsets

* Added check for `serialized_size`

* Fix build for all platforms

* Added some help functions after integration with `fuel-core`

* Added some help functions after integration with `fuel-core`

* Fix CI

* Highlight that buffer is read here

* Added explicit `discriminant` to `Create` and `Script`

* Fix compilation with `vec`

* Added two helper functions to simplify tests in the `fuel-core`

* Removed `Stage` from the `Checked`, replaced with enum.

* Forgot about `finalize_checked_stateless`

* Removed `discriminant` field after discussion in the PR

* Replaced enum with bitmask. The basic checks it a minimal way to create a `Checked` transaction.

* Make clippy happy

* Private `new`

* Added `Mint` transaction without tests

* Added tests for `Mint`

* Move `TxPointer` to the root, because can be compiled with `alloc`

* Fix compilation erros

* Swap methods to minimize number of changes

* Remove TODO, because it is resovled
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fuel-vm Related to the `fuel-vm` crate.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test Arithemetic Overflow Exceptions in Blockchain.rs
5 participants