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

Add geopatch to node transactions #1605

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

wassimans
Copy link

@wassimans wassimans commented Nov 24, 2024

Description

This pull request introduces the systematic addition of a geopatch to node transactions. This change ensures that the geopatch is included in node transactions and validated during the transaction lifecycle.

The update impacts the election of storage and validation nodes, as it now relies on the validated geopatch from node transactions rather than local calculations. This approach resolves inconsistencies caused by potential updates to the MMDB2 database.

This change introduces:
• The inclusion of the geopatch in node transactions.
• Migration script to add the geopatch to existing nodes transactions.
• Updated tests to validate the geopatch functionality.
• Enhanced core modules for encoding, decoding, and validating geopatches.

Fixes #1576 #1613

Type of change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Functional Tests

  • Functionally validated the migration script by running it on a network of test nodes.
  • Verified the inclusion of the geopatch in updated transactions and ensured proper validation in subsequent operations.
  • Transaction Content Validation: Validated that node transactions include geopatch information and that it is correctly decoded during transaction processing.
  • Invalid Geopatch Handling: Ensured that transactions with invalid geopatches are rejected.

Unit Tests

  • Enhanced existing test cases for Node.encode_transaction_content/1 and Node.decode_transaction_content/1 to include geopatch validation.
  • Added new tests in GeoPatchTest for geopatch calculation and decoding.

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

@wassimans wassimans added P2P Involve P2P networking enhancements election labels Nov 24, 2024
@wassimans wassimans requested a review from Neylix November 24, 2024 18:24
@wassimans wassimans force-pushed the feature/add-geopatch-in-node-transaction branch from 98184eb to 923859f Compare November 25, 2024 08:01
lib/archethic/bootstrap.ex Outdated Show resolved Hide resolved
lib/archethic/p2p/node.ex Outdated Show resolved Hide resolved
mix.exs Outdated Show resolved Hide resolved
test/archethic/mining/distributed_workflow_test.exs Outdated Show resolved Hide resolved
@Neylix Neylix force-pushed the feature/add-geopatch-in-node-transaction branch from 5c8b269 to 57be8b7 Compare February 7, 2025 10:12
@Neylix Neylix linked an issue Feb 7, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
election enhancements P2P Involve P2P networking
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Node update infos Add Geopatch in node transaction
2 participants