Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
alexb5dh committed Oct 11, 2024
1 parent dc9de8e commit 4cca8a2
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public bool TryGetDelegation(IReadOnlyStateProvider worldState, Address address,

public ValueHash256 GetExecutableCodeHash(IWorldState worldState, Address address) =>
codeInfoRepository.GetExecutableCodeHash(worldState, address);

public void ResetOverrides() => _codeOverwrites.Clear();
}
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public void Call_uses_valid_post_merge_and_random_value()

Transaction tx = Build.A.Transaction.TestObject;

_blockchainBridge.Call(header, tx, CancellationToken.None);
_blockchainBridge.Call(header, tx);
_transactionProcessor.Received().CallAndRestore(
tx,
Arg.Is<BlockExecutionContext>(blkCtx =>
Expand All @@ -173,7 +173,7 @@ public void Call_uses_valid_block_number()
BlockHeader header = Build.A.BlockHeader.WithNumber(10).TestObject;
Transaction tx = new() { GasLimit = Transaction.BaseTxGasCost };

_blockchainBridge.Call(header, tx, CancellationToken.None);
_blockchainBridge.Call(header, tx);
_transactionProcessor.Received().CallAndRestore(
tx,
Arg.Is<BlockExecutionContext>(blkCtx => blkCtx.Header.Number == 10),
Expand All @@ -188,7 +188,7 @@ public void Call_uses_valid_mix_hash()
BlockHeader header = Build.A.BlockHeader.WithMixHash(TestItem.KeccakA).TestObject;
Transaction tx = new() { GasLimit = Transaction.BaseTxGasCost };

_blockchainBridge.Call(header, tx, CancellationToken.None);
_blockchainBridge.Call(header, tx);
_transactionProcessor.Received().CallAndRestore(
tx,
Arg.Is<BlockExecutionContext>(blkCtx => blkCtx.Header.MixHash == TestItem.KeccakA),
Expand All @@ -203,7 +203,7 @@ public void Call_uses_valid_beneficiary()
BlockHeader header = Build.A.BlockHeader.WithBeneficiary(TestItem.AddressB).TestObject;
Transaction tx = new() { GasLimit = Transaction.BaseTxGasCost };

_blockchainBridge.Call(header, tx, CancellationToken.None);
_blockchainBridge.Call(header, tx);
_transactionProcessor.Received().CallAndRestore(
tx,
Arg.Is<BlockExecutionContext>(blkCtx => blkCtx.Header.Beneficiary == TestItem.AddressB),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ConstantBridgeContract(Contract contract, IBlockchainBridge blockchainBri
public override object[] Call(CallInfo callInfo)
{
var transaction = GenerateTransaction(callInfo);
var result = _blockchainBridge.Call(callInfo.ParentHeader, transaction, CancellationToken.None);
var result = _blockchainBridge.Call(callInfo.ParentHeader, transaction);
if (!string.IsNullOrEmpty(result.Error))
{
throw new AbiException(result.Error);
Expand Down
3 changes: 1 addition & 2 deletions src/Nethermind/Nethermind.Facade/IBlockchainBridge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ public interface IBlockchainBridge : ILogFinder
TxReceipt GetReceipt(Hash256 txHash);
(TxReceipt? Receipt, TxGasInfo? GasInfo, int LogIndexStart) GetReceiptAndGasInfo(Hash256 txHash);
(TxReceipt? Receipt, Transaction? Transaction, UInt256? baseFee) GetTransaction(Hash256 txHash, bool checkTxnPool = true);
CallOutput Call(BlockHeader header, Transaction tx, Dictionary<Address, AccountOverride>? stateOverride, CancellationToken cancellationToken);
CallOutput Call(BlockHeader header, Transaction tx, CancellationToken cancellationToken) => Call(header, tx, null, cancellationToken);
CallOutput Call(BlockHeader header, Transaction tx, Dictionary<Address, AccountOverride>? stateOverride = null, CancellationToken cancellationToken = default);
SimulateOutput Simulate(BlockHeader header, SimulatePayload<TransactionWithSourceDetails> payload, CancellationToken cancellationToken);
CallOutput EstimateGas(BlockHeader header, Transaction tx, int errorMarginBasisPoints, Dictionary<Address, AccountOverride> stateOverride, CancellationToken cancellationToken);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private ResultWrapper<ParityTxTraceFromReplay> TraceTx(Transaction tx, string[]
BlockHeader nextHeader = header.Clone();
nextHeader.Number = header.Number + 1;
nextHeader.ParentHash = header.Hash;
nextHeader.MaybeParent = new (header);
nextHeader.MaybeParent = new(header);

Block block = new(nextHeader, [tx], []);
nextHeader.Hash = block.CalculateHash();
Expand Down

0 comments on commit 4cca8a2

Please sign in to comment.