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

Lock chain before start mining #1394

Merged
merged 6 commits into from
Jan 26, 2024

Conversation

Neylix
Copy link
Member

@Neylix Neylix commented Jan 23, 2024

Description

This PR adds a new security layer before to start mining a transaction.
When receiving the StartMining message for a transaction, validation nodes request the storage nodes of this transaction to lock the address. If the address is already locked for the same address but with a different transaction data, the lock is refused and the validation node does not start the mining.

This PR does not handle malicious node which could still start the transaction mining even with no lock. And so ask the replication to storage nodes.
To handle this, the storage nodes could sign the lock request, and so the storage nodes will replication the transaction only if they have the proof of the request lock being signed by all storage nodes.

Fixes #1373

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Unit test
  • Create multiple transaction in the same chain => no problem
  • Create an invalid transaction send it and retry to validate it again after receiving the error => no problem, transaction still in error with the expected error
  • Create an invalid transaction send it, update it and retry to validate it again after receiving the error => no problem, transaction still in error with the expected error
  • Update the code so the node never unlock an address, and run the previous test => validation nodes return the error that the transaction is already locked with another data
  • Tested with high usage with benchmark => no problem

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own 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

@Neylix Neylix added mining Involve transaction validation and mining enhancements labels Jan 23, 2024
@bchamagne bchamagne added this to the 1.4.7 milestone Jan 26, 2024
@Neylix Neylix merged commit bab0471 into archethic-foundation:develop Jan 26, 2024
2 checks passed
@Neylix Neylix deleted the split-replication branch January 26, 2024 16:58
@Neylix Neylix added feature New feature request and removed enhancements labels Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request mining Involve transaction validation and mining
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split brain on a transaction
3 participants