Skip to content

Commit

Permalink
add signature to bundle events
Browse files Browse the repository at this point in the history
  • Loading branch information
avalonche committed Sep 23, 2021
1 parent c02d691 commit 9f88015
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/Nethermind/Nethermind.Mev/Data/BundleEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
//

using System;
using Nethermind.Core.Crypto;

namespace Nethermind.Mev.Data
{
public class BundleEventArgs : EventArgs
{
public MevBundle MevBundle { get; }

public BundleEventArgs(MevBundle mevBundle)
public Signature? RelaySignature { get; }

public BundleEventArgs(MevBundle mevBundle, Signature? relaySignature = null)
{
MevBundle = mevBundle;
RelaySignature = relaySignature;
}
}
}
10 changes: 10 additions & 0 deletions src/Nethermind/Nethermind.Mev/Data/MevMegabundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,17 @@ public bool Equals(MevMegabundle? other)
return Equals(Hash, other.Hash)
&& Equals(RelaySignature, other.RelaySignature);
}

public override bool Equals(object? obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != GetType()) return false;
return Equals((MevMegabundle) obj);
}

public override int GetHashCode() => Hash.GetHashCode();

public override string ToString() => $"Hash:{Hash}; Block:{BlockNumber}; Min:{MinTimestamp}; Max:{MaxTimestamp}; TxCount:{Transactions.Count}; RelaySignature:{RelaySignature};";
}
}
2 changes: 1 addition & 1 deletion src/Nethermind/Nethermind.Mev/Source/BundlePool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ private void OnNewBlock(object? sender, BlockEventArgs e)
UInt256 timestamp = _timestamper.UnixTime.Seconds;
IEnumerable<MevBundle> bundles = GetBundles(e.Block.Number + 1, UInt256.MaxValue, timestamp);
IEnumerable<MevBundle> megabundles = GetMegabundles(e.Block.Number + 1, UInt256.MaxValue, timestamp);
IEnumerable<MevBundle> allBundles = bundles.Concat(megabundles)
IEnumerable<MevBundle> allBundles = bundles.Concat(megabundles);
foreach (MevBundle bundle in allBundles)
{
SimulateBundle(bundle, e.Block.Header);
Expand Down

0 comments on commit 9f88015

Please sign in to comment.