-
Notifications
You must be signed in to change notification settings - Fork 530
eip 7840 implementation #7964
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
eip 7840 implementation #7964
Changes from 6 commits
c38a641
10342cc
5ef5d36
6f45bc6
0035b43
d68374c
b668cdf
eb77784
b8bef08
7059480
b638d63
0d5a076
91f1b1f
e494aa9
44481ba
05772a0
b6b50b7
09a914d
1d271bd
87acb12
0aa4346
87fc57d
f28e72a
8804ccd
8c1c6f3
d9d60ab
6058cb1
78b9e33
22b7d1d
4fbd890
6952229
5b4c0d1
cb445ee
e181b43
43e1655
0c309ea
c2737fc
362f18c
2f1f6f2
43bda5a
1ecf556
3872a10
cc5c798
58a3ff9
a528f1e
e8e760d
28614f1
6886c52
1286aea
64dd8ab
38202ee
b95ac18
0a4dbd2
f36e6c4
78910ec
b288921
340cafa
0d3712e
d1283aa
e7c94c1
52b679a
c1879a6
4cd4a45
812d7bd
8f96e97
62f5b68
2f2cc87
25a9832
06b2117
eeab3c1
6918f86
efd377a
389f8ca
f343cb1
428e98f
e96564a
76159e3
ae96e22
255ec4f
16e9e0d
fe89802
fe59bdf
9696cf1
1ad0ea8
d8c00fd
7cd8d85
9ee577d
709e94f
bace0c3
64ed1dc
5aa531c
8441be2
f74738a
44d4ef3
30a6bd7
e3b52cd
06157a4
37b5079
7d0ea7d
a25830c
220c625
cb64a5e
0442a0f
3cf33a6
57ea6dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,22 +28,19 @@ public class TxPoolTxSource : ITxSource | |
private readonly ITxFilterPipeline _txFilterPipeline; | ||
private readonly ISpecProvider _specProvider; | ||
protected readonly ILogger _logger; | ||
private readonly IEip4844Config _eip4844Config; | ||
|
||
public TxPoolTxSource( | ||
ITxPool? transactionPool, | ||
ISpecProvider? specProvider, | ||
ITransactionComparerProvider? transactionComparerProvider, | ||
ILogManager? logManager, | ||
ITxFilterPipeline? txFilterPipeline, | ||
IEip4844Config? eip4844ConstantsProvider = null) | ||
ITxFilterPipeline? txFilterPipeline) | ||
{ | ||
_transactionPool = transactionPool ?? throw new ArgumentNullException(nameof(transactionPool)); | ||
_transactionComparerProvider = transactionComparerProvider ?? throw new ArgumentNullException(nameof(transactionComparerProvider)); | ||
_txFilterPipeline = txFilterPipeline ?? throw new ArgumentNullException(nameof(txFilterPipeline)); | ||
_specProvider = specProvider ?? throw new ArgumentNullException(nameof(specProvider)); | ||
_logger = logManager?.GetClassLogger<TxPoolTxSource>() ?? throw new ArgumentNullException(nameof(logManager)); | ||
_eip4844Config = eip4844ConstantsProvider ?? ConstantEip4844Config.Instance; | ||
} | ||
|
||
public IEnumerable<Transaction> GetTransactions(BlockHeader parent, long gasLimit, PayloadAttributes? payloadAttributes = null) | ||
|
@@ -62,7 +59,7 @@ public IEnumerable<Transaction> GetTransactions(BlockHeader parent, long gasLimi | |
|
||
int checkedTransactions = 0; | ||
int selectedTransactions = 0; | ||
using ArrayPoolList<Transaction> selectedBlobTxs = new(_eip4844Config.GetMaxBlobsPerBlock()); | ||
using ArrayPoolList<Transaction> selectedBlobTxs = new((int)(spec.MaxBlobCount * Eip4844Constants.GasPerBlob)); | ||
|
||
SelectBlobTransactions(blobTransactions, parent, spec, selectedBlobTxs); | ||
|
||
|
@@ -126,18 +123,19 @@ private void SelectBlobTransactions(IEnumerable<Transaction> blobTransactions, B | |
UInt256 blobGasCounter = 0; | ||
UInt256 feePerBlobGas = UInt256.Zero; | ||
|
||
var maxBlobGasPerBlock = spec.MaxBlobCount * Eip4844Constants.GasPerBlob; | ||
foreach (Transaction blobTx in blobTransactions) | ||
{ | ||
if (blobGasCounter >= _eip4844Config.MaxBlobGasPerBlock) | ||
if (blobGasCounter >= maxBlobGasPerBlock) | ||
{ | ||
if (_logger.IsTrace) _logger.Trace($"Declining {blobTx.ToShortString()}, no more blob space. Block already have {blobGasCounter} blob gas which is max value allowed."); | ||
break; | ||
} | ||
|
||
checkedBlobTransactions++; | ||
|
||
ulong txBlobGas = (ulong)(blobTx.BlobVersionedHashes?.Length ?? 0) * _eip4844Config.GasPerBlob; | ||
if (txBlobGas > _eip4844Config.MaxBlobGasPerBlock - blobGasCounter) | ||
ulong txBlobGas = (ulong)(blobTx.BlobVersionedHashes?.Length ?? 0) * Eip4844Constants.GasPerBlob; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. refactor? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks to me like it should be an extension method on |
||
if (txBlobGas > maxBlobGasPerBlock - blobGasCounter) | ||
{ | ||
if (_logger.IsTrace) _logger.Trace($"Declining {blobTx.ToShortString()}, not enough blob space."); | ||
continue; | ||
|
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.