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

Use new hashing service #2896

Merged

Conversation

Mihajlo-Pavlovic
Copy link
Collaborator

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • 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?

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

  • Test A
  • Test B

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

…simulation' into test/hash-and-scoredistnace-function-id
…simulation' into feature/use-new-hashing-service
@NZT48 NZT48 changed the title Feature/use new hashing service Use new hashing service Jan 30, 2024

let neighbourhoodEdges = null;
if (serviceAgreement.scoreFunctionId === 2) {
neighbourhoodEdges = await this.shardingTableService.getNeighboorhoodEdgeNodes(
Copy link
Member

Choose a reason for hiding this comment

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

Let's keep American version neighborhood consistently everywhere

Suggested change
neighbourhoodEdges = await this.shardingTableService.getNeighboorhoodEdgeNodes(
neighborhoodEdges = await this.shardingTableService.getNeighborhoodEdgeNodes(

COMMIT_MANAGER_V1_U1_CONTRACT: 'CommitManagerV1U1Contract',
SERVICE_AGREEMENT_V1_CONTRACT: 'ServiceAgreementV1Contract',
PARAMETERS_STORAGE_CONTRACT: 'ParametersStorageContract',
IDENTITY_STORAGE_CONTRACT: 'IdentityStorageContract',
Log2PLDSF: 'Log2PLDSF',
Copy link
Member

Choose a reason for hiding this comment

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

This won't work as we don't listen to the events from this contract + it should be handled in a different way comparing to other contracts as we get parameters with one getter, but set them with different setters

@@ -49,6 +49,7 @@ class PullBlockchainShardingTableMigration extends BaseMigration {
...nodes.slice(sliceIndex).filter((node) => node.nodeId !== '0x'),
);
sliceIndex = 1;
// TODO: Should we fix it here also
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what is meant by this

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not valid anymore, this comment should be removed

@@ -41,18 +41,20 @@ const ABIs = {
ProfileStorage: require('dkg-evm-module/abi/ProfileStorage.json'),
ScoringProxy: require('dkg-evm-module/abi/ScoringProxy.json'),
ServiceAgreementV1: require('dkg-evm-module/abi/ServiceAgreementV1.json'),
CommitManagerV1: require('dkg-evm-module/abi/CommitManagerV1.json'),
CommitManagerV1U1: require('dkg-evm-module/abi/CommitManagerV1U1.json'),
CommitManagerV1: require('dkg-evm-module/abi/CommitManagerV2.json'),
Copy link
Member

Choose a reason for hiding this comment

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

Let's use exports from the package

ServiceAgreementStorageProxy: require('dkg-evm-module/abi/ServiceAgreementStorageProxy.json'),
UnfinalizedStateStorage: require('dkg-evm-module/abi/UnfinalizedStateStorage.json'),
LinearSum: require('dkg-evm-module/abi/LinearSum.json'),
};

const SCORING_FUNCTIONS = {
Copy link
Member

Choose a reason for hiding this comment

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

We can get it from the blockchain and cache it

);
}

async getLinearSumParams() {
Copy link
Member

Choose a reason for hiding this comment

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

This needs to be updated

@@ -67,6 +67,7 @@ class BlockchainEventListenerService {
currentBlock,
CONTRACT_EVENTS.PROFILE,
),
// TODO: Update with new commit managers
Copy link
Member

Choose a reason for hiding this comment

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

Remove the comment, not needed

@@ -110,7 +110,7 @@ class ProximityScoringService {
};
}

async LinearSum(blockchain, distance, stake, maxNeighborhoodDistance) {
async linearSum(blockchain, distance, stake, maxNeighborhoodDistance) {
Copy link
Member

Choose a reason for hiding this comment

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

Needs to be updated

this.log2PLDSFParams = await this.blockchainModuleManager.getLog2PLDSFParams(
let maxNeighborhoodDistance;
if (neighbourhoodEdges) {
maxNeighborhoodDistance = await this.proximityScoringService.callProximityFunction(
Copy link
Member

Choose a reason for hiding this comment

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

We should introduce ideal max distance here

);
peersWithDistance.sort((a, b) => {
Copy link
Member

Choose a reason for hiding this comment

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

Can be simplified

@NZT48 NZT48 merged commit c141ffd into feature/final-proximity-scoring-simulation Jan 30, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants