Skip to content
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
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
3 changes: 2 additions & 1 deletion scripts/known-failing-hive-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

eth_getStorageAt/get-storage-invalid-key (nethermind)
eth_getStorageAt/get-storage-invalid-key-too-large (nethermind)
eth_createAccessList/create-al-abi-revert (nethermind)
eth_estimateGas/estimate-with-eip4844 (nethermind)
eth_sendRawTransaction/send-blob-tx (nethermind)
eth_simulateV1/ethSimulate-instrict-gas-38013 (nethermind)
eth_simulateV1/ethSimulate-run-gas-spending (nethermind)
eth_simulateV1/ethSimulate-run-out-of-gas-in-block-38015 (nethermind)
eth_simulateV1/ethSimulate-simple-more-params-validate (nethermind)
eth_simulateV1/ethSimulate-two-blocks-with-complete-eth-sends (nethermind)
eth_simulateV1/ethSimulate-use-as-many-features-as-possible (nethermind)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class BlobTransactionForRpc : EIP1559TransactionForRpc, IFromTransaction<
public override TxType? Type => TxType;

[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonDiscriminator]
Comment thread
LukaszRozmej marked this conversation as resolved.
public UInt256? MaxFeePerBlobGas { get; set; }

// TODO: Each item should be a 32 byte array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public static IEnumerable TxJsonTestCases
yield return Make(TxType.Legacy, """{}""");
yield return Make(TxType.Legacy, """{"type":null}""");
yield return Make(TxType.Legacy, """{"additionalField":""}""");
yield return Make(TxType.Legacy, """{"MaxFeePerBlobGas":"0x0"}""");

yield return Make(TxType.AccessList, """{"type":null,"accessList":[]}""");
yield return Make(TxType.AccessList, """{"nonce":"0x0","to":null,"value":"0x0","accessList":[]}""");
Expand All @@ -55,11 +56,10 @@ public static IEnumerable TxJsonTestCases
yield return Make(TxType.EIP1559, """{"maxFeePerGas":"0x0"}""");
yield return Make(TxType.EIP1559, """{"maxPriorityFeePerGas":"0x0"}""");
yield return Make(TxType.EIP1559, """{"MaxPriorityFeePerGas":"0x0"}""");
yield return Make(TxType.EIP1559, """{"nonce":"0x0","to":null,"value":"0x0","maxPriorityFeePerGas":"0x0", "maxFeePerGas":"0x0","maxFeePerBlobGas":"0x0"}""");

yield return Make(TxType.Blob, """{"nonce":"0x0","to":null,"value":"0x0","accessList":[],"maxFeePerBlobGas":"0x0"}""");
yield return Make(TxType.Blob, """{"nonce":"0x0","to":null,"value":"0x0","maxPriorityFeePerGas":"0x0", "maxFeePerGas":"0x0","maxFeePerBlobGas":"0x0"}""");
yield return Make(TxType.Blob, """{"nonce":"0x0","to":null,"value":"0x0","accessList":[],"blobVersionedHashes":[]}""");
yield return Make(TxType.Blob, """{"maxFeePerBlobGas":"0x0", "blobVersionedHashes":[]}""");
yield return Make(TxType.Blob, """{"MaxFeePerBlobGas":"0x0"}""");
yield return Make(TxType.Blob, """{"blobVersionedHashes":[]}""");
yield return Make(TxType.Blob, """{"BlobVersionedHashes":null}""");
yield return Make(TxType.Blob, """{"blobVersionedHashes":["0x01f1872d656b7a820d763e6001728b9b883f829b922089ec6ad7f5f1665470dc"]}""");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public async Task Test_debug_simulate_eth_moved()
TestRpcBlockchain chain = await EthRpcSimulateTestsBase.CreateChain();

UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);
Transaction txMainnetAtoB = EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
Transaction txMainnetAtoB = EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = EthSimulateTestsBlocksAndTransactions.CreateEthMovedPayload(chain, nonceA);

Expand Down Expand Up @@ -93,7 +93,7 @@ public async Task Test_debug_simulate_transactions_forced_fail()
UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);

Transaction txMainnetAtoB =
EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = EthSimulateTestsBlocksAndTransactions.CreateTransactionsForcedFail(chain, nonceA);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,10 +141,11 @@ public static SimulatePayload<TransactionForRpc> CreateTransactionsForcedFail(Te
};
}

public static Transaction GetTransferTxData(UInt256 nonce, IEthereumEcdsa ethereumEcdsa, PrivateKey from, Address to, UInt256 amount)
public static Transaction GetTransferTxData(UInt256 nonce, IEthereumEcdsa ethereumEcdsa, PrivateKey from, Address to, UInt256 amount, TxType type = TxType.EIP1559)
{
Transaction tx = new()
{
Type = type,
Value = amount,
Nonce = nonce,
GasLimit = 50_000,
Expand Down Expand Up @@ -192,7 +193,7 @@ public async Task Test_eth_simulate_eth_moved()
TestRpcBlockchain chain = await EthRpcSimulateTestsBase.CreateChain();

UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);
Transaction txMainnetAtoB = GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
Transaction txMainnetAtoB = GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = CreateEthMovedPayload(chain, nonceA);

Expand Down Expand Up @@ -233,7 +234,7 @@ public async Task Test_eth_simulate_transactions_forced_fail()
UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);

Transaction txMainnetAtoB =
GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = CreateTransactionsForcedFail(chain, nonceA);

Expand Down Expand Up @@ -276,6 +277,7 @@ public static SimulatePayload<TransactionForRpc> CreateTransferLogsAddressPayloa
},
"calls": [
{
"type": "0x3",
"from": "0xc000000000000000000000000000000000000000",
"to": "0xc100000000000000000000000000000000000000",
"gas": "0x5208",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task Test_trace_simulate_eth_moved()
TestRpcBlockchain chain = await EthRpcSimulateTestsBase.CreateChain();

UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);
Transaction txMainnetAtoB = EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
Transaction txMainnetAtoB = EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = EthSimulateTestsBlocksAndTransactions.CreateEthMovedPayload(chain, nonceA);

Expand Down Expand Up @@ -89,7 +89,7 @@ public async Task Test_trace_simulate_transactions_forced_fail()
UInt256 nonceA = chain.ReadOnlyState.GetNonce(TestItem.AddressA);

Transaction txMainnetAtoB =
EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1);
EthSimulateTestsBlocksAndTransactions.GetTransferTxData(nonceA, chain.EthereumEcdsa, TestItem.PrivateKeyA, TestItem.AddressB, 1, type: TxType.Legacy);

SimulatePayload<TransactionForRpc> payload = EthSimulateTestsBlocksAndTransactions.CreateTransactionsForcedFail(chain, nonceA);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,37 @@ protected override SimulatePayload<TransactionWithSourceDetails> Prepare(Simulat

private static TransactionForRpc UpdateTxType(TransactionForRpc rpcTransaction)
{
// TODO: This is a bit messy since we're changing the transaction type
if (rpcTransaction is LegacyTransactionForRpc legacy && rpcTransaction is not EIP1559TransactionForRpc)
// If transaction is Legacy or AccessList update to Eip1559
// If gas price is not null it's a legacy tx. No metter what
if (rpcTransaction is LegacyTransactionForRpc legacy)
{
rpcTransaction = new EIP1559TransactionForRpc
LegacyTransactionForRpc result = legacy;
if (legacy.GasPrice is not null)
{
Nonce = legacy.Nonce,
To = legacy.To,
From = legacy.From,
Gas = legacy.Gas,
Value = legacy.Value,
Input = legacy.Input,
GasPrice = legacy.GasPrice,
ChainId = legacy.ChainId,
V = legacy.V,
R = legacy.R,
S = legacy.S,
};
result = new LegacyTransactionForRpc();
}
else if (rpcTransaction is not EIP1559TransactionForRpc)
{
result = new EIP1559TransactionForRpc
{
AccessList = rpcTransaction is AccessListTransactionForRpc accessListTx
? accessListTx.AccessList
: null
};
}
result.Nonce = legacy.Nonce;
result.To = legacy.To;
result.From = legacy.From;
result.Gas = legacy.Gas;
result.Value = legacy.Value;
result.Input = legacy.Input;
result.GasPrice = legacy.GasPrice;
result.ChainId = legacy.ChainId;
result.V = legacy.V;
result.R = legacy.R;
result.S = legacy.S;

return result;
}

return rpcTransaction;
Expand Down
Loading