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

serialization: free function DSL #9195

Merged

Conversation

jeffro256
Copy link
Contributor

Upstreaming UkoeHB#32

@jeffro256 jeffro256 changed the title free function serialization DSL serialization: free function DSL Feb 21, 2024
jeffro256 added a commit to jeffro256/monero that referenced this pull request Feb 21, 2024
Use free functions to do serialization in-place. Simplifies code,
reduces binary size, and reduces copying.

Depends on monero-project#9195 and
monero-project#9194
Copy link
Collaborator

@0xFFFC0000 0xFFFC0000 left a comment

Choose a reason for hiding this comment

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

LGTM.

If you add a comment to your PR first post with an example, that would make it much better. I followed the discussion in Koe's repo, and these comments [1] look nice. Maybe a shorter version of these comments, in the commit message or your PR page would improve it.

The case I am thinking about is: that later when someone runs a git-blame or looks at this PR page, comments/explanations should be obvious.

  1. free function serialization DSL UkoeHB/monero#32 (comment)

Example usage for Seraphis types (in global or `sp` namespace):

```
BEGIN_SERIALIZE_OBJECT_FN(sp::SpCoinbaseEnoteCore)
    FIELD_F(onetime_address)
    VARINT_FIELD_F(amount)
END_SERIALIZE()

BEGIN_SERIALIZE_OBJECT_FN(sp::SpEnoteCore)
    FIELD_F(onetime_address)
    FIELD_F(amount_commitment)
END_SERIALIZE()
```
jeffro256 added a commit to jeffro256/monero that referenced this pull request Feb 29, 2024
Use free functions to do serialization in-place. Simplifies code,
reduces binary size, and reduces copying.

Depends on monero-project#9195 and
monero-project#9194
jeffro256 added a commit to jeffro256/monero that referenced this pull request Mar 2, 2024
Okay I promise after this and the BulletproofPlus2Proof PR I'll stop bitching
about the tx class format.

* Replace `rct::clsag` with `LegacyClsagProof`, which is `rct::clsag` without `I` field
* Remove bin config fields and generator seed from `SpMembershipProofV1`
* Add `SemanticConfigSpRefSetV1 get_sp_ref_set_config(tx_version_t)` method to `TxValidationContext`
* Add `validate_tx_sp_ref_set_semantics` validator impl free function
* Add `tx_version_from(const SpTxType&)` validator impl free function
* Make `TxValidationContextMock` bound to a specific `SemanticConfigSpRefSetV1`
* Direct serialization

Depends on monero-project#9195 and
monero-project#9194
jeffro256 added a commit to jeffro256/monero that referenced this pull request Mar 4, 2024
Okay I promise after this and the BulletproofPlus2Proof PR I'll stop bitching
about the tx class format.

* Replace `rct::clsag` with `LegacyClsagProof`, which is `rct::clsag` without `I` field
* Remove bin config fields and generator seed from `SpMembershipProofV1`
* Add `SemanticConfigSpRefSetV1 get_sp_ref_set_config(tx_version_t)` method to `TxValidationContext`
* Add `validate_tx_sp_ref_set_semantics` validator impl free function
* Add `tx_version_from(const SpTxType&)` validator impl free function
* Make `TxValidationContextMock` bound to a specific `SemanticConfigSpRefSetV1`
* Direct serialization

Depends on monero-project#9195 and
monero-project#9194
jeffro256 added a commit to jeffro256/monero that referenced this pull request Mar 7, 2024
Okay I promise after this and the BulletproofPlus2Proof PR I'll stop bitching
about the tx class format.

* Replace `rct::clsag` with `LegacyClsagProof`, which is `rct::clsag` without `I` field
* Remove bin config fields and generator seed from `SpMembershipProofV1`
* Add `SemanticConfigSpRefSetV1 get_sp_ref_set_config(tx_version_t)` method to `TxValidationContext`
* Add `validate_tx_sp_ref_set_semantics` validator impl free function
* Add `tx_version_from(const SpTxType&)` validator impl free function
* Make `TxValidationContextMock` bound to a specific `SemanticConfigSpRefSetV1`
* Direct serialization

Depends on monero-project#9195 and
monero-project#9194
@luigi1111 luigi1111 merged commit 6ade592 into monero-project:master Mar 8, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants