public void should_add_bundle_with_correct_timestamps() { ITimestamper timestamper = new ManualTimestamper(DateTime.UtcNow); ulong timestamp = timestamper.UnixTime.Seconds; TestContext test = new TestContext(timestamper); BundleTransaction[] tx1 = { Build.A.TypedTransaction <BundleTransaction>().SignedAndResolved(TestItem.PrivateKeyD).TestObject }; BundleTransaction[] tx2 = { Build.A.TypedTransaction <BundleTransaction>().SignedAndResolved(TestItem.PrivateKeyA).TestObject }; MevConfig mevConfig = new MevConfig(); UInt256 bundleHorizon = mevConfig.BundleHorizon; MevBundle[] bundles = new[] { new MevBundle(1, tx1, 0, 0), new MevBundle(2, tx1, timestamp + 5, timestamp), //min > max new MevBundle(3, tx1, timestamp - 5, timestamp + 5), new MevBundle(4, tx2, timestamp - 10, timestamp - 5), //max < curr new MevBundle(4, tx2, timestamp + bundleHorizon, timestamp + bundleHorizon + 10), new MevBundle(5, tx2, timestamp + bundleHorizon + 1, timestamp + bundleHorizon + 10) //min too large }; bundles.Select(b => test.BundlePool.AddBundle(b)) .Should().BeEquivalentTo(new bool[] { true, false, true, false, true, false }); }
public TestMevRpcBlockchain(int maxMergedBundles, UInt256?initialBaseFeePerGas, Address[]?relayAddresses) { _maxMergedBundles = maxMergedBundles; _relayAddresses = relayAddresses ?? Array.Empty <Address>(); _mevConfig = new MevConfig { Enabled = true, TrustedRelays = string.Join(",", _relayAddresses.ToList()), MaxMergedBundles = _maxMergedBundles }; Signer = new Eth2Signer(MinerAddress); GenesisBlockBuilder = Core.Test.Builders.Build.A.Block.Genesis.Genesis .WithTimestamp(UInt256.One) .WithGasLimit(GasLimitCalculator.GasLimit) .WithBaseFeePerGas(initialBaseFeePerGas ?? 0); }
public void Can_create() { _ = new MevConfig(); }