Skip to content

Conversation

@shargon
Copy link
Member

@shargon shargon commented Nov 11, 2025

Description

Close #4143
This PR will require a transaction from the DBFT plugin to ensure the node life.

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • Unit Testing
  • Run Application
  • Local Computer Tests
  • No Testing

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@shargon
Copy link
Member Author

shargon commented Nov 11, 2025

Please @neo-project/core take a look to this PR, we should decide the right values for PoW and frequency. Maybe we should move this values to policy: Difficult and frequency

if (!state.Registered)
throw new Exception("Only registered candidates are availables");

if (proofOfWork.ToString().StartsWith("0x0000")) // TODO: Decide the proper value
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need a proof of work at all here? What does it prove?

Copy link
Member

Choose a reason for hiding this comment

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

I believe it is for all committee , not only CN

Copy link
Member Author

Choose a reason for hiding this comment

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

Cn could be set every time he is the primary

Copy link
Member Author

Choose a reason for hiding this comment

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

Why do we need a proof of work at all here? What does it prove?

Proof that the committee has a node

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, this doesn't prove there is a node. I can separate this code from the node. My point is that a transaction is sufficient. Adding any calculations would be a serious regression for Neo and it wouldn't add any benefit.

Copy link
Member Author

Choose a reason for hiding this comment

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

I also think we don't need to introduce proof of work.

What's your proposal? Regular tx is easy to fake. I thought an idea but it's incompatible with huge amount of committee (outside 21).

If committee produce a signature of the previous block, the primary can choose this rpc signatures and use them as a proof when they persist the block.

Copy link
Member

Choose a reason for hiding this comment

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

@shargon @erikzhang , do you know? Double speakers would be perfect for that because we could, every round, make a committee to be a speaker and do round robin on that.

So, every member would need to be ready. Double speakers do that without any problems because they would be fallback. Based on node's statistics we would know the truth.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's only work for 21, no for outside 21

Copy link
Member

Choose a reason for hiding this comment

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

I believe that if a node deliberately pretends to be online while refusing to participate in the consensus process, there is essentially no reliable way for us to detect such behavior. Therefore, the primary purpose of “proof of node” should not be to identify malicious non-participation. Instead, it should focus on preventing accidental misconfigurations by candidates—such as forgetting to run the node, failing to start the consensus module, or unintentionally launching multiple consensus instances.

Copy link
Member Author

Choose a reason for hiding this comment

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

Then only a tx is good for you, and maybe a counter of how many view changes?

@Wi1l-B0t
Copy link
Contributor

Wi1l-B0t commented Nov 13, 2025

Could you give a detailed description for this feature ?

@shargon
Copy link
Member Author

shargon commented Nov 13, 2025

Could you give a detailed description for this feature ?

neo-project/proposals#211

@shargon shargon marked this pull request as ready for review November 13, 2025 10:32
Copy link
Member

@vncoelho vncoelho left a comment

Choose a reason for hiding this comment

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

@shargon , how about information for current state of MPT?

@shargon
Copy link
Member Author

shargon commented Nov 13, 2025

@shargon , how about information for current state of MPT?

The problem I see is that almost all the information can be easily accessed via RPC. That's the reason for Proof of Work.
A different approach is this: neo-project/proposals#211 (comment)

}

[ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States)]
private void SetProofOfNodeDifficulty(ApplicationEngine engine, ulong value)
Copy link
Member Author

Choose a reason for hiding this comment

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

@roman-khimov if difficulty is set to 0xFFFFFFFFFFFFFFFF you don't need a PoW.

Copy link
Member

@vncoelho vncoelho Nov 15, 2025

Choose a reason for hiding this comment

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

I do not know, @shargon,
I do not support this PoW here.

I can support it on transactions to improve ordering.
I can support this of P2P propagation priorities.

But a PoW here, as @roman-khimov said, can be done by a different software and do not represent the readiness of a committee.
I do not understand your reasoning very well and the motivation behind this.

I would prefer, as I emphasized in the proposal, some up-to-date signatures from commit payloads, each of them specific to the node.
This at least says, in the same way as PoW, that committee is running some software and signing txs.

Copy link
Member Author

@shargon shargon Nov 17, 2025

Choose a reason for hiding this comment

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

A small proof of work to proof that you have the right hardware and it was not done manually. Is not for every blocks, so I don't see any problem

@shargon shargon changed the base branch from master to master-n3 November 14, 2025 18:22
@shargon shargon added Waiting for Review NGD Review This pr is an UT/Benchmark PR, NGD can review. neo3 labels Nov 14, 2025
@shargon shargon changed the title Proof of node [N3] Proof of node Nov 14, 2025
@shargon shargon mentioned this pull request Nov 14, 2025
18 tasks
@shargon shargon added N3 and removed neo3 labels Nov 17, 2025
@Wi1l-B0t
Copy link
Contributor

Conflicts

@ajara87
Copy link
Member

ajara87 commented Nov 30, 2025

Fix conflicts on shargon#18

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

N3 NGD Review This pr is an UT/Benchmark PR, NGD can review. Waiting for Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure Committee activity

6 participants