-
Notifications
You must be signed in to change notification settings - Fork 488
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
Feature/geth like system tx #7252
Conversation
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
Show resolved
Hide resolved
/// Hacky flag to execution options, to pass information how original validate should behave. | ||
/// Needed to decide if we need to subtract transaction value. | ||
/// </summary> | ||
private const int OriginalValidate = 2 << 30; |
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.
Is it needed? I don't understand the idea
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.
in what conditions value should be subtract in system calls?
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.
estimateGas
src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
Show resolved
Hide resolved
// If sender is SystemUser subtracting value will cause InsufficientBalanceException | ||
if (validate || !tx.IsSystem()) | ||
WorldState.SubtractFromBalance(tx.SenderAddress, tx.Value, spec); | ||
PayValue(tx, spec, opts); |
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.
Can we check NoValidation options in PayValue in SystemTransactionProcessor instead of OriginalValidate?
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.
No, as we force NoValidation
src/Nethermind/Nethermind.Evm/TransactionProcessing/SystemTransactionProcessor.cs
Show resolved
Hide resolved
// Fixes eth_estimateGas. | ||
// If sender is SystemUser subtracting value will cause InsufficientBalanceException | ||
if (validate || !tx.IsSystem()) | ||
WorldState.SubtractFromBalance(tx.SenderAddress, tx.Value, spec); |
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.
OriginalValidate
was introduced due to this condition. For every other condition validation off is equivalent with transaction being system transaction, but for this one condition we need to decouple this logic, and even if it is system transaction validation can be on/off independently, this is used in eth_estimateGas
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.
Ok, thanks. I understand the logic. On the other hand, this logic assumes that there are sysCalls that pay values. Based on my quick check, that’s not the case. In sysCalls, we set Value = 0. This means we could simplify the original check and remove that hacky edge case flag.
So original logic could be:
if (validate && !tx.IsSystem())
then we don't need the OriginalValidate at all
src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
Show resolved
Hide resolved
/// Hacky flag to execution options, to pass information how original validate should behave. | ||
/// Needed to decide if we need to subtract transaction value. | ||
/// </summary> | ||
private const int OriginalValidate = 2 << 30; |
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.
estimateGas
src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
Show resolved
Hide resolved
// If sender is SystemUser subtracting value will cause InsufficientBalanceException | ||
if (validate || !tx.IsSystem()) | ||
WorldState.SubtractFromBalance(tx.SenderAddress, tx.Value, spec); | ||
PayValue(tx, spec, opts); |
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.
No, as we force NoValidation
src/Nethermind/Nethermind.Evm/TransactionProcessing/SystemTransactionProcessor.cs
Show resolved
Hide resolved
@kamilchodola this PR will need a special attention from QA team (pls don't start now, wait for green-light). We will have to test AuRa sys calls. Recommended things:
If we have any working Posdao tests than we could use it, but I guess it's not possible |
Aura failure looks legit (after a number of reruns)
|
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 still do not understand the use of OriginalValidate, is it supposed to be for a case in future where we transfer value in SystemTransaction? because AFAIK we dont do that right now?
src/Nethermind/Nethermind.Consensus/Processing/TransactionProcessorAdapterExtensions.cs
Show resolved
Hide resolved
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.cs
Show resolved
Hide resolved
src/Nethermind/Nethermind.Specs/SystemTransactionReleaseSpec.cs
Outdated
Show resolved
Hide resolved
src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.cs
Outdated
Show resolved
Hide resolved
…ec.IsEip158Enabled
e102b0b
to
cddd937
Compare
Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: Ahmad Bitar <smartprogrammer@windowslive.com>
Co-authored-by: MarekM25 <marekm2504@gmail.com> Co-authored-by: Ahmad Bitar <smartprogrammer@windowslive.com>
Changes
BeaconBlockRootHandler
to use system transactionsTypes of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Sync some Aura chains in archive.
Documentation
Requires documentation update
Requires explanation in Release Notes