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

eip 7840 implementation #7964

Merged
merged 105 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 86 commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
c38a641
add MaxBlobCount, TargetBlobCount to chainSpec
yerke26 Dec 23, 2024
10342cc
Change FeeOracleHistory to use right MaxBlobCount
yerke26 Dec 23, 2024
5ef5d36
fix BlobGasUsedRatio
yerke26 Dec 24, 2024
6f45bc6
remove TargetBlobCount, MaxBlobCount constants
yerke26 Dec 30, 2024
0035b43
add PragueTransitionTimestamp
yerke26 Jan 6, 2025
d68374c
Merge branch 'master' into eip-7840
yerke26 Jan 6, 2025
b668cdf
remove PragueTransitionTimestamp, instead use Eip7002TransitionTimestamp
yerke26 Jan 7, 2025
eb77784
remove Eip4844MaxBlobCount, Eip4844TargetBlobCount from chainSpecParams
yerke26 Jan 7, 2025
b8bef08
fix TxValidatorTests
yerke26 Jan 7, 2025
7059480
fix TxValidatorTests
yerke26 Jan 7, 2025
b638d63
fix CancunStateTests
yerke26 Jan 7, 2025
0d5a076
fix TransactionProcessorEip4844Tests
yerke26 Jan 7, 2025
91f1b1f
fix TxPoolTests
yerke26 Jan 7, 2025
e494aa9
fix tests
yerke26 Jan 7, 2025
44481ba
fix FeeHistoryOracleTests
yerke26 Jan 7, 2025
05772a0
fix whitespaces
yerke26 Jan 7, 2025
b6b50b7
Merge branch 'master' into eip-7840
MarekM25 Jan 7, 2025
09a914d
remove hardcoded values
yerke26 Jan 7, 2025
1d271bd
Fix build errors
MarekM25 Jan 7, 2025
87acb12
Merge branch 'eip-7840' of https://github.com/nethermindeth/nethermin…
MarekM25 Jan 7, 2025
0aa4346
Fix OverridableReleaseSpec
MarekM25 Jan 7, 2025
87fc57d
remove hardcoded values
yerke26 Jan 7, 2025
f28e72a
add blobSchedule to chainSpec
yerke26 Jan 7, 2025
8804ccd
fix FeeHistoryOracleTests
yerke26 Jan 7, 2025
8c1c6f3
fix EthRpcModuleTests
yerke26 Jan 8, 2025
d9d60ab
fix PooledTxsRequestor
yerke26 Jan 8, 2025
6058cb1
use the release spec from the testcase and add prague count test
tanishqjasoria Jan 8, 2025
78b9e33
rename
tanishqjasoria Jan 8, 2025
22b7d1d
fix fee history oracle pre cancun
tanishqjasoria Jan 8, 2025
4fbd890
fix gnosis and chiado specs
tanishqjasoria Jan 8, 2025
6952229
Merge branch 'master' into eip-7840
tanishqjasoria Jan 8, 2025
5b4c0d1
fix whitespaces
yerke26 Jan 8, 2025
cb445ee
Merge branch 'master' into eip-7840
MarekM25 Jan 8, 2025
e181b43
fix default blobCount and targetCount
MarekM25 Jan 8, 2025
43e1655
fix PooledTxsRequestor to use spec at current head
yerke26 Jan 9, 2025
0c309ea
fix PooledTxsRequestorTests
yerke26 Jan 9, 2025
c2737fc
CalculateMaxBlobTxSize through transitionActivations
yerke26 Jan 9, 2025
362f18c
set default TargetBlobCount, MaxBlobCount to zero
yerke26 Jan 9, 2025
2f1f6f2
fix defaults
MarekM25 Jan 9, 2025
43bda5a
set default value for gnosisChain
yerke26 Jan 9, 2025
1ecf556
add Eip7840DefaultBlobCountFraction for gnosis chain
yerke26 Jan 10, 2025
3872a10
fix gnosis, chiado chains json
yerke26 Jan 10, 2025
cc5c798
extended error message
MarekM25 Jan 10, 2025
58a3ff9
revert default value changes
yerke26 Jan 13, 2025
a528f1e
Merge branch 'master' into eip-7840
tanishqjasoria Jan 15, 2025
e8e760d
add blob price update franction
tanishqjasoria Jan 14, 2025
28614f1
fix
tanishqjasoria Jan 14, 2025
6886c52
another fix
tanishqjasoria Jan 14, 2025
1286aea
set default values
tanishqjasoria Jan 14, 2025
64dd8ab
fix an format
tanishqjasoria Jan 15, 2025
38202ee
Merge branch 'master' into pectra-devnet-5
tanishqjasoria Jan 15, 2025
b95ac18
fix some tests
tanishqjasoria Jan 15, 2025
0a4dbd2
Merge branch 'blob-price-fractiion' into pectra-devnet-5
tanishqjasoria Jan 15, 2025
f36e6c4
add blob price update fraction (#8053)
tanishqjasoria Jan 16, 2025
78910ec
cosmetic
MarekM25 Jan 16, 2025
b288921
Merge branch 'eip-7840' of https://github.com/nethermindeth/nethermin…
MarekM25 Jan 16, 2025
340cafa
quick fix
tanishqjasoria Jan 16, 2025
0d3712e
fix
MarekM25 Jan 16, 2025
d1283aa
remove _state
MarekM25 Jan 16, 2025
e7c94c1
ignore the hive test
MarekM25 Jan 16, 2025
52b679a
remove removed precompiles
tanishqjasoria Jan 16, 2025
c1879a6
fix mixed hex in foundation chainspec file
yerke26 Jan 20, 2025
4cd4a45
temporary fix for BlobSender
yerke26 Jan 20, 2025
812d7bd
add fork option to SendBlobs
yerke26 Jan 20, 2025
8f96e97
fix dependency problem
yerke26 Jan 21, 2025
62f5b68
revert
yerke26 Jan 21, 2025
2f2cc87
fix dependency error
yerke26 Jan 21, 2025
25a9832
revert bench_precompiles
yerke26 Jan 21, 2025
06b2117
Merge branch 'master' into eip-7840
yerke26 Jan 21, 2025
eeab3c1
fix dependency error
yerke26 Jan 21, 2025
6918f86
Merge branch 'master' into eip-7840
yerke26 Jan 21, 2025
efd377a
add mainnet, holesky, sepolia tests to
yerke26 Jan 21, 2025
389f8ca
refactoring
yerke26 Jan 21, 2025
f343cb1
ifx blobBaseFeeUpdateFraction in ChainSpecBasedSpecProvider
yerke26 Jan 21, 2025
428e98f
add blobBaseFeeUpdateFraction to holesky, sepolia chainspec files
yerke26 Jan 21, 2025
e96564a
resolved conflicts
MarekM25 Jan 21, 2025
76159e3
Merge branch 'eip-7840' of https://github.com/nethermindeth/nethermin…
MarekM25 Jan 21, 2025
ae96e22
fix compilation error
yerke26 Jan 21, 2025
255ec4f
fix ChainSpecBasedSpecProviderTests
yerke26 Jan 21, 2025
16e9e0d
refactoring of _configuredMaxBlobTxSize in PooledTxsRequestor
yerke26 Jan 21, 2025
fe89802
refactor MaxBlobGas, TargetBlobGas calculation (#8088)
yerke26 Jan 21, 2025
fe59bdf
fix _configuredMaxBlobTxSize
yerke26 Jan 21, 2025
9696cf1
Merge remote-tracking branch 'origin/eip-7840' into eip-7840
yerke26 Jan 21, 2025
1ad0ea8
fix SizeTxFilter
yerke26 Jan 21, 2025
d8c00fd
Small change in GetTransitionsMaxBlobGas
MarekM25 Jan 21, 2025
7cd8d85
naming fix
MarekM25 Jan 21, 2025
9ee577d
revert block exec context
tanishqjasoria Jan 22, 2025
709e94f
revert explicit BlockExecutionContext
yerke26 Jan 22, 2025
bace0c3
remove explicit BlockExecutionContext
yerke26 Jan 22, 2025
64ed1dc
refactor BlobTxGasLimitExceeded TxErrorMessage
yerke26 Jan 22, 2025
5aa531c
refactor namings
yerke26 Jan 22, 2025
8441be2
refactoring, resolving comments
yerke26 Jan 22, 2025
f74738a
refactoring
yerke26 Jan 22, 2025
44d4ef3
refactor BlobTxGasLimitExceeded
yerke26 Jan 22, 2025
30a6bd7
move calculation of BlobGasFee to BlockExecutionContext from VM
yerke26 Jan 23, 2025
e3b52cd
Eip 7840 - add IReleaseSpec to BlockExecutionContext constructor (#8096)
yerke26 Jan 23, 2025
06157a4
Merge branch 'master' into eip-7840
yerke26 Jan 23, 2025
37b5079
resolve merge conflicts
yerke26 Jan 23, 2025
7d0ea7d
mark ChainSpecBasedSpecProviderTests sequential
yerke26 Jan 23, 2025
a25830c
add todo for ChainSpecBasedSpecProviderTests
yerke26 Jan 23, 2025
220c625
cosmetic
yerke26 Jan 24, 2025
cb64a5e
Merge branch 'master' into eip-7840
yerke26 Jan 24, 2025
0442a0f
resolve merge conflict
yerke26 Jan 24, 2025
3cf33a6
refactoring
yerke26 Jan 24, 2025
57ea6dd
refactor BlockErrorMessage
yerke26 Jan 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/Nethermind/Chains/chiado.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,18 @@
"eip1559ElasticityMultiplier": "0x2",
"feeCollector": "0x1559000000000000000000000000000000000000",
"eip1559FeeCollectorTransition": 0,
"eip4844BlobGasPriceUpdateFraction": "0x10fafa",
"eip4844MaxBlobGasPerBlock": "0x40000",
"eip4844MinBlobGasPrice": "0x3b9aca00",
"eip4844TargetBlobGasPerBlock": "0x20000",
"registrar": "0x6000000000000000000000000000000000000000",
"transactionPermissionContract": "0x4000000000000000000000000000000000000001",
"transactionPermissionContractTransition": "0x0",
"terminalTotalDifficulty": "231707791542740786049188744689299064356246512"
"terminalTotalDifficulty": "231707791542740786049188744689299064356246512",
"blobSchedule": {
"cancun": {
Copy link
Member

Choose a reason for hiding this comment

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

Should it be by fork name? Normally we are using timestamps now to mark changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, as per EIp it should be by fork name

Copy link
Member

Choose a reason for hiding this comment

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

Don't like it to be honest it is inconsistent with our previous chainspecs. EIP's shouldn't define internal stuff. Should we consider going to timestamps @MarekM25 ?

"target": 1,
"max": 2,
"baseFeeUpdateFraction": "0x10fafa"
}
}
},
"genesis": {
"seal": {
Expand Down
14 changes: 13 additions & 1 deletion src/Nethermind/Chains/foundation.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,19 @@
"eip4844TransitionTimestamp": "0x65F1B057",
"eip5656TransitionTimestamp": "0x65F1B057",
"eip6780TransitionTimestamp": "0x65F1B057",
"terminalTotalDifficulty": "C70D808A128D7380000"
"terminalTotalDifficulty": "C70D808A128D7380000",
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": "0x32f0ed"
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": "0x4c6964"
yerke26 marked this conversation as resolved.
Show resolved Hide resolved
}
}
},
"genesis": {
"seal": {
Expand Down
12 changes: 8 additions & 4 deletions src/Nethermind/Chains/gnosis.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,18 @@
"eip1559BaseFeeInitialValue": "0x3b9aca00",
"feeCollector": "0x6BBe78ee9e474842Dbd4AB4987b3CeFE88426A92",
"eip1559FeeCollectorTransition": 19040000,
"eip4844BlobGasPriceUpdateFraction": "0x10fafa",
"eip4844MaxBlobGasPerBlock": "0x40000",
"eip4844MinBlobGasPrice": "0x3b9aca00",
"eip4844TargetBlobGasPerBlock": "0x20000",
"registrar": "0x6B53721D4f2Fb9514B85f5C49b197D857e36Cf03",
"transactionPermissionContract": "0x7Dd7032AA75A37ea0b150f57F899119C7379A78b",
"transactionPermissionContractTransition": 9186425,
"terminalTotalDifficulty": "8626000000000000000000058750000000000000000000"
"terminalTotalDifficulty": "8626000000000000000000058750000000000000000000",
"blobSchedule": {
"cancun": {
"target": 1,
"max": 2,
"baseFeeUpdateFraction": "0x10fafa"
}
}
},
"genesis": {
"seal": {
Expand Down
184 changes: 77 additions & 107 deletions src/Nethermind/Chains/hive.json

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion src/Nethermind/Chains/holesky.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,19 @@
"maximumExtraDataSize": "0xffff",
"minGasLimit": "0x1388",
"registrar": "0x0000000000000000000000000000000000000000",
"MergeForkIdTransition": "0x0"
"MergeForkIdTransition": "0x0",
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": "0x32f0ed"
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": "0x4c6964"
}
}
},
"genesis": {
"seal": {
Expand Down
14 changes: 13 additions & 1 deletion src/Nethermind/Chains/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,19 @@
"eip4788TransitionTimestamp": "0x65B97D60",
"eip4844TransitionTimestamp": "0x65B97D60",
"eip5656TransitionTimestamp": "0x65B97D60",
"eip6780TransitionTimestamp": "0x65B97D60"
"eip6780TransitionTimestamp": "0x65B97D60",
"blobSchedule": {
"cancun": {
"target": 3,
"max": 6,
"baseFeeUpdateFraction": "0x32f0ed"
},
"prague": {
"target": 6,
"max": 9,
"baseFeeUpdateFraction": "0x4c6964"
}
}
},
"genesis": {
"seal": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,6 @@ public void Test_StoreBeaconRoot_AccessListNotNull()

transaction.Hash = transaction.CalculateHash();
_transactionProcessor.Received().Execute(Arg.Is<Transaction>(t =>
t.Hash == transaction.Hash), header, NullTxTracer.Instance);
t.Hash == transaction.Hash), new BlockExecutionContext(header), NullTxTracer.Instance);
tanishqjasoria marked this conversation as resolved.
Show resolved Hide resolved
}
}
20 changes: 0 additions & 20 deletions src/Nethermind/Nethermind.Blockchain.Test/TestEip4844Config.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public static IEnumerable EnoughShardBlobTransactionsSelectedTestCases
tx.MaxFeePerBlobGas = 1;
});
maxTransactionsSelected.Transactions[1].BlobVersionedHashes =
new byte[Eip4844Constants.MaxBlobGasPerTransaction / Eip4844Constants.GasPerBlob - 1][];
new byte[maxTransactionsSelected.ReleaseSpec.MaxBlobCount - 1][];
maxTransactionsSelected.ExpectedSelectedTransactions.AddRange(
maxTransactionsSelected.Transactions.OrderBy(static t => t.Nonce).Take(2));
yield return new TestCaseData(maxTransactionsSelected).SetName("Enough transactions selected");
Expand All @@ -174,7 +174,7 @@ public static IEnumerable EnoughShardBlobTransactionsSelectedTestCases
enoughTransactionsSelected.Transactions.OrderBy(static t => t.Nonce).ToArray();
expectedSelectedTransactions[0].Type = TxType.Blob;
expectedSelectedTransactions[0].BlobVersionedHashes =
new byte[Eip4844Constants.MaxBlobGasPerTransaction / Eip4844Constants.GasPerBlob][];
new byte[enoughTransactionsSelected.ReleaseSpec.MaxBlobCount][];
expectedSelectedTransactions[0].MaxFeePerBlobGas = 1;
expectedSelectedTransactions[1].Type = TxType.Blob;
expectedSelectedTransactions[1].BlobVersionedHashes = new byte[1][];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,14 @@ public void GetTransactions_should_respect_customizable_blob_gas_limit(int[] blo
ITxFilterPipeline txFilterPipeline = Substitute.For<ITxFilterPipeline>();
txFilterPipeline.Execute(Arg.Any<Transaction>(), Arg.Any<BlockHeader>()).Returns(true);

TestEip4844Config eip4844Config = new(customMaxBlobGasPerBlock);

TxPoolTxSource transactionSelector = new(txPool, specProvider, transactionComparerProvider, LimboLogs.Instance, txFilterPipeline, eip4844Config);
TxPoolTxSource transactionSelector = new(txPool, specProvider, transactionComparerProvider, LimboLogs.Instance, txFilterPipeline);

IEnumerable<Transaction> txs = transactionSelector.GetTransactions(new BlockHeader { }, long.MaxValue);
int blobsCount = txs.Sum(tx => tx.BlobVersionedHashes?.Length ?? 0);

Assert.Multiple(() =>
{
Assert.That((ulong)blobsCount * eip4844Config.GasPerBlob, Is.LessThanOrEqualTo(eip4844Config.MaxBlobGasPerBlock));
Assert.That(blobsCount, Is.LessThanOrEqualTo(eip4844Config.GetMaxBlobsPerBlock()));
Assert.That(blobsCount, Is.LessThanOrEqualTo(Cancun.Instance.MaxBlobCount));
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public static bool Blob_gas_fields_should_be_set(IReleaseSpec spec, ulong? blobG
}

[TestCaseSource(nameof(BlobsPerBlockCountTestCases))]
public bool Blobs_per_block_count_is_valid(ulong blobGasUsed)
public bool Blobs_per_block_count_is_valid(IReleaseSpec spec, ulong blobGasUsed)
{
ISpecProvider specProvider = new CustomSpecProvider(((ForkActivation)0, Cancun.Instance));
ISpecProvider specProvider = new CustomSpecProvider(((ForkActivation)0, spec));
BlockValidator blockValidator = new(Always.Valid, Always.Valid, Always.Valid, specProvider, TestLogManager.Instance);
return blockValidator.ValidateSuggestedBlock(
Build.A.Block
Expand All @@ -53,13 +53,19 @@ public bool Blobs_per_block_count_is_valid(ulong blobGasUsed)

private static IEnumerable<TestCaseData> BlobsPerBlockCountTestCases()
{
yield return new TestCaseData(0UL) { ExpectedResult = true };
yield return new TestCaseData(Cancun.Instance, 0UL) { ExpectedResult = true };

yield return new TestCaseData(Cancun.Instance, (Cancun.Instance.MaxBlobCount - 1) * Eip4844Constants.GasPerBlob) { ExpectedResult = true };

yield return new TestCaseData(Cancun.Instance, Cancun.Instance.MaxBlobCount * Eip4844Constants.GasPerBlob) { ExpectedResult = true };

yield return new TestCaseData(Cancun.Instance, (Cancun.Instance.MaxBlobCount + 1) * Eip4844Constants.GasPerBlob) { ExpectedResult = false };

yield return new TestCaseData(Eip4844Constants.MaxBlobGasPerBlock - Eip4844Constants.GasPerBlob) { ExpectedResult = true };
yield return new TestCaseData(Prague.Instance, (Prague.Instance.MaxBlobCount - 1) * Eip4844Constants.GasPerBlob) { ExpectedResult = true };

yield return new TestCaseData(Eip4844Constants.MaxBlobGasPerBlock) { ExpectedResult = true };
yield return new TestCaseData(Prague.Instance, (Prague.Instance.MaxBlobCount) * Eip4844Constants.GasPerBlob) { ExpectedResult = true };

yield return new TestCaseData(Eip4844Constants.MaxBlobGasPerBlock + Eip4844Constants.GasPerBlob) { ExpectedResult = false };
yield return new TestCaseData(Prague.Instance, (Prague.Instance.MaxBlobCount + 1) * Eip4844Constants.GasPerBlob) { ExpectedResult = false };
}

private static IEnumerable<TestCaseData> BlobGasFieldsPerForkTestCases()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,10 @@ public bool BlobVersionedHash_should_be_correct(byte[] hash)
}

[TestCaseSource(nameof(ShardBlobTxIncorrectTransactions))]
public bool ShardBlobTransaction_fields_should_be_verified(Transaction tx)
public bool ShardBlobTransaction_fields_should_be_verified(IReleaseSpec spec, Transaction tx)
{
TxValidator txValidator = new(TestBlockchainIds.ChainId);
return txValidator.IsWellFormed(tx, Cancun.Instance);
return txValidator.IsWellFormed(tx, spec);
}

[Test]
Expand Down Expand Up @@ -695,91 +695,110 @@ static TransactionBuilder<Transaction> MakeTestObject(int blobCount = 1) => Buil
.WithMaxFeePerBlobGas(1)
.WithShardBlobTxTypeAndFields(blobCount);

yield return new TestCaseData(MakeTestObject().SignedAndResolved().TestObject)
yield return new TestCaseData(Cancun.Instance, MakeTestObject().SignedAndResolved().TestObject)
{
TestName = "A correct shard blob tx",
ExpectedResult = true
};

yield return new TestCaseData(MakeTestObject(0)
yield return new TestCaseData(Cancun.Instance, MakeTestObject(0)
.SignedAndResolved().TestObject)
{
TestName = "BlobVersionedHashes are empty",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject(Eip4844Constants.MinBlobsPerTransaction - 1)
yield return new TestCaseData(Cancun.Instance, MakeTestObject(Eip4844Constants.MinBlobsPerTransaction - 1)
.SignedAndResolved().TestObject)
{
TestName = "Not enough BlobVersionedHashes",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject(Eip4844Constants.MinBlobsPerTransaction)
yield return new TestCaseData(Cancun.Instance, MakeTestObject(Eip4844Constants.MinBlobsPerTransaction)
.SignedAndResolved().TestObject)
{
TestName = "Bare minimum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(MakeTestObject(Eip4844Constants.MinBlobsPerTransaction + 1)
yield return new TestCaseData(Cancun.Instance, MakeTestObject(Eip4844Constants.MinBlobsPerTransaction + 1)
.SignedAndResolved().TestObject)
{
TestName = "More than minimum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(MakeTestObject((int)(Eip4844Constants.MaxBlobGasPerBlock / Eip4844Constants.GasPerBlob - 1))
yield return new TestCaseData(Cancun.Instance, MakeTestObject((int)Cancun.Instance.MaxBlobCount - 1)
.SignedAndResolved().TestObject)
{
TestName = "Less than maximum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(Cancun.Instance, MakeTestObject((int)Cancun.Instance.MaxBlobCount)
.SignedAndResolved().TestObject)
{
TestName = "Maximum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(Cancun.Instance, MakeTestObject((int)Cancun.Instance.MaxBlobCount + 1)
.SignedAndResolved().TestObject)
{
TestName = "Too many BlobVersionedHashes",
ExpectedResult = false
};

yield return new TestCaseData(Prague.Instance, MakeTestObject((int)Prague.Instance.MaxBlobCount - 1)
.SignedAndResolved().TestObject)
{
TestName = "Less than maximum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(MakeTestObject((int)(Eip4844Constants.MaxBlobGasPerBlock / Eip4844Constants.GasPerBlob))
yield return new TestCaseData(Prague.Instance, MakeTestObject((int)Prague.Instance.MaxBlobCount)
.SignedAndResolved().TestObject)
{
TestName = "Maximum BlobVersionedHashes",
ExpectedResult = true
};
yield return new TestCaseData(MakeTestObject((int)(Eip4844Constants.MaxBlobGasPerBlock / Eip4844Constants.GasPerBlob + 1))
yield return new TestCaseData(Prague.Instance, MakeTestObject((int)Prague.Instance.MaxBlobCount + 1)
.SignedAndResolved().TestObject)
{
TestName = "Too many BlobVersionedHashes",
ExpectedResult = false
};

yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.WithBlobVersionedHashes(new byte[][] { MakeArray(31, KzgPolynomialCommitments.KzgBlobHashVersionV1) })
.SignedAndResolved().TestObject)
{
TestName = "BlobVersionedHashes are of a wrong length",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.With(static tx => ((ShardBlobNetworkWrapper)tx.NetworkWrapper!).Blobs = [])
.SignedAndResolved().TestObject)
{
TestName = "Blobs count does not match hashes count",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.With(static tx => ((ShardBlobNetworkWrapper)tx.NetworkWrapper!).Commitments = [])
.SignedAndResolved().TestObject)
{
TestName = "Commitments count does not match hashes count",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.With(static tx => ((ShardBlobNetworkWrapper)tx.NetworkWrapper!).Proofs = [])
.SignedAndResolved().TestObject)
{
TestName = "Proofs count does not match hashes count",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.With(static tx => ((ShardBlobNetworkWrapper)tx.NetworkWrapper!).Commitments[0][1] ^= 0xFF)
.SignedAndResolved().TestObject)
{
TestName = "A commitment does not math hash",
ExpectedResult = false
};
yield return new TestCaseData(MakeTestObject()
yield return new TestCaseData(Cancun.Instance, MakeTestObject()
.With(static tx => ((ShardBlobNetworkWrapper)tx.NetworkWrapper!).Proofs[0][1] ^= 0xFF)
.SignedAndResolved().TestObject)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Nethermind.Core.Eip2930;
using Nethermind.Core.Specs;
using Nethermind.Crypto;
using Nethermind.Evm;
using Nethermind.Evm.Tracing;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Int256;
Expand Down Expand Up @@ -65,7 +66,7 @@ public void StoreBeaconRoot(Block block, IReleaseSpec spec, ITxTracer tracer)

transaction.Hash = transaction.CalculateHash();

processor.Execute(transaction, header, tracer);
processor.Execute(transaction, new BlockExecutionContext(header), tracer);
yerke26 marked this conversation as resolved.
Show resolved Hide resolved
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,12 @@ public bool IsSyncing

private void OnHeadChanged(object? sender, BlockReplacementEventArgs e)
{
IReleaseSpec spec = SpecProvider.GetSpec(e.Block.Header);
HeadNumber = e.Block.Number;
BlockGasLimit = e.Block!.GasLimit;
CurrentBaseFee = e.Block.Header.BaseFeePerGas;
CurrentFeePerBlobGas =
BlobGasCalculator.TryCalculateFeePerBlobGas(e.Block.Header, out UInt256 currentFeePerBlobGas)
BlobGasCalculator.TryCalculateFeePerBlobGas(e.Block.Header, spec.BlobBaseFeeUpdateFraction, out UInt256 currentFeePerBlobGas)
? currentFeePerBlobGas
: UInt256.Zero;
HeadChanged?.Invoke(sender, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private bool TryCall(BlockHeader header, Transaction transaction, out byte[] res

try
{
_transactionProcessor.Execute(transaction, new BlockExecutionContext(header), tracer);
_transactionProcessor.Execute(transaction, new BlockExecutionContext(header, 0), tracer);
yerke26 marked this conversation as resolved.
Show resolved Hide resolved
result = tracer.ReturnValue;
return tracer.StatusCode == StatusCode.Success;
}
Expand Down
Loading
Loading