-
Notifications
You must be signed in to change notification settings - Fork 1k
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
CONSENSUS: dBFT 3.0 with double speakers model #3254
base: master
Are you sure you want to change the base?
Conversation
Built, tested and working perfect again! Here is an alternative client for anyway interested in testing dBFT 3.0 with double speakers model |
{ | ||
return Transactions.Values.Sum(u => u.SystemFee); // Sum Txs | ||
return Transactions[pId].Values.Sum(u => u.SystemFee); // Sum Txs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you should add some kind of error TryCatch
to catch if KeyNotFound
or InvalidIndex
on pId
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you create a PR trying to improve that? Pointing to this branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can, will be later though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @ZhangTao1596
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What should the value
be when it errors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transactions[1] = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets say this method crashes cause of IndexOutOfRangeException
than what?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Transactions[pID] = transactions.Length == 0 && !RequestSentOrReceived ? null : transactions.ToDictionary(p => p.Hash);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This loop here
neo/src/Plugins/DBFTPlugin/Consensus/ConsensusContext.cs
Lines 320 to 347 in 20d0b49
for (uint pID = 0; pID <= 1; pID++) | |
{ | |
if (ViewNumber > 0 && pID > 0) break; | |
if (reader.ReadUInt32() != Block[pID].Version) throw new FormatException(); | |
if (reader.ReadUInt32() != Block[pID].Index) throw new InvalidOperationException(); | |
Block[pID].Header.Timestamp = reader.ReadUInt64(); | |
Block[pID].Header.Nonce = reader.ReadUInt64(); | |
Block[pID].Header.PrimaryIndex = reader.ReadByte(); | |
Block[pID].Header.NextConsensus = reader.ReadSerializable<UInt160>(); | |
if (Block[pID].NextConsensus.Equals(UInt160.Zero)) | |
Block[pID].Header.NextConsensus = null; | |
TransactionHashes[pID] = reader.ReadSerializableArray<UInt256>(ushort.MaxValue); | |
Transaction[] transactions = reader.ReadSerializableArray<Transaction>(ushort.MaxValue); | |
PreparationPayloads[pID] = reader.ReadNullableArray<ExtensiblePayload>(neoSystem.Settings.ValidatorsCount); | |
PreCommitPayloads[pID] = reader.ReadNullableArray<ExtensiblePayload>(neoSystem.Settings.ValidatorsCount); | |
CommitPayloads[pID] = reader.ReadNullableArray<ExtensiblePayload>(neoSystem.Settings.ValidatorsCount); | |
if (TransactionHashes[pID].Length == 0 && !RequestSentOrReceived) | |
TransactionHashes[pID] = null; | |
Transactions[pID] = transactions.Length == 0 && !RequestSentOrReceived ? null : transactions.ToDictionary(p => p.Hash); | |
VerificationContext[pID] = new TransactionVerificationContext(); | |
if (Transactions[pID] != null) | |
{ | |
foreach (Transaction tx in Transactions[pID].Values) | |
VerificationContext[pID].AddTransaction(tx); | |
} | |
} |
Migrated from neo-project/neo-modules#680
close #2029
dBFT 3.0 - Part I of NeoResearch's researching on consensus improvements. @igormcoelho
Part II will later involve changes in governance and decentralization, in particular, considering the ability to always have a fallback Speaker/Primary.