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

feat: occurrence support #793

Merged
merged 22 commits into from
Jun 13, 2022
Merged

Conversation

SamAg19
Copy link
Member

@SamAg19 SamAg19 commented Apr 28, 2022

fixes #43

@coveralls
Copy link

coveralls commented May 6, 2022

Coverage Status

Coverage decreased (-0.6%) to 97.427% when pulling 45296c7 on SamAg19:frequencies into a981f25 on razor-network:master.

@SamAg19 SamAg19 marked this pull request as ready for review May 9, 2022 12:02
uint32 collectionTolerance,
uint32 collectionAggregation
) external databondCreatorCheck(bondId, msg.sender) {
uint32 epoch = getEpoch();
Copy link
Member Author

Choose a reason for hiding this comment

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

minJobs as well

collections[collectionId].epochLastReported = epoch;
if (collections[collectionId].epochLastReported + collections[collectionId].occurrence != epoch + 1) {
// slither-disable-next-line costly-loop
numActiveCollections = numActiveCollections - 1;
Copy link
Member Author

@SamAg19 SamAg19 May 13, 2022

Choose a reason for hiding this comment

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

follow good-bad implementation provided by slither for costly loops

collections[collectionId].epochLastReported = epoch;
if (collections[collectionId].epochLastReported + collections[collectionId].occurrence != epoch + 1) {
// slither-disable-next-line costly-loop
numActiveCollections = numActiveCollections - 1;
Copy link
Member Author

Choose a reason for hiding this comment

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

follow good-bad implementation provided by slither

function setOccurrence() external override onlyRole(OCCURRENCE_CALCULATOR_ROLE) {
for (uint32 i = 1; i <= numDataBond; i++) {
if (databonds[i].active && databonds[i].bond >= minBond) {
uint256 occurrence = (databonds[i].jobIds.length * depositPerJob) / databonds[i].bond;
Copy link
Member Author

Choose a reason for hiding this comment

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

customisable bond not taken into consideration anymore here. check for desired occurrence is greater than permissible occurrence

function setOccurrence() external override onlyRole(OCCURRENCE_CALCULATOR_ROLE) {
for (uint32 i = 1; i <= numDataBond; i++) {
if (databonds[i].active && databonds[i].bond >= minBond) {
uint256 occurrence = (databonds[i].jobIds.length * depositPerJob) / databonds[i].bond;
Copy link
Member Author

Choose a reason for hiding this comment

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

customisable bond not taken into consideration anymore here. check for desired occurrence is greater than permissible occurrence

collectionManager.updateCollection(collectionId, tolerance, aggregationMethod, power, jobIds);
}

function addJobsToCollection(
Copy link
Member Author

Choose a reason for hiding this comment

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

calculate occurrence in places where databond collections are bing directly affected

collectionManager.updateCollection(collectionId, tolerance, aggregationMethod, power, jobIds);
}

function addJobsToCollection(
Copy link
Member Author

Choose a reason for hiding this comment

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

calculate occurrence in places where databond collections are bing directly affected

@SamAg19
Copy link
Member Author

SamAg19 commented May 16, 2022

Will work on the changes mentioned once issue #801 is fixed.

@SkandaBhat SkandaBhat marked this pull request as draft May 18, 2022 07:29
@SamAg19 SamAg19 requested a review from hrishikeshio May 19, 2022 19:10
@SamAg19 SamAg19 marked this pull request as ready for review May 19, 2022 19:10
@SkandaBhat
Copy link
Member

Please add natspec comments on Bond Manager @SamAg19

@SkandaBhat
Copy link
Member

@SamAg19 there have been multiple post deployment script errors reported by @shekhar2807 . Please fix them on priority.

@SkandaBhat SkandaBhat merged commit 0a4625e into razor-network:master Jun 13, 2022
SamAg19 added a commit that referenced this pull request Jul 29, 2022
* fix: updated and added comments on contracts (#789)

* fix: updated and added comments in stakeManager and interface

* fix: updated and added comments on contracts

* fix: updated comment in collectionManager contract

* feat: made getstate and getepoch functions public (#795)

* feat: made getstate and getepoch function public

* fix: linting errors

* fix: fixed naming issue in RandomNoManager

* feat: hardhat-deploy (#797)

* feat(hardhatdeploy): poc hardhat-deploy

integrate hardhat-deploy plugin to deploy test contract

* feat(hardhat-deploy): integrate hardhat-deploy plugin

deploy all Razor contracts using hardhat-deploy, update deploy.sh script

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove test contract

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove unnecessary changes

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove unnecessary changes

* fix(hardhat-deploy): fix current post deployment

wait for contract deployment file to updated

* fix(hardhat-deploy): migrate contracts setup

create shared folder for contracts initialisation and grant role

* feat(hardhat-deploy): post deployment test

add post deployment script test, 1 staker to vote for 1 epoch

* feat(hardhat-deploy): clean up

hotfix

* fix: lint fix and yarn.lock

* feat(hardhat-deploy): add deployment fixtures for tests

* fix(hardhat-deploy): fix circleci errors

* feat(hardhat-deploy): remove postdeployment test and deployment fixtures. Release hardhat-deploy

* feat(hardhat-deploy): use common deploy func, code modularisation

* feat(hardhat-deploy): circleci hotfix

* fix: clean up functions,rename deploy_all

* fix: postdeployment setup code clean up and fixes for failing init contract + same contract instance

* fix: update grant role to promise

* fix: add deploy readme

* fix: move to root folder

* fix: update content

* chore: removal of hardhat-truffle (#810)

* chore: removal of hardhat-truffle

* fix: linting fixes

* feat: added skale-v2 support in hardhat config (#813)

* feat: added skale-v2 support in hardhat config

* fix: resolved linting in hardhat config

* feat: occurrence support (#793)

* feat: occurrence support

* fix: slither issues

* fix: slither issues part 2

* fix: slither issues part 3

* test: adding positive testcases to bond manager

* test: fixing tests

* test: refactored bondManager tests and added tests to governance

* feat: adding more governance params and test cases

* fix: linting fixes

* fix: solidity linting fixes

* test: add negative test cases

* fix: linting fixes

* fix: merge fixes

* fix: bond manager fixes

* fix: slither fixes

* fix: deployment scripted added for bond manager and v1.0.1 incentnet phase 2 changes incorporated

* fix: post deployment script fix

* fix: post deployment create jobs fix

* fix: post deployment create collection fix

* fix: linting fixes

* build(deps): bump semver-regex from 3.1.3 to 3.1.4 (#817)

Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/commits/v3.1.4)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump semantic-release from 19.0.2 to 19.0.3 (#826)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 19.0.2 to 19.0.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v19.0.2...v19.0.3)

---
updated-dependencies:
- dependency-name: semantic-release
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: sortedValues datatype fix (#850)

* fix: Post deployment testing + Fixing Governance and ContractM Initialisation (#840)

* test: use post deployment helpers in postdeployment test

* chore: remove tmp

* chore: add post deployment tmp json to gitignore

* fix: update post deployment to support databonds

* fix: fix collectionM and gov contract initialisation, clean up post deployment script

* chore: clean up

* fix: increase network timeout (#845)

* fix: increase network timeout

* chore: update timeout to 5 min

* build(deps): bump npm from 8.9.0 to 8.12.1 (#827)

Bumps [npm](https://github.com/npm/cli) from 8.9.0 to 8.12.1.
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](npm/cli@v8.9.0...v8.12.1)

---
updated-dependencies:
- dependency-name: npm
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Gaurav Jain <65170724+GauravJain9@users.noreply.github.com>
Co-authored-by: Yohan Nelson <yohan.nelson@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
SkandaBhat added a commit that referenced this pull request Sep 13, 2022
* fix: updated and added comments on contracts (#789)

* fix: updated and added comments in stakeManager and interface

* fix: updated and added comments on contracts

* fix: updated comment in collectionManager contract

* feat: made getstate and getepoch functions public (#795)

* feat: made getstate and getepoch function public

* fix: linting errors

* fix: fixed naming issue in RandomNoManager

* feat: hardhat-deploy (#797)

* feat(hardhatdeploy): poc hardhat-deploy

integrate hardhat-deploy plugin to deploy test contract

* feat(hardhat-deploy): integrate hardhat-deploy plugin

deploy all Razor contracts using hardhat-deploy, update deploy.sh script

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove test contract

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove unnecessary changes

* fix(hardhat-deploy): integrate hardhat-deploy plugin

hotfix remove unnecessary changes

* fix(hardhat-deploy): fix current post deployment

wait for contract deployment file to updated

* fix(hardhat-deploy): migrate contracts setup

create shared folder for contracts initialisation and grant role

* feat(hardhat-deploy): post deployment test

add post deployment script test, 1 staker to vote for 1 epoch

* feat(hardhat-deploy): clean up

hotfix

* fix: lint fix and yarn.lock

* feat(hardhat-deploy): add deployment fixtures for tests

* fix(hardhat-deploy): fix circleci errors

* feat(hardhat-deploy): remove postdeployment test and deployment fixtures. Release hardhat-deploy

* feat(hardhat-deploy): use common deploy func, code modularisation

* feat(hardhat-deploy): circleci hotfix

* fix: clean up functions,rename deploy_all

* fix: postdeployment setup code clean up and fixes for failing init contract + same contract instance

* fix: update grant role to promise

* fix: add deploy readme

* fix: move to root folder

* fix: update content

* chore: removal of hardhat-truffle (#810)

* chore: removal of hardhat-truffle

* fix: linting fixes

* feat: added skale-v2 support in hardhat config (#813)

* feat: added skale-v2 support in hardhat config

* fix: resolved linting in hardhat config

* feat: occurrence support (#793)

* feat: occurrence support

* fix: slither issues

* fix: slither issues part 2

* fix: slither issues part 3

* test: adding positive testcases to bond manager

* test: fixing tests

* test: refactored bondManager tests and added tests to governance

* feat: adding more governance params and test cases

* fix: linting fixes

* fix: solidity linting fixes

* test: add negative test cases

* fix: linting fixes

* fix: merge fixes

* fix: bond manager fixes

* fix: slither fixes

* fix: deployment scripted added for bond manager and v1.0.1 incentnet phase 2 changes incorporated

* fix: post deployment script fix

* fix: post deployment create jobs fix

* fix: post deployment create collection fix

* fix: linting fixes

* build(deps): bump semver-regex from 3.1.3 to 3.1.4 (#817)

Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.3 to 3.1.4.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/commits/v3.1.4)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump semantic-release from 19.0.2 to 19.0.3 (#826)

Bumps [semantic-release](https://github.com/semantic-release/semantic-release) from 19.0.2 to 19.0.3.
- [Release notes](https://github.com/semantic-release/semantic-release/releases)
- [Commits](semantic-release/semantic-release@v19.0.2...v19.0.3)

---
updated-dependencies:
- dependency-name: semantic-release
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: sortedValues datatype fix (#850)

* fix: Post deployment testing + Fixing Governance and ContractM Initialisation (#840)

* test: use post deployment helpers in postdeployment test

* chore: remove tmp

* chore: add post deployment tmp json to gitignore

* fix: update post deployment to support databonds

* fix: fix collectionM and gov contract initialisation, clean up post deployment script

* chore: clean up

* fix: increase network timeout (#845)

* fix: increase network timeout

* chore: update timeout to 5 min

* build(deps): bump npm from 8.9.0 to 8.12.1 (#827)

Bumps [npm](https://github.com/npm/cli) from 8.9.0 to 8.12.1.
- [Release notes](https://github.com/npm/cli/releases)
- [Changelog](https://github.com/npm/cli/blob/latest/CHANGELOG.md)
- [Commits](npm/cli@v8.9.0...v8.12.1)

---
updated-dependencies:
- dependency-name: npm
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: code coverage fix

* chore: removed unnecessary changes

Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
Co-authored-by: Gaurav Jain <65170724+GauravJain9@users.noreply.github.com>
Co-authored-by: Yohan Nelson <yohan.nelson@gmail.com>
Co-authored-by: Shrikant upadhyay <shrikant1997upadhyay@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Raj Kharvar <rajkharvar1808@gmail.com>
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.

Occurence support
5 participants