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

CONSENSUS: dBFT 3.0 with double speakers model #3254

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

vncoelho
Copy link
Member

@vncoelho vncoelho commented May 21, 2024

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.

@vncoelho vncoelho added Enhancement Type - Changes that may affect performance, usability or add new features to existing modules. Feature Type: Large changes or new features Consensus Module - Changes that affect the consensus protocol or internal verification logic labels May 21, 2024
@vncoelho
Copy link
Member Author

Built, tested and working perfect again!

Here is an alternative client for anyway interested in testing dBFT 3.0 with double speakers model
https://github.com/NeoResearch/neo-tests/blob/master/releases/neo-release-3.8.0-all-plugins-preview1-monorepo-dbft3.0.zip

{
return Transactions.Values.Sum(u => u.SystemFee); // Sum Txs
return Transactions[pId].Values.Sum(u => u.SystemFee); // Sum Txs
Copy link
Member

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

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Member Author

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);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop here

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);
}
}

@Jim8y Jim8y added Wait Technical Committee and removed Feature Type: Large changes or new features labels Jun 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Consensus Module - Changes that affect the consensus protocol or internal verification logic Enhancement Type - Changes that may affect performance, usability or add new features to existing modules. Wait Technical Committee
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dBFT 3.0 Specification
3 participants