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

Implement EIP-7805 (FOCIL) #8003

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft

Implement EIP-7805 (FOCIL) #8003

wants to merge 57 commits into from

Conversation

Marchhill
Copy link
Contributor

@Marchhill Marchhill commented Jan 3, 2025

Changes

  • Implement EIP-7805
  • engine api changes
    • implement engine_getInclusionList
    • add inclusion lists to PayloadAttributes and newPayload parameters
  • validate that valid IL txs were included up to gas limit (see here)
  • use IL in block building

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

Documentation

Requires documentation update

  • Yes
  • No

Requires explanation in Release Notes

  • Yes
  • No

src/Nethermind/Nethermind.Core/Block.cs Outdated Show resolved Hide resolved
{
// todo: limit size of IL?
IEnumerable<Transaction> txs = inclusionListTxSource.GetTransactions(blockTree.Head!.Header, long.MaxValue);
byte[][] txBytes = [.. txs.Select(tx => Rlp.Encode(tx).Bytes)];
Copy link
Member

Choose a reason for hiding this comment

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

We could potentially use ArrayPoolList to avoid allocation, ResultWrapper should Dispose it correctly after being serialized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're returning the bytes I don't see that we can use ArrayPoolList here, maybe I'm missing something?

Copy link
Member

Choose a reason for hiding this comment

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

you can return ArrayPoolList<byte[]>, you could return ArrayPoolList<ArrayPoolList> even.

Also Rlp.Encode is potentially not the best either due to allocations.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I returned this then I would have to have ArrayPoolList<byte[]> as the return value in the engine api signature, this seems wrong to me, you think it's ok?

I don't know of a way to encode without allocating so if I did something like ArrayPoolList<ArrayPoolList<byte>> then I would have to allocate anyway and then use ToPooledList()

continue;
}

bool couldIncludeTx = _transactionProcessor.BuildUp(tx, new(block.Header, spec), NullTxTracer.Instance);
Copy link
Member

Choose a reason for hiding this comment

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

Would be probably good to Snapshot and Revert WorldState?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it needs to be reset as there is this bit in the EIP:

Also note that we do not need to reset the state to S, since the only way for a transaction to alter the state is for it to execute successfully, in which case the block is invalid, and so the block will not be applied to the state.

Also with BuildUp the new state is uncommitted so should be reverted right?

Copy link
Member

Choose a reason for hiding this comment

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

Need to double check. Comment from EIP doesn't have to work well with Nethermind as we have a bit different way of operating on state.

@Marchhill Marchhill marked this pull request as draft February 18, 2025 17:27
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.

3 participants