-
Notifications
You must be signed in to change notification settings - Fork 35
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
Fix for initialization and finalization sections #1657
Fix for initialization and finalization sections #1657
Conversation
lorenzogentile404
commented
Dec 13, 2024
•
edited
Loading
edited
- spec: Initialization section fix linea-specification#11
- constraints: Implementation of TX_INIT and TX_FINL fix linea-constraints#517.
this.addFragments( | ||
ImcFragment.forTxInit(hub), ContextFragment.initializeExecutionContext(hub), txFragment); | ||
|
||
boolean isRevertedTransaction = false; // TODO: how to get this? |
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.
You have to defer to post transaction to finish the initialization section.
@Getter private final AccountSnapshot senderAfterPayingForTransaction; | ||
@Getter private final AccountSnapshot senderAfterPayingForGas; | ||
@Getter private final AccountSnapshot senderAfterPayingForValue; | ||
@Getter private final AccountSnapshot senderAfterPayingForGasAndValue; |
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.
I would suggest, for the sheer purpose of readability, to have the following snapshots be part of the class definition
private final AccountSnapshot senderGasPayment
private final AccountSnapshot senderGasPaymentNew
private final AccountSnapshot senderValueTransfer
private final AccountSnapshot senderValueTransferNew
private final AccountSnapshot recipientValueReception
private final AccountSnapshot recipientValueReceptionNew
private AccountSnapshot senderUndoingValueTransfer
private AccountSnapshot senderUndoingValueTransferNew
private AccountSnapshot recipientUndoingValueReception
private AccountSnapshot recipientUndoingValueReceptionNew
I've started explicitly introducing all required AccountSnapshot
's as it became unmanageable otherwise in other sections (CallSection
or CreateSection
for instance.) As we handle a couple of hundred transactions total at a time max this isn't too much of an imposition on memory etc. And it makes intent more clear.
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.
Do we actually need all of them? senderGasPaymentNew
and senderValueTransfer
should be the same. Also, I find clearer the notation "before" and "after". Anyway, let's discuss it tomorrow.
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.
Also, senderValueTransferNew
and senderUndoingValueTransfer
, recipientValueReceptionNew
and recipientUndoingValueReception
should be the same.
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.
Note: whenever variables represent the same thing, create a deep copy of the underlying objects.
@@ -37,7 +37,9 @@ | |||
|
|||
public class TxInitializationSection extends TraceSection { |
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.
This has to implements PostTransactionDefer
or whatever it's called.
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.
For this it would be ideal if we could get access to the refunded gas from Besu directly. I'm not sure we have it available here, or how, but we would need the values that are available here https://github.com/hyperledger/besu/blob/98780efd15ee3223de2c0cf2d144c8aaee30d5db/ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/MainnetTransactionProcessor.java#L502
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.
The outermost frame should give you the refunds I believe, would need to double check it. It also gives you the selfDestructs and you can infer the maths as in the class you posted there.
I don't think you care about code delegation since you are on the London fork
|
This boolean records the warmth of the coinbase address at transaction end. The old way of doing things didn't work with BlockchainReferenceTest_331/randomStatetest643 where sender == coinbase. And likely this would have blown up in general with consistency constraints on.
We now extract the coinbase address from a MessageFrame. This ought to fix an issue with replay tests with a TX_SKIP type of transaction. Indeed, for some reason (maybe related to using clique and this changing the "miner" field of the block header) running block.getCoinbaseAddress() or so returned 0x00 rather than the expected 0x8f8. Also greatly simplified this TraceSection.
also moving address comparison methods from TransactionProcessingMetadata to TxSkipSection
This updates the self-hosted runner instance for the `go-corset-replay-tests` job from `large` to `xxl`. This seems necessary as the large instance appears to be running out of memory.
This also updates the self-hosted runner instance from large to xxl for the `corset-unit-tests`, `go-corset-unit-tests` and the `corset-replay-tests` jobs. Specifically, the unit tests are taking a fair amount of time, so this seems sensible.