Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basic dev container #885

Closed
wants to merge 63 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
e97daeb
Draft 0.1 for dBFT 3.0
vncoelho Dec 17, 2021
0343f4a
Moving on
vncoelho Dec 17, 2021
c432ffc
Moving on
vncoelho Dec 17, 2021
970e482
format
vncoelho Dec 17, 2021
01d033c
moving on
vncoelho Dec 17, 2021
02fa0b7
format
vncoelho Dec 17, 2021
5523a31
Adding new
vncoelho Dec 17, 2021
bbb33ae
More fix
vncoelho Dec 17, 2021
ab8eec2
Additional fix
vncoelho Dec 17, 2021
cad5562
General fixes
vncoelho Dec 17, 2021
43166ec
format
vncoelho Dec 17, 2021
94e42b4
Minor fix
vncoelho Dec 17, 2021
6d5939c
Minor fix fixed
vncoelho Dec 17, 2021
4489d37
Fixing conditions and other fixed variables
vncoelho Jan 17, 2022
bedb125
Format
vncoelho Jan 17, 2022
73626ac
Fixing state
vncoelho Jan 17, 2022
ff7a5a1
Merge branch 'master' into dbft3.0-doublespeakers
Jun 8, 2022
29e267b
fix build error
Jun 8, 2022
d0b1c75
optimize
Jun 8, 2022
d06424f
fix commitedcount
Jun 8, 2022
482d055
recovery contains PreCommit and P2 messages
Jun 9, 2022
d7f452a
fix OnStart and message sizes
Jun 10, 2022
ffc5771
optimize
Jun 10, 2022
52f0659
optimize primary check
Jun 10, 2022
40348e1
Round-Robin strategy 2
Jun 10, 2022
7a43c5c
rm comment
Jun 10, 2022
11a7747
clean
Jun 13, 2022
e2ad61e
apply https://github.com/neo-project/neo/issues/2058
Jun 14, 2022
6772a46
format
Jun 14, 2022
a811dcf
Merge branch 'master' into dbft3.0-doublespeakers
Jun 14, 2022
cc4b3d0
Merge branch 'master' into dbft3.0-doublespeakers
Aug 9, 2022
6d5daf5
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Aug 19, 2022
e86de2a
fix tx dump
Sep 1, 2022
c86f4ce
Merge branch 'master' into dbft3.0-doublespeakers
Sep 5, 2022
c2f0b02
fix
Sep 13, 2022
19d2810
clean
Sep 13, 2022
d524245
Initial fix on countcommitted and fix cleaning CommitPayloads after c…
vncoelho Sep 16, 2022
76f4253
pId
Sep 21, 2022
7009fa8
log
Sep 21, 2022
6e59214
ValidatorIndex in PrepareRequest of RecoveryMessage
Sep 21, 2022
f9f0465
Comment
vncoelho Sep 21, 2022
9324899
name
Sep 21, 2022
a91dd63
fix fallback primary index
Oct 8, 2022
e490566
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Nov 14, 2022
dc474fc
Merge branch 'master' into dbft3.0-doublespeakers
superboyiii Dec 6, 2022
8d3f65d
Merge branch 'master' into dbft3.0-doublespeakers
superboyiii Dec 12, 2022
0c7b5eb
Fix Null with basic logic following Owen finding
vncoelho Dec 14, 2022
a2df166
Format
vncoelho Dec 14, 2022
4e8c6ba
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Jan 27, 2023
78f3033
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Apr 5, 2023
5677567
Merge branch 'master' into dbft3.0-doublespeakers
superboyiii May 11, 2023
3f90ec4
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Oct 10, 2023
44c5d7c
format
vncoelho Oct 10, 2023
33aaeb3
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Oct 19, 2023
b13b6c4
Update ConsensusService.cs
vncoelho Oct 19, 2023
47f83fc
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Nov 21, 2023
d2e314a
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Jan 8, 2024
ff291f6
Merge branch 'master' into dbft3.0-doublespeakers
Jim8y Feb 17, 2024
7aa1b45
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Feb 22, 2024
cb370f1
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Feb 24, 2024
d2c4e6a
Merge branch 'master' into dbft3.0-doublespeakers
vncoelho Mar 12, 2024
8b493f2
dotnet format
vncoelho Mar 12, 2024
1de3137
Basic devcontainer
vncoelho Mar 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
optimize
ZhangTao1596 committed Jun 10, 2022

Verified

This commit was signed with the committer’s verified signature.
simeonschaub Simeon David Schaub
commit ffc57719762f1bdc6b395f41419fd4ccf237ddaa
13 changes: 6 additions & 7 deletions src/DBFTPlugin/Consensus/ConsensusContext.cs
Original file line number Diff line number Diff line change
@@ -73,7 +73,7 @@ public partial class ConsensusContext : IDisposable, ISerializable
public static float PrimaryTimerPriorityMultiplier => 1;
public static float PrimaryTimerFallBackMultiplier => (float)4 / 3;
public float PrimaryTimerMultiplier => IsPriorityPrimary ? PrimaryTimerPriorityMultiplier : PrimaryTimerFallBackMultiplier;
public bool IsBackup => MyIndex >= 0 && !IsPriorityPrimary && !IsFallbackPrimary;
public bool IsBackup => MyIndex >= 0 && !IsPriorityPrimary && (ViewNumber > 0 || !IsFallbackPrimary);
public bool WatchOnly => MyIndex < 0;
public Header PrevHeader => NativeContract.Ledger.GetHeader(Snapshot, Block[0].PrevHash);
public int CountCommitted => ViewNumber == 0 ? Math.Max(CommitPayloads[0].Count(p => p != null), CommitPayloads[1].Count(p => p != null)) : CommitPayloads[0].Count(p => p != null);
@@ -98,7 +98,7 @@ public bool ValidatorsChanged
}

#region Consensus States
public bool RequestSentOrReceived => PreparationPayloads[0][GetPriorityPrimaryIndex(ViewNumber)] != null || (ViewNumber == 0 && PreparationPayloads[1][GetFallbackPrimaryIndex(0)] != null);
public bool RequestSentOrReceived => PreparationPayloads[0][Block[0].PrimaryIndex] != null || (ViewNumber == 0 && PreparationPayloads[1][Block[1].PrimaryIndex] != null);
public bool ResponseSent => !WatchOnly && (PreparationPayloads[0][MyIndex] != null || (ViewNumber == 0 && PreparationPayloads[1][MyIndex] != null));
public bool PreCommitSent => !WatchOnly && (PreCommitPayloads[0][MyIndex] != null || (ViewNumber == 0 && PreCommitPayloads[1][MyIndex] != null));
public bool CommitSent => !WatchOnly && (CommitPayloads[0][MyIndex] != null || (ViewNumber == 0 && CommitPayloads[1][MyIndex] != null));
@@ -228,11 +228,6 @@ public void Reset(byte viewNumber)
}
}
MyIndex = -1;
for (uint i = 0; i <= 1; i++)
{
PreCommitPayloads[i] = new ExtensiblePayload[Validators.Length];
CommitPayloads[i] = new ExtensiblePayload[Validators.Length];
}
ChangeViewPayloads = new ExtensiblePayload[Validators.Length];
LastChangeViewPayloads = new ExtensiblePayload[Validators.Length];
if (ValidatorsChanged || LastSeenMessage is null)
@@ -265,6 +260,8 @@ public void Reset(byte viewNumber)
Block[pID].Transactions = null;
TransactionHashes[pID] = null;
PreparationPayloads[pID] = new ExtensiblePayload[Validators.Length];
PreCommitPayloads[pID] = new ExtensiblePayload[Validators.Length];
CommitPayloads[pID] = new ExtensiblePayload[Validators.Length];
if (MyIndex >= 0) LastSeenMessage[Validators[MyIndex]] = Block[pID].Index;
}
Block[0].Header.PrimaryIndex = GetPriorityPrimaryIndex(viewNumber);
@@ -284,6 +281,8 @@ public void Reset(byte viewNumber)
Block[0].Transactions = null;
TransactionHashes[0] = null;
PreparationPayloads[0] = new ExtensiblePayload[Validators.Length];
PreCommitPayloads[0] = new ExtensiblePayload[Validators.Length];
CommitPayloads[0] = new ExtensiblePayload[Validators.Length];
if (MyIndex >= 0) LastSeenMessage[Validators[MyIndex]] = Block[0].Index;
Block[0].Header.PrimaryIndex = GetPriorityPrimaryIndex(viewNumber);

17 changes: 11 additions & 6 deletions src/DBFTPlugin/Consensus/ConsensusService.cs
Original file line number Diff line number Diff line change
@@ -171,12 +171,14 @@ private void OnStart()

private void OnTimer(Timer timer)
{
uint pID = Convert.ToUInt32(!(context.IsPriorityPrimary || context.ViewNumber > 0));
if (context.WatchOnly || context.BlockSent) return;
if (timer.Height != context.Block[pID].Index || timer.ViewNumber != context.ViewNumber) return;
if (timer.Height != context.Block[0].Index || timer.ViewNumber != context.ViewNumber) return;
if (context.IsAPrimary && !context.RequestSentOrReceived)
{
SendPrepareRequest(pID);
if (context.IsPriorityPrimary)
SendPrepareRequest(0);
else
SendPrepareRequest(1);
}
else if ((context.IsAPrimary && context.RequestSentOrReceived) || context.IsBackup)
{
@@ -190,10 +192,13 @@ private void OnTimer(Timer timer)
else
{
var reason = ChangeViewReason.Timeout;

if (context.Block[pID] != null && context.TransactionHashes[pID]?.Length > context.Transactions[pID]?.Count)
if (context.RequestSentOrReceived)
{
reason = ChangeViewReason.TxNotFound;
var pId = context.PreparationPayloads[0][context.Block[0].PrimaryIndex] != null ? 0u : 1u;
if (context.Block[pId] != null && context.TransactionHashes[pId]?.Length > context.Transactions[pId]?.Count)
{
reason = ChangeViewReason.TxNotFound;
}
}

RequestChangeView(reason);