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

Ssz encoding generator #7299

Merged
merged 344 commits into from
Jan 7, 2025
Merged

Ssz encoding generator #7299

merged 344 commits into from
Jan 7, 2025

Conversation

flcl42
Copy link
Contributor

@flcl42 flcl42 commented Jul 31, 2024

Changes

  • Adds ssz generator that supports all stuff except stable containers

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Base automatically changed from feature/gnosis-shutter to master October 4, 2024 12:29
@Marchhill Marchhill requested a review from a team as a code owner October 4, 2024 12:29
@flcl42 flcl42 requested a review from emlautarom1 December 26, 2024 21:01
@flcl42 flcl42 force-pushed the feature/ssz-generator branch from c0d80fc to 8155d1e Compare December 27, 2024 17:10
public void Feed(IReadOnlyList<ulong> value, ulong maxLength)
{
// TODO: If UInt256 is the correct memory layout
UInt256[] subRoots = new UInt256[value.Count];
Copy link
Member

Choose a reason for hiding this comment

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

ArrayPoolList?

Copy link
Contributor Author

@flcl42 flcl42 Jan 3, 2025

Choose a reason for hiding this comment

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

ArrayPoolList seems a bit too complex for such task. Mind we add something like

public struct ArrayPoolSpan<T>(ArrayPool<T> arrayPool, int length) : IDisposable
{
    private readonly T[] _array = arrayPool.Rent(length);
    private readonly int _length = length;

    public ArrayPoolSpan(int length) : this(ArrayPool<T>.Shared, length) { }

    public readonly ref T this[int index] => ref _array[index];

    public static implicit operator Span<T>(ArrayPoolSpan<T> self) => self._array.AsSpan(0, self._length);
    public static implicit operator ReadOnlySpan<T>(ArrayPoolSpan<T> self) => self._array.AsSpan(0, self._length);

    public readonly void Dispose() => arrayPool.Return(_array);
}

?

@flcl42 flcl42 requested a review from rubo January 6, 2025 09:15
Copy link
Contributor

@emlautarom1 emlautarom1 left a comment

Choose a reason for hiding this comment

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

LGTM. The source generator part looks quite tricky and I think very few people will want to work on it in case there are issues but I don't see any easy way to make them more "maintainable".

I'll most likely copy the Diagnostics code into the proposed RLP PR.

@flcl42 flcl42 merged commit 2ec85dc into master Jan 7, 2025
79 checks passed
@flcl42 flcl42 deleted the feature/ssz-generator branch January 7, 2025 15:32
rjnrohit pushed a commit that referenced this pull request Jan 11, 2025
Co-authored-by: Marc Harvey-Hill <[email protected]>
Co-authored-by: LLHOYH <[email protected]>
Co-authored-by: ak88 <[email protected]>
Co-authored-by: Lukasz Rozmej <[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.

7 participants