Skip to content

Lyd/bytes20#482

Merged
SwatiEY merged 14 commits intomasterfrom
lyd/bytes20
Mar 17, 2026
Merged

Lyd/bytes20#482
SwatiEY merged 14 commits intomasterfrom
lyd/bytes20

Conversation

@lydiagarms
Copy link
Collaborator

@lydiagarms lydiagarms commented Mar 9, 2026

Summary

Fixes #441. This PR adds support for public and secret bytes20 variables into Starlight. It also includes several unrelated fixes:

Changes

Bytes20 changes:

  • Turn off unsupported errors for Bytes20.
  • Stop using parseInt on bytes20 in orchestration as this leads to rounding errors.
  • Check bytes20 input to make sure they are in the correct format.
  • In format commitments, treat bytes20 values as ascii or hex(20) depending on whether they are printable. Also treat addresses as hex(32) for better usability.
  • Ensure that public bytes20 variables are passed to the contract in orchestration in the correct format.
  • Update tests and documentation.

Changes unrelated to bytes20:

  • fixes a bug for mappings to structs. The order of parameters to proof generation in orchestration is defined by the order modified in the contract instead of the struct declaration. This means the order is not consistent with the circuit.
  • creates an error message when variable names are used in zolidity contracts that could clash with names in orchestration.
  • fixes an error for structs in orchestration. If the first time a struct is modified it is an assignment, then the initial struct is set to {}, because it will be fully overwritten anyway. However, a property assignment was being treated in the same way and the initial struct set to {}, even though one property was being assigned, and so all other properties were incorrect.
  • Fix a zappify error when .push is used for a public array, the array was being treated as a mapping because we were checking isConstantArray instead of isArray.
  • Fix an orchestration error when public bools are returned. We should filter out public variables from the returns from the orchestration file unless true or false is returned, because they are treated separately in publicReturns. However, boolean variables were not being filtered out, and so were being treated later as secret variables. This meant the commitment value was being returned causing an error.

Checklist

  • Tests added/updated
  • CI passes
  • No secrets/keys committed
  • Docs updated (if needed)
  • Backwards compatible (or noted breaking change)

How to test

Test action-tests/Escrow-refs (specifically transfer) and action-tests/Bytes20.

Screenshots / Evidence (if applicable)

Escrow-refs:
Screenshot 2026-03-11 at 12 34 11

Bytes20:
Screenshot 2026-03-11 at 12 34 45
Screenshot 2026-03-11 at 12 34 57
Screenshot 2026-03-11 at 12 35 08
Screenshot 2026-03-11 at 12 35 21
Screenshot 2026-03-11 at 12 35 36
Screenshot 2026-03-11 at 12 35 51
Screenshot 2026-03-11 at 12 36 05

…ts so that addresses are displayed in hex and bytes20 are displayed in strings
@lydiagarms lydiagarms requested review from SwatiEY and kKahina March 11, 2026 15:50
@lydiagarms lydiagarms marked this pull request as ready for review March 12, 2026 10:09
@kKahina
Copy link
Contributor

kKahina commented Mar 16, 2026

you add a Bytes20 contract, but there is no dedicated callZAppAPIs('Bytes20', ...) flow in apitest.
Current coverage validates transpilation, not end-to-end runtime behavior for bytes20 (API + commitments + backup/retrieval).
Please add a focused integration scenario.

@kKahina
Copy link
Contributor

kKahina commented Mar 16, 2026

this PR only updates STATUS. Please add a README update for bytes20 support

@lydiagarms
Copy link
Collaborator Author

you add a Bytes20 contract, but there is no dedicated callZAppAPIs('Bytes20', ...) flow in apitest. Current coverage validates transpilation, not end-to-end runtime behavior for bytes20 (API + commitments + backup/retrieval). Please add a focused integration scenario.

The two contracts are currently included in test-zappify but not test-zapp. Ideally, we would include them in test-zapp but every contract added to api-test adds significantly to the memory required, which is already close to the limit, and adds time to the testing. This is why only a small group of our test contracts are included in user-friendly-tests (which are tested in test-zapp). Because, Booleans.zol is inside action-tests I felt that this was also appropriate for Bytes20.zol

@lydiagarms
Copy link
Collaborator Author

this PR only updates STATUS. Please add a README update for bytes20 support

I don't think supported variable types are explicitly discussed in README, instead there is a link to STATUS,

@kKahina
Copy link
Contributor

kKahina commented Mar 17, 2026

you add a Bytes20 contract, but there is no dedicated callZAppAPIs('Bytes20', ...) flow in apitest. Current coverage validates transpilation, not end-to-end runtime behavior for bytes20 (API + commitments + backup/retrieval). Please add a focused integration scenario.

The two contracts are currently included in test-zappify but not test-zapp. Ideally, we would include them in test-zapp but every contract added to api-test adds significantly to the memory required, which is already close to the limit, and adds time to the testing. This is why only a small group of our test contracts are included in user-friendly-tests (which are tested in test-zapp). Because, Booleans.zol is inside action-tests I felt that this was also appropriate for Bytes20.zol

agreed on the test-zapp memory/time constraints. I’m not asking to move Bytes20 into test-zapp. My concern is specifically that we still don’t have a dedicated runtime E2E flow for Bytes20 in apitest via callZAppAPIs('Bytes20', ...); right now coverage appears mostly transpilation-level. Could you add that focused scenario in test-zappify/action-tests so we also validate real API behavior plus commitment persistence and backup/retrieval for bytes20

@kKahina kKahina self-requested a review March 17, 2026 15:57
Copy link
Contributor

@kKahina kKahina left a comment

Choose a reason for hiding this comment

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

Good

Copy link
Contributor

@SwatiEY SwatiEY 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 thanks for screenshots

@SwatiEY SwatiEY merged commit c554c1d into master Mar 17, 2026
4 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.10.6 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support secret bytes20

3 participants