Skip to content

Direct block body rlp class. #8528

Open
@asdacap

Description

@asdacap

Is your feature request related to a problem? Please describe.

  • Block decoding is so inefficient that doing something like this actually notably improve era import/export.
            int sequenceLength = decoderContext.ReadSequenceLength();

            if (!decoderContext.ShouldSliceMemory)
            {
                byte[] memory = new byte[sequenceLength];
                decoderContext = new Rlp.ValueDecoderContext(memory, sliceMemory: true);
            }

            int blockCheck = decoderContext.Position + sequenceLength;

Describe the solution you'd like

  • There should be a class that completely skip decoding the tx's which as far as sync and era/import is concern only need to be re-hashed to calculate tx root.
  • This class should use pooled memory and implement IDisposable and replace OwnedBlockBodies.
  • Additionally, serving/downloading probably could be better done by using the bodies's byte array directly.
  • Note: BlockStore currently store Block, not BlockBody, although it should be relatively easy to decode just the body.

Describe alternatives you've considered

  • Do nothing.

Additional context

  • Era import although local is actually slightly slower than downloading on a fast internet.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions