-
Notifications
You must be signed in to change notification settings - Fork 498
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
Ssz encoding generator #7299
Conversation
…Eth/nethermind into feature/ssz-generator
c0d80fc
to
8155d1e
Compare
public void Feed(IReadOnlyList<ulong> value, ulong maxLength) | ||
{ | ||
// TODO: If UInt256 is the correct memory layout | ||
UInt256[] subRoots = new UInt256[value.Count]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayPoolList?
There was a problem hiding this comment.
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);
}
?
There was a problem hiding this 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.
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]>
Changes
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?