diff --git a/benchmarks/Neo.Benchmarks/config.json b/benchmarks/Neo.Benchmarks/config.json index 01471e4c76..c69d08ab43 100644 --- a/benchmarks/Neo.Benchmarks/config.json +++ b/benchmarks/Neo.Benchmarks/config.json @@ -27,8 +27,8 @@ "ProtocolConfiguration": { "Network": 860833102, "AddressVersion": 53, - "MillisecondsPerBlock": 15000, - "MaxTransactionsPerBlock": 512, + "MillisecondsPerBlock": 3000, + "MaxTransactionsPerBlock": 256, "MemoryPoolMaxTransactions": 50000, "MaxTraceableBlocks": 2102400, "Hardforks": { diff --git a/docs/config.json.md b/docs/config.json.md index b32b1f2f8f..3f9fc61a79 100644 --- a/docs/config.json.md +++ b/docs/config.json.md @@ -42,10 +42,10 @@ This README provides an explanation for each field in the JSON configuration fil - **AddressVersion**: Version byte used in Neo address generation. Default is `53`. ### MillisecondsPerBlock -- **MillisecondsPerBlock**: Time interval between blocks in milliseconds. Default is `15000` (15 seconds). +- **MillisecondsPerBlock**: Time interval between blocks in milliseconds. Default is `3000` (3 seconds). ### MaxTransactionsPerBlock -- **MaxTransactionsPerBlock**: Maximum number of transactions allowed per block. Default is `512`. +- **MaxTransactionsPerBlock**: Maximum number of transactions allowed per block. Default is `256`. ### MemoryPoolMaxTransactions - **MemoryPoolMaxTransactions**: Maximum number of transactions that can be held in the memory pool. Default is `50000`. diff --git a/src/Neo.CLI/config.fs.testnet.json b/src/Neo.CLI/config.fs.testnet.json index d2bb390fe5..2c8106b5a5 100644 --- a/src/Neo.CLI/config.fs.testnet.json +++ b/src/Neo.CLI/config.fs.testnet.json @@ -31,8 +31,8 @@ "ProtocolConfiguration": { "Network": 91466898, "AddressVersion": 53, - "MillisecondsPerBlock": 15000, - "MaxTransactionsPerBlock": 512, + "MillisecondsPerBlock": 3000, + "MaxTransactionsPerBlock": 256, "MemoryPoolMaxTransactions": 50000, "MaxTraceableBlocks": 17280, "InitialGasDistribution": 5200000000000000, diff --git a/src/Neo.CLI/config.testnet.json b/src/Neo.CLI/config.testnet.json index ecd0a8e65c..5a325034ed 100644 --- a/src/Neo.CLI/config.testnet.json +++ b/src/Neo.CLI/config.testnet.json @@ -31,8 +31,8 @@ "ProtocolConfiguration": { "Network": 894710606, "AddressVersion": 53, - "MillisecondsPerBlock": 15000, - "MaxTransactionsPerBlock": 5000, + "MillisecondsPerBlock": 3000, + "MaxTransactionsPerBlock": 256, "MemoryPoolMaxTransactions": 50000, "MaxTraceableBlocks": 2102400, "Hardforks": { diff --git a/src/Neo/ProtocolSettings.cs b/src/Neo/ProtocolSettings.cs index f07df4761f..0b5b950363 100644 --- a/src/Neo/ProtocolSettings.cs +++ b/src/Neo/ProtocolSettings.cs @@ -70,7 +70,7 @@ public record ProtocolSettings /// /// The maximum increment of the field. /// - public uint MaxValidUntilBlockIncrement => 86400000 / MillisecondsPerBlock; + public uint MaxValidUntilBlockIncrement => 86400000 / MillisecondsPerBlock; //TODO keep the same?? /// /// Indicates the maximum number of transactions that can be contained in a block. @@ -114,8 +114,8 @@ public record ProtocolSettings StandbyCommittee = Array.Empty(), ValidatorsCount = 0, SeedList = Array.Empty(), - MillisecondsPerBlock = 15000, - MaxTransactionsPerBlock = 512, + MillisecondsPerBlock = 3000, + MaxTransactionsPerBlock = 256, MemoryPoolMaxTransactions = 50_000, MaxTraceableBlocks = 2_102_400, InitialGasDistribution = 52_000_000_00000000, diff --git a/src/Neo/SmartContract/Native/NeoToken.cs b/src/Neo/SmartContract/Native/NeoToken.cs index 600bb5c3fe..58c4e370c9 100644 --- a/src/Neo/SmartContract/Native/NeoToken.cs +++ b/src/Neo/SmartContract/Native/NeoToken.cs @@ -206,7 +206,10 @@ internal override ContractTask InitializeAsync(ApplicationEngine engine, Hardfor engine.SnapshotCache.Add(CreateStorageKey(Prefix_Committee), new StorageItem(cachedCommittee)); engine.SnapshotCache.Add(_votersCount, new StorageItem(System.Array.Empty())); engine.SnapshotCache.Add(CreateStorageKey(Prefix_GasPerBlock).AddBigEndian(0u), new StorageItem(5 * GAS.Factor)); + // TODO - Add hardfork otherwise storage will be different + // After HARD FORK engine.SnapshotCache.Add(_registerPrice, new StorageItem(1000 * GAS.Factor)); + return Mint(engine, Contract.GetBFTAddress(engine.ProtocolSettings.StandbyValidators), TotalAmount, false); } return ContractTask.CompletedTask; diff --git a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.Check.cs b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.Check.cs index 5349c2c41d..87d6e0ee74 100644 --- a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.Check.cs +++ b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.Check.cs @@ -46,8 +46,8 @@ private bool CheckPrepareResponse() } // Timeout extension due to prepare response sent - // around 2*15/M=30.0/5 ~ 40% block time (for M=5) - ExtendTimerByFactor(2); + // around 4*3/M=12.0/5 ~ 80% block time (for M=5) + ExtendTimerByFactor(4); Log($"Sending {nameof(PrepareResponse)}"); localNode.Tell(new LocalNode.SendDirectly { Inventory = context.MakePrepareResponse() }); diff --git a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs index 04cf4797c0..2a3acb5c87 100644 --- a/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs +++ b/src/Plugins/DBFTPlugin/Consensus/ConsensusService.OnMessage.cs @@ -95,8 +95,8 @@ private void OnPrepareRequestReceived(ExtensiblePayload payload, PrepareRequest } // Timeout extension: prepare request has been received with success - // around 2*15/M=30.0/5 ~ 40% block time (for M=5) - ExtendTimerByFactor(2); + // around 4*3/M=12.0/5 ~ 80% block time (for M=5) + ExtendTimerByFactor(4); context.Block.Header.Timestamp = message.Timestamp; context.Block.Header.Nonce = message.Nonce; @@ -171,8 +171,8 @@ private void OnPrepareResponseReceived(ExtensiblePayload payload, PrepareRespons return; // Timeout extension: prepare response has been received with success - // around 2*15/M=30.0/5 ~ 40% block time (for M=5) - ExtendTimerByFactor(2); + // around 4*3/M=12.0/5 ~ 80% block time (for M=5) + ExtendTimerByFactor(4); Log($"{nameof(OnPrepareResponseReceived)}: height={message.BlockIndex} view={message.ViewNumber} index={message.ValidatorIndex}"); context.PreparationPayloads[message.ValidatorIndex] = payload; @@ -210,8 +210,8 @@ private void OnCommitReceived(ExtensiblePayload payload, Commit commit) if (commit.ViewNumber == context.ViewNumber) { // Timeout extension: commit has been received with success - // around 4*15s/M=60.0s/5=12.0s ~ 80% block time (for M=5) - ExtendTimerByFactor(4); + // around 6*3s/M=18.0s/5=12.0s ~ 120% block time (for M=5) + ExtendTimerByFactor(6); Log($"{nameof(OnCommitReceived)}: height={commit.BlockIndex} view={commit.ViewNumber} index={commit.ValidatorIndex} nc={context.CountCommitted} nf={context.CountFailed}"); diff --git a/src/Plugins/StateService/Verification/VerificationContext.cs b/src/Plugins/StateService/Verification/VerificationContext.cs index aa4e626527..37b0f46b81 100644 --- a/src/Plugins/StateService/Verification/VerificationContext.cs +++ b/src/Plugins/StateService/Verification/VerificationContext.cs @@ -27,7 +27,7 @@ namespace Neo.Plugins.StateService.Verification { class VerificationContext { - private const uint MaxValidUntilBlockIncrement = 100; + private const uint MaxValidUntilBlockIncrement = 100; // Change to 500!?? private StateRoot root; private ExtensiblePayload rootPayload; private ExtensiblePayload votePayload; diff --git a/tests/Neo.Network.RPC.Tests/RpcTestCases.json b/tests/Neo.Network.RPC.Tests/RpcTestCases.json index 623b59f0d9..455bafe528 100644 --- a/tests/Neo.Network.RPC.Tests/RpcTestCases.json +++ b/tests/Neo.Network.RPC.Tests/RpcTestCases.json @@ -3148,7 +3148,7 @@ "protocol": { "network": 0, "validatorscount": 0, - "msperblock": 15000, + "msperblock": 3000, "maxvaliduntilblockincrement": 1, "maxtraceableblocks": 1, "addressversion": 0, diff --git a/tests/Neo.Plugins.OracleService.Tests/config.json b/tests/Neo.Plugins.OracleService.Tests/config.json index edcd76127a..a59f24f16a 100644 --- a/tests/Neo.Plugins.OracleService.Tests/config.json +++ b/tests/Neo.Plugins.OracleService.Tests/config.json @@ -30,8 +30,8 @@ "ProtocolConfiguration": { "Network": 5195086, "AddressVersion": 53, - "MillisecondsPerBlock": 15000, - "MaxTransactionsPerBlock": 512, + "MillisecondsPerBlock": 3000, + "MaxTransactionsPerBlock": 256, "MemoryPoolMaxTransactions": 50000, "MaxTraceableBlocks": 2102400, "Hardforks": { diff --git a/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs b/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs index 118747340c..156f3dc29d 100644 --- a/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs +++ b/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs @@ -838,7 +838,7 @@ public void TestEconomicParameter() (BigInteger, bool) result = Check_GetGasPerBlock(clonedCache, persistingBlock); Assert.IsTrue(result.Item2); - Assert.AreEqual(5 * NativeContract.GAS.Factor, result.Item1); + Assert.AreEqual(5 * NativeContract.GAS.Factor, result.Item1); // Test should occur with all hardfork enable TODO persistingBlock = new Block { Header = new Header { Index = 10 } }; (VM.Types.Boolean, bool) result1 = Check_SetGasPerBlock(clonedCache, 10 * NativeContract.GAS.Factor, persistingBlock); diff --git a/tests/Neo.UnitTests/UT_ProtocolSettings.cs b/tests/Neo.UnitTests/UT_ProtocolSettings.cs index 9c6de902f1..d7cc7cc4b2 100644 --- a/tests/Neo.UnitTests/UT_ProtocolSettings.cs +++ b/tests/Neo.UnitTests/UT_ProtocolSettings.cs @@ -48,7 +48,7 @@ public void TestGetMemoryPoolMaxTransactions() [TestMethod] public void TestGetMillisecondsPerBlock() { - Assert.AreEqual((uint)15000, (uint)TestProtocolSettings.Default.MillisecondsPerBlock); + Assert.AreEqual((uint)3000, (uint)TestProtocolSettings.Default.MillisecondsPerBlock); } [TestMethod] @@ -133,8 +133,8 @@ internal static string CreateHFSettings(string hf) ""ProtocolConfiguration"": { ""Network"": 860833102, ""AddressVersion"": 53, - ""MillisecondsPerBlock"": 15000, - ""MaxTransactionsPerBlock"": 512, + ""MillisecondsPerBlock"": 3000, + ""MaxTransactionsPerBlock"": 256, ""MemoryPoolMaxTransactions"": 50000, ""MaxTraceableBlocks"": 2102400, ""Hardforks"": { diff --git a/tests/Neo.UnitTests/test.config.json b/tests/Neo.UnitTests/test.config.json index 0d2f885da6..e502c0b703 100644 --- a/tests/Neo.UnitTests/test.config.json +++ b/tests/Neo.UnitTests/test.config.json @@ -25,8 +25,8 @@ "ProtocolConfiguration": { "Network": 860833102, "AddressVersion": 53, - "MillisecondsPerBlock": 15000, - "MaxTransactionsPerBlock": 512, + "MillisecondsPerBlock": 3000, + "MaxTransactionsPerBlock": 256, "MemoryPoolMaxTransactions": 50000, "MaxTraceableBlocks": 2102400, "Hardforks": {},