Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Unified outputs #53

Closed
wants to merge 4 commits into from
Closed

Unified outputs #53

wants to merge 4 commits into from

Conversation

guidanoli
Copy link
Contributor

@guidanoli guidanoli commented May 24, 2023

No description provided.

@guidanoli guidanoli added feature New feature or request onchain Related to the onchain code labels May 24, 2023
@guidanoli guidanoli self-assigned this May 24, 2023
@guidanoli guidanoli force-pushed the feature/output-unification branch from 4d7c48c to 5971063 Compare May 24, 2023 00:55
@gligneul gligneul changed the base branch from next to main May 25, 2023 14:26
@guidanoli guidanoli force-pushed the feature/output-unification branch from 5971063 to bd08bc9 Compare June 19, 2023 15:35
@guidanoli guidanoli force-pushed the feature/output-unification branch from bd08bc9 to 8a0b258 Compare July 18, 2023 18:01
@guidanoli guidanoli changed the base branch from main to feature/unify-proof-libraries July 18, 2023 18:01
Base automatically changed from feature/unify-proof-libraries to main July 21, 2023 20:46
@guidanoli guidanoli force-pushed the feature/output-unification branch from 8a0b258 to f954082 Compare July 24, 2023 15:40
BREAKING CHANGE: This commit removes constants
`VOUCHER_METADATA_LOG2_SIZE`, `NOTICE_METADATA_LOG2_SIZE`,
`EPOCH_VOUCHER_LOG2_SIZE`, and `EPOCH_NOTICE_LOG2_SIZE` from the
`CanonicalMachine` library; and parameters `outputEpochLog2Size` and
`outputHashesLog2Size` from the `validateEncodedOutput` function in
`LibOutputValidation`.
* Outputs are now encoded like Solidity function calls.
  Notices are like function calls to `Notice(bytes)`,
  and vouchers, to `Voucher(address,bytes)`.

BREAKING CHANGE: Changes the encoding of outputs.
* The epoch hash used to be composed by three Merkle trees: one for the
  vouchers generated in the epoch, another for the notices generated in
  the epoch, and a third one for the machine address space as a whole.
  This commit unifies vouchers and notices in the same Merkle tree,
  making the epoch hash composed now of only two Merkle trees: one for
  the outputs generated in the epoch, and another for the machine.

* The leaves of this new tree represent any type of output: voucher,
  notice, or any other output that we might come up with in the future.
  Their binary representations are disjoint because of a 4-byte header.

* This unification greatly simplifies the output validation algorithm,
  and removes a 256-bit field from the `OutputValidityProof` struct.

* Add text to `LibOutputValidation` that explains how the epoch hash
  is calculated, with the help of an ASCII diagram

BREAKING CHANGE: Removes fields `vouchersEpochRootHash` and
`noticesEpochRootHash` from the `OutputValidityProof` struct, and adds
`outputsEpochRootHash`. Changes the epoch hash calculation.
* In order to test the changes made to the output validation
  library, a workaround was implemented that uses the notice tree as
  the output tree for the new algorithm. This workaround is temporary
  and should be replaced when a new version of the echo machine is made
  available.
@guidanoli guidanoli force-pushed the feature/output-unification branch from f954082 to 93bbd02 Compare August 16, 2023 16:56
@guidanoli
Copy link
Contributor Author

Rebased.

@guidanoli
Copy link
Contributor Author

This PR has been migrated to cartesi/rollups-contracts#43.

@guidanoli guidanoli closed this Aug 28, 2023
@guidanoli guidanoli deleted the feature/output-unification branch August 28, 2023 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request onchain Related to the onchain code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant