Conversation
| { | ||
| LastBlockIndex = height, | ||
| Timestamp = DateTime.UtcNow.ToTimestamp(), | ||
| Timestamp = DateTime.UtcNow.ToTimestampMS(), |
There was a problem hiding this comment.
Maybe we can leave the Ping in seconds.
There was a problem hiding this comment.
It is better to leave everything using the same "unit", what do you think?
| Magic = ProtocolSettings.Default.Magic, | ||
| Version = LocalNode.ProtocolVersion, | ||
| Timestamp = DateTime.Now.ToTimestamp(), | ||
| Timestamp = DateTime.Now.ToTimestampMS(), |
There was a problem hiding this comment.
Maybe we can leave the version payload in seconds as well.
Codecov Report
@@ Coverage Diff @@
## master #918 +/- ##
==========================================
- Coverage 45.53% 45.47% -0.06%
==========================================
Files 178 178
Lines 12635 12639 +4
==========================================
- Hits 5753 5748 -5
- Misses 6882 6891 +9
Continue to review full report at Codecov.
|
neo.UnitTests/UT_Consensus.cs
Outdated
| Console.WriteLine($"header {header} hash {header.Hash} timstamp {timestampVal}"); | ||
|
|
||
| timestampVal.Should().Be(4244941696); //1968-06-01 00:00:00 | ||
| timestampVal.Should().Be(1514007552); //1968-06-01 00:00:00 |
There was a problem hiding this comment.
@igormcoelho, can you check this adjustment on these tests? I just copied the new generated timestamp.
There was a problem hiding this comment.
This doesn't look right... it should increase, never decrease 😂 probably, it is overflowing some int32 size (should be int64 or long, at least).
There was a problem hiding this comment.
kkkkkkkkkkk
I knew that....
Things need all be long for us. Ram never was a problem when things have vallgrind.
There was a problem hiding this comment.
What is this date?
How did you guys manage to make 4244941696 be 1968-06-01 00:00:00? Seems weird to me. Maybe the tests were broken all this time?
neo/Consensus/ConsensusService.cs
Outdated
| private void ExtendTimerByFactor(int maxDelayInBlockTimes) | ||
| { | ||
| TimeSpan nextDelay = expected_delay - (TimeProvider.Current.UtcNow - clock_started) + TimeSpan.FromMilliseconds(maxDelayInBlockTimes * Blockchain.SecondsPerBlock * 1000.0 / context.M); | ||
| TimeSpan nextDelay = expected_delay - (TimeProvider.Current.UtcNow - clock_started) + TimeSpan.FromMilliseconds(maxDelayInBlockTimes * Blockchain.MillisecondsPerBlock * 1000 / context.M); |
There was a problem hiding this comment.
Does we need to include this .0 for forcing to float?
lock9
left a comment
There was a problem hiding this comment.
Fix the dates - We should use 01/01/1970 00:00:00 instead of 01/06/1968 00:00
Use ulong instead of uint.
neo.UnitTests/UT_Consensus.cs
Outdated
| Console.WriteLine($"header {header} hash {header.Hash} timstamp {timestampVal}"); | ||
|
|
||
| timestampVal.Should().Be(4244941696); //1968-06-01 00:00:00 | ||
| timestampVal.Should().Be(1514007552); //1968-06-01 00:00:00 |
There was a problem hiding this comment.
What is this date?
How did you guys manage to make 4244941696 be 1968-06-01 00:00:00? Seems weird to me. Maybe the tests were broken all this time?
| { | ||
| LastBlockIndex = height, | ||
| Timestamp = DateTime.UtcNow.ToTimestamp(), | ||
| Timestamp = DateTime.UtcNow.ToTimestampMS(), |
There was a problem hiding this comment.
It is better to leave everything using the same "unit", what do you think?
…into seconds-to-milliseconds
|
Thanks, @lock9, I am thinking about still waiting a little bit more until @erikzhang and @shargon can give another last check. |
|
|
||
| if (blocksPersisted++ < blocksToPersistList.Count - (2 + Math.Max(0, (15 - SecondsPerBlock)))) continue; | ||
| // 15000 is the default among of seconds per block, while MilliSecondsPerBlock is the current | ||
| uint extraBlocks = (15000 - MillisecondsPerBlock) / 1000; |
There was a problem hiding this comment.
15000 is a hardcoded value, you should take this from the config
There was a problem hiding this comment.
That is right, it has been like this. I just adjusted to ms.
We can do that in another PR, for avoiding other possible mistakes.
Furthermore, I am not good with this config until nowdays...
There was a problem hiding this comment.
This, should take the value from the configuration
There was a problem hiding this comment.
I don't understand this logic very well ... why it used this?
There was a problem hiding this comment.
As faster the network is (privatenets with 1s) more blocks are rebroadcasted each time you Persist, limitted to 2+15.
|
It is possible, @shargon, however, the timestamp in seconds will also expire in 27 years...kkkkkkkk I think that it is ok as |
Co-Authored-By: Shargon <shargon@gmail.com>
|
i will review it tomorrow |
This was already from milliseconds, thus, just removing the multiplier
|
🚀 aheuaheuaea |
|
We should merge it when the tests come |
|
The basic UTs were accomplished. Furthermore, each time more we gonna have to work double because of conflicts between PRs, and after merged we can focused on the next idea. |
* Seconds to milliseconds * Sending unsaved files * fixing formula of consensus bonification * Refactoring milliseconds * Refactoring milliseconds from capeslock * Refactoring milliseconds from capeslock II * Adjusting UT * Adjusting UT II * Super fast protocol to 2s * Fixing timestamps to long and tests * Minor adjusts * Change view deserialization fix * Timestamp to ulong * Update neo/Helper.cs Co-Authored-By: Shargon <shargon@gmail.com> * Update JNumber.cs * Optimize and remove TODO * Update ApplicationEngine.cs * Fixing ExtendTimerByFactor This was already from milliseconds, thus, just removing the multiplier
Follow-up for 6604647 and 15a7927 to provide Neo 3 compatibility. Neo PR: neo-project/neo#918.
Follow-up for 6604647 and 15a7927 to provide Neo 3 compatibility. Neo PR: neo-project/neo#918.
closes #651
Let's review this with careful.
I believe it will be a great chance, in particular, for very lightweight local neo privatenets.