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 9dc2d3b72f..505dd8985e 100644 --- a/src/Neo.CLI/config.fs.testnet.json +++ b/src/Neo.CLI/config.fs.testnet.json @@ -30,8 +30,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 dc102be54b..4057bac48f 100644 --- a/src/Neo.CLI/config.testnet.json +++ b/src/Neo.CLI/config.testnet.json @@ -30,8 +30,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 19011dc24c..d13dee5bb4 100644 --- a/src/Neo/ProtocolSettings.cs +++ b/src/Neo/ProtocolSettings.cs @@ -69,7 +69,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. @@ -113,8 +113,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 f0321897f2..7a2043a24f 100644 --- a/src/Neo/SmartContract/Native/NeoToken.cs +++ b/src/Neo/SmartContract/Native/NeoToken.cs @@ -193,7 +193,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 c6ba86ee86..71bd904be2 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 b00fdd9393..456cc1ed71 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 feaf591795..bdea3c9e40 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 2ff07d5a69..853d3e379a 100644 --- a/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs +++ b/tests/Neo.UnitTests/SmartContract/Native/UT_NeoToken.cs @@ -744,7 +744,7 @@ public void TestEconomicParameter() (BigInteger, bool) result = Check_GetGasPerBlock(clonedCache, persistingBlock); result.Item2.Should().BeTrue(); - result.Item1.Should().Be(5 * NativeContract.GAS.Factor); + result.Item1.Should().Be(5 * NativeContract.GAS.Factor); // 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 97a36e5907..1481d5d517 100644 --- a/tests/Neo.UnitTests/UT_ProtocolSettings.cs +++ b/tests/Neo.UnitTests/UT_ProtocolSettings.cs @@ -46,7 +46,7 @@ public void TestGetMemoryPoolMaxTransactions() [TestMethod] public void TestGetMillisecondsPerBlock() { - TestProtocolSettings.Default.MillisecondsPerBlock.Should().Be(15000); + TestProtocolSettings.Default.MillisecondsPerBlock.Should().Be(3000); } [TestMethod] @@ -131,8 +131,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": {},