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

Change the type of the error code of u32assert2 operation from Felt to u32 #1382

Merged

Conversation

Fumuran
Copy link
Contributor

@Fumuran Fumuran commented Jul 8, 2024

This small PR changes the internal value type (type of error code) of the u32assert2 operation from Felt to u32.

Related issue: #1381

@Fumuran Fumuran linked an issue Jul 8, 2024 that may be closed by this pull request
@bobbinth bobbinth requested a review from plafer July 8, 2024 17:07
Copy link
Contributor

@bobbinth bobbinth 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! Thank you!

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

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

LGTM

@plafer plafer merged commit 8cb3462 into plafer-mast-forest-serialization Jul 10, 2024
15 checks passed
@plafer plafer deleted the andrew-change-error-code-type branch July 10, 2024 12:32
@plafer plafer mentioned this pull request Jul 10, 2024
plafer added a commit that referenced this pull request Jul 17, 2024
* Introduce `ExternalNode`

* Replace `Assembler.node_id_by_digest` map

* add TODOP

* Add `Host::get_mast_forest`

* Move kernel and entrypoint out of `MastForest`

* Remove ProgramError

* docs

* cleanup Program constructors

* fix docs

* Make `Program.kernel` an `Arc`

* fix executable

* invoke_mast_root: fix external node creation logic

* add failing test

* don't make root in `combine_mast_node_ids` and `compile_body`

* fix External docs

* fmt

* fix `entrypoint` doc

* Rename `Program::new_with_kernel()`

* Document `MastForestStore` and `MemMastForestStore`

* fix syscall

* execute_* functions: use `MastForest`

* `Program`: Remove `Arc` around kernel

* remove `Arc` around `MastForest` in `Program`

* Return error on malformed host

* Simplify `DefaultHost`

* `MastForest::add_node()`: add docs

* fmt

* add failing `duplicate_procedure()` test

* Introduce `MastForestBuilder`

* Rename `mod tests` -> `testing`

* add `duplicate_node()` test

* changelog

* Program: use `assert!()` instead of `debug_assert!()`

* `MastForest::make_root()`: add assert

* fmt

* Serialization for `MastNodeId`

* serialization for MastNode variants except basic block

* MastForest serialization scaffolding

* define `MastNodeType` constructor from `MastNode`

* test join serialization of MastNodeType

* `MastNodeType` serialization of split

* Revert "serialization for MastNode variants except basic block"

This reverts commit efc24fd.

* add TODOP

* impl Deserializable for `MastForest` (scaffold)

* mast_node_to_info() scaffold

* try_info_to_mast_node scaffold

* Rename `EncodedMastNodeType`

* add info module

* encode operations into `data` field

* decode operations

* implement `BasicBlockNode::num_operations_and_decorators()`

* OperationOrDecoratorIterator

* basic block node: move tests in new file

* operation_or_decorator_iterator test

* Implement `Operation::with_opcode_and_data()`

* encode decorators

* implement `decode_decorator()`

* fix exec invocation

* no else blk special case

* add procedure roots comment

* implement forgotten `todo!()`

* `serialize_deserialize_all_nodes` test

* `decode_operations_and_decorators`: fix bit check

* confirm_assumptions test scaffold

* minor  adjustments

* Introduce `StringTableBuilder`

* naming

* test confirm_operation_and_decorator_structure

* remove TODOP

* remove unused `MastNode::new_dyncall()`

* Remove `Error` type

* add TODOP

* complete test `serialize_deserialize_all_nodes`

* check digest on deserialization

* remove TODOP

* safely decode mast node ids

* use method syntax in `MastNodeType` decoding

* TODOPs

* rewrite <= expression

* new `MastNodeType`

* implement `Deserializable` for `MastNodeType`

* migrate tests to new

* Use new MastNodeType

* rename string_table_builder_ module

* implement `BasicBlockDataBuilder`

* add TODOP

* BasicBlockDataDecoder

* use `BasicBlockDataDecoder`

* add headers

* add `MastNodeInfo` method

* return `Result` instead of `Option`

* Remove TODOP

* docs

* chore: add section separators and fix typos

* refactor: change type of the error code of u32assert2 from Felt to u32 (#1382)

* impl `Serializable` for `Operation`

* impl Deserializable for `Operation`

* `StringTableBuilder`: switch to using blake 3

* `EncodedDecoratorVariant`: moved discriminant bit logic to `discriminant()` method

* Remove basic block offset

* Cargo: don't specify patch versions

* make deserialization more efficient

* num-traits and num-derive: set default-features false

* Remove `OperationData`

* `StringRef`: move string length to data buffer

* store offset in block

* Use `source.read_u32/u64()`

* Update `MastNodeInfo` docstring

* rename arguments in `encode_u32_pair`

* Use basic block offset in deserialization

* `BasicBlockDataDecoder`: use `ByteReader::read_u16/32()` methods

* `StringTableBuilder`: fix comment

* Remove `StringRef` in favor of `DataOffset`

* cleanup `MastNodeType` serialization

* derive `Copy` for `MastNodeType`

* `MastNodeType` tests

* add `MastNodeType` tests

* use assert

* fix asserts

* changelog

* fix docs

---------

Co-authored-by: Bobbin Threadbare <[email protected]>
Co-authored-by: Andrey Khmuro <[email protected]>
plafer added a commit that referenced this pull request Jul 29, 2024
* Introduce `ExternalNode`

* Replace `Assembler.node_id_by_digest` map

* add TODOP

* Add `Host::get_mast_forest`

* Move kernel and entrypoint out of `MastForest`

* Remove ProgramError

* docs

* cleanup Program constructors

* fix docs

* Make `Program.kernel` an `Arc`

* fix executable

* invoke_mast_root: fix external node creation logic

* add failing test

* don't make root in `combine_mast_node_ids` and `compile_body`

* fix External docs

* fmt

* fix `entrypoint` doc

* Rename `Program::new_with_kernel()`

* Document `MastForestStore` and `MemMastForestStore`

* fix syscall

* execute_* functions: use `MastForest`

* `Program`: Remove `Arc` around kernel

* remove `Arc` around `MastForest` in `Program`

* Return error on malformed host

* Simplify `DefaultHost`

* `MastForest::add_node()`: add docs

* fmt

* add failing `duplicate_procedure()` test

* Introduce `MastForestBuilder`

* Rename `mod tests` -> `testing`

* add `duplicate_node()` test

* changelog

* Program: use `assert!()` instead of `debug_assert!()`

* `MastForest::make_root()`: add assert

* fmt

* Serialization for `MastNodeId`

* serialization for MastNode variants except basic block

* MastForest serialization scaffolding

* define `MastNodeType` constructor from `MastNode`

* test join serialization of MastNodeType

* `MastNodeType` serialization of split

* Revert "serialization for MastNode variants except basic block"

This reverts commit efc24fd.

* add TODOP

* impl Deserializable for `MastForest` (scaffold)

* mast_node_to_info() scaffold

* try_info_to_mast_node scaffold

* Rename `EncodedMastNodeType`

* add info module

* encode operations into `data` field

* decode operations

* implement `BasicBlockNode::num_operations_and_decorators()`

* OperationOrDecoratorIterator

* basic block node: move tests in new file

* operation_or_decorator_iterator test

* Implement `Operation::with_opcode_and_data()`

* encode decorators

* implement `decode_decorator()`

* fix exec invocation

* no else blk special case

* add procedure roots comment

* implement forgotten `todo!()`

* `serialize_deserialize_all_nodes` test

* `decode_operations_and_decorators`: fix bit check

* confirm_assumptions test scaffold

* minor  adjustments

* Introduce `StringTableBuilder`

* naming

* test confirm_operation_and_decorator_structure

* remove TODOP

* remove unused `MastNode::new_dyncall()`

* Remove `Error` type

* add TODOP

* complete test `serialize_deserialize_all_nodes`

* check digest on deserialization

* remove TODOP

* safely decode mast node ids

* use method syntax in `MastNodeType` decoding

* TODOPs

* rewrite <= expression

* new `MastNodeType`

* implement `Deserializable` for `MastNodeType`

* migrate tests to new

* Use new MastNodeType

* rename string_table_builder_ module

* implement `BasicBlockDataBuilder`

* add TODOP

* BasicBlockDataDecoder

* use `BasicBlockDataDecoder`

* add headers

* add `MastNodeInfo` method

* return `Result` instead of `Option`

* Remove TODOP

* docs

* chore: add section separators and fix typos

* refactor: change type of the error code of u32assert2 from Felt to u32 (#1382)

* impl `Serializable` for `Operation`

* impl Deserializable for `Operation`

* `StringTableBuilder`: switch to using blake 3

* `EncodedDecoratorVariant`: moved discriminant bit logic to `discriminant()` method

* Remove basic block offset

* Cargo: don't specify patch versions

* make deserialization more efficient

* num-traits and num-derive: set default-features false

* Remove `OperationData`

* `StringRef`: move string length to data buffer

* store offset in block

* Use `source.read_u32/u64()`

* Update `MastNodeInfo` docstring

* rename arguments in `encode_u32_pair`

* Use basic block offset in deserialization

* `BasicBlockDataDecoder`: use `ByteReader::read_u16/32()` methods

* `StringTableBuilder`: fix comment

* Remove `StringRef` in favor of `DataOffset`

* cleanup `MastNodeType` serialization

* derive `Copy` for `MastNodeType`

* `MastNodeType` tests

* add `MastNodeType` tests

* use assert

* fix asserts

* `ModuleGraph::recompute()` reverse edge caller/callee

* Implement `Assembler::assemble_library()`

* changelog

* fix docs

* Introduce `CompiledFQDN`

* Introduce `WrapperModule` to module graph

* split `ModuleGraph::add_module()`

* fix compile errors from API changes

* fix debug structs

* fix `Assembler::get_module_exports()`

* fix `process_graph_worklist`

* fix procedure

* fix `NameResolver`

* move `CompiledModule`

* `CompiledLibrary::into_compiled_modules`

* `Assembler::add_compiled_library()`

* changelog

* fix `assemble_library()` signature

* test `compiled_library()`

* nits

* register mast roots in `Assembler::add_compiled_library()`

* fix resolve

* `ModuleGraph::topological_sort_from_root`: only include AST procedures

* `Assembler::resolve_target()`: look for digest in module graph first

* remove `AssemblyContext::allow_phantom_calls` flag

* remove TODOP

* `ResolvedProcedure` is no longer `Spanned`

* improve test

* remove TODOP

* `CompiledProcedure` -> `ProcedureInfo`

* Document `CompiledLibrary`

* Rename `CompiledModule` -> `ModuleInfo`

* Refactor `ModuleInfo`

* `ModuleWrapper` -> `WrappedModule`

* Document `PendingModuleWrapper`

* document `Assembler::assemble_library()`

* fix TODOP

* rename

* fix test

* cleanup `ModuleGraph::topological_sort_from_root`

* fix CI

* re-implement `Spanned` for `ResolvedProcedure`

* reintroduce proper error message

* remove unused methods

* Remove all `allow(unused)` methods

* Document `unwrap_ast()` call

* `NameResolver`: remove use of `unwrap_ast()`

* Document or remove all calls to `WrappedModule.unwrap_ast()`

* rename `PendingWrappedModule`

* Add `ModuleGraph::add_compiled_modules()`

* Remove `ModuleGraph::add_module_info()`

* refactor: remove Assembler::compile_program() internal method

* refactor: remove Assembler::assemble_with_options() internal method

---------

Co-authored-by: Bobbin Threadbare <[email protected]>
Co-authored-by: Andrey Khmuro <[email protected]>
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.

Change u32assert2 error code type to u32
3 participants