smplx-build: fix witness type conversion in single-valued either type#51
Merged
smplx-build: fix witness type conversion in single-valued either type#51
Conversation
Collaborator
|
Looks good! Let's fix other incompatibility issues here as well. |
7b26939 to
1afe52c
Compare
* add one more contract to ui tests
* add additional test cases * add line breaks at the end of the *.simf files
* functions: generate_inline_array_element_extraction(), generate_inline_list_element_extraction(), generate_inline_tuple_element_extraction(), generate_inline_either_extraction() * duplicated logic in generate_from_value_extraction()
2a4d5ad to
a9871b0
Compare
Arvolear
added a commit
that referenced
this pull request
Apr 23, 2026
* generate a new block in the end of prepare_signer() (#44) * Sdk unit tests (#43) * unit tests for `extract_pst` * unit test for program's `get_env()` * quick cleanup --------- Co-authored-by: Artem Chystiakov <artem.ch31@gmail.com> * Add basic storage support (#46) * Add basic ProgramStorage implementation * Remove unnecessary ProgramStorage struct * Rename set function * Fix example * Feat/reissuance (#50) * reissuance support * reissuance interface fix * Nested witness signature path injection (#45) * add nested sig parser * wip: add support for tuple and array paths * wip: store changes * fix tests and few docs * refactor injecting functions into structure * add either consistency check and unit tests * refactor --------- Co-authored-by: Artem Chystiakov <artem.ch31@gmail.com> * Add `RequiredSignature` constructor (#52) * add constructor to improve test readability * submit review suggestion * add the auth and ports config support for the project manifest (#54) * smplx-build: fix witness type conversion in single-valued either type (#51) * smplx-build: fix witness type conversion in single-valued either type * add one more contract to ui tests * smplx-build: add support for u1, u2, u4 and List types * add additional test cases * add line breaks at the end of the *.simf files * smplx-build: remove duplicated logic and functions * functions: generate_inline_array_element_extraction(), generate_inline_list_element_extraction(), generate_inline_tuple_element_extraction(), generate_inline_either_extraction() * duplicated logic in generate_from_value_extraction() * typos: add delimiters * Tiny functions (#57) * some tiny functions * allow sad flow tests * metadata output * fix: `simplex test` runs non-simplex test when no args provided (#56) * invoke smplx tests by suffix when no args provided * separate name filtering and integration tests * refactor --------- Co-authored-by: Artem Chystiakov <artem.ch31@gmail.com> * changelog * version --------- Co-authored-by: Ruslan Kasheparov <55411970+RuslanProgrammer@users.noreply.github.com> Co-authored-by: Vitaliy Volovyk <161724671+topologoanatom@users.noreply.github.com> Co-authored-by: Oleh Komendant <44612825+Hrom131@users.noreply.github.com> Co-authored-by: Ivan Lele <110336129+ivanlele@users.noreply.github.com> Co-authored-by: Illia Kripaka <30872146+ikripaka@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
include_simf!macro when handling single-valuedEitherorOptiontypes in the Simplicity contract.include_simf!was incorrectly generating references for nested values in Option and Either<T, U>. After expansion, the generated code was failing because it passed&Tvalue toValue::frominstead of the ownedTtype.This PR updated the macro to generate explicit dereferences
*inner_val, correctly passing the underlying values.Why this approach?
We can solve this issue without changing the interface in different ways
1) invoke .to_owned() on each path
caveats: double cloning
2) remove references on each match
match &val {}->match val {}caveats: possible redundant object copying
3) include explicit dereference in needed places
By far, this is the most efficient way to fix the issue, as it avoids unnecessary types copying.