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

Remove Router #112

Merged
merged 61 commits into from
Sep 28, 2022
Merged

Remove Router #112

merged 61 commits into from
Sep 28, 2022

Conversation

Ramarti
Copy link
Contributor

@Ramarti Ramarti commented Sep 1, 2022

Remove routing code in favour of more explicit interfaces.

Ramarti and others added 30 commits July 19, 2022 13:00
- Proposing slash checks for subject existence, unified interface isRegistered in AgentRegistry
- Fixed typos in docs (XXXRegistry reference to ERC1155 should be ERC721)
reentrancy fix returning deposit

Co-authored-by: Hadrien Croubois <[email protected]>
reentrancy protection on slash deposit

Co-authored-by: Hadrien Croubois <[email protected]>
@Ramarti Ramarti changed the base branch from master to dev September 22, 2022 09:35
@Ramarti Ramarti marked this pull request as ready for review September 26, 2022 16:01
contracts/components/BaseComponentUpgradeable.sol Outdated Show resolved Hide resolved
contracts/components/BaseComponentUpgradeable.sol Outdated Show resolved Hide resolved
contracts/components/utils/Routed.sol Outdated Show resolved Hide resolved
contracts/components/utils/Routed.sol Outdated Show resolved Hide resolved
test/components/upgrades.test.js Outdated Show resolved Hide resolved
test/components/scannerversion.test.js Show resolved Hide resolved
test/components/upgrades.test.js Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
test/components/upgrades.test.js Outdated Show resolved Hide resolved
test/components/upgrades.test.js Outdated Show resolved Hide resolved
test/components/upgrades.test.js Outdated Show resolved Hide resolved
test/components/upgrades.test.js Outdated Show resolved Hide resolved
@Ramarti Ramarti merged commit e7cf26a into dev Sep 28, 2022
@Ramarti Ramarti deleted the chore/remove_router branch September 28, 2022 11:02
Ramarti added a commit that referenced this pull request Oct 29, 2022
* Remove whitelist and enforce minting limit in contract. (#110)

* added state machine contract

* state machine same states for all machines

* SlashingController initial commit

* Configurable slash reasons, in review states and proposal editing.

* deploying SlashingController

* fix state machine creation

* - Added stake freezing side effects to SlashingController
- Proposing slash checks for subject existence, unified interface isRegistered in AgentRegistry
- Fixed typos in docs (XXXRegistry reference to ERC1155 should be ERC721)

* WIP: slashing calculations

* test slashing amounts

* evidence handling

* added tests and comments

* fix onlyInState and natspec StateMachines

* SlashController: change frozen stake when reviewing proposal, fix events, tests

* SlashController: modify proposal tests, no need to check for proposal existance there

* SlashController: fix wrong next states size, removed unnecesary checks, reused error message MissingRole, tests

* FortaStaking: comments

* FortaStakingParameters: comments

* SlashingController: implements ISlashingController

* linting

* FortaStaking: make stake to shares converters public

* SlashController: removed MAX_STAKE penalty mode, since it will always be the max possible stake

* fix tests

* Update contracts/components/staking/SlashingController.sol

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy fix returning deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy protection on slash deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* SlashingController: msg.sender -> _msgSender(), fix role check for revert proposal

* SlashingController: immutable depositToken

* SlashingController: max string length for evidence

* StateMachines & SlashingController: refactor to more efficient state machines

* StateMachines attribution

* SlashingController and FortaStaking: reverted to accessControl SLASHER_ROLE for slash and freeze

* remove whitelist functionality, limit minting to Forta max supply

* fix escrow test

* Update contracts/token/Forta.sol

Co-authored-by: Francisco <[email protected]>

* bumped to minor versions on Forta token contracts, added versioning logic to README.md

* commented on whitelist duplication in FortaCommon

* fix test

* remove stray only in tests

* remove whitelist reference from tests

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>

* Remove Router (#112)

* added state machine contract

* state machine same states for all machines

* SlashingController initial commit

* Configurable slash reasons, in review states and proposal editing.

* deploying SlashingController

* fix state machine creation

* - Added stake freezing side effects to SlashingController
- Proposing slash checks for subject existence, unified interface isRegistered in AgentRegistry
- Fixed typos in docs (XXXRegistry reference to ERC1155 should be ERC721)

* WIP: slashing calculations

* test slashing amounts

* evidence handling

* added tests and comments

* fix onlyInState and natspec StateMachines

* SlashController: change frozen stake when reviewing proposal, fix events, tests

* SlashController: modify proposal tests, no need to check for proposal existance there

* SlashController: fix wrong next states size, removed unnecesary checks, reused error message MissingRole, tests

* FortaStaking: comments

* FortaStakingParameters: comments

* SlashingController: implements ISlashingController

* linting

* FortaStaking: make stake to shares converters public

* SlashController: removed MAX_STAKE penalty mode, since it will always be the max possible stake

* fix tests

* Update contracts/components/staking/SlashingController.sol

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy fix returning deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy protection on slash deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* SlashingController: msg.sender -> _msgSender(), fix role check for revert proposal

* SlashingController: immutable depositToken

* SlashingController: max string length for evidence

* StateMachines & SlashingController: refactor to more efficient state machines

* StateMachines attribution

* SlashingController and FortaStaking: reverted to accessControl SLASHER_ROLE for slash and freeze

* remove whitelist functionality, limit minting to Forta max supply

* fix escrow test

* flattened AgentRegistry_0_1_4.sol

* flattened ScannerRegistry_0_1_2.sol

* flattened AgentRegistry014, ScannerRegistry012, ScannerNodeVersion011, Dispatch015

* flatten FortaStaking FortaStakingParameters

* flattened FortaStakingParameters011 FortaStakoing011

* flattened dispatch, scanner node version, fortastaking and fortastakingparams

* test upgrade FortaStaking

* remove stray only

* deprecated Router, unified BaseComponentUpgradeables

* removed Router from README, tests

* expand deprecated comment and rename deprecated variable

* Update contracts/components/BaseComponentUpgradeable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/BaseComponentUpgradeable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/utils/Routed.sol

Co-authored-by: Francisco <[email protected]>

* expanded on versioned contract generation for test updates

* remove stray console.log in test

* mock router for upgrades testing

* Update README.md

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* disableRouter is not access control restricted and fails if already 0

* remove unsafeSkipStorageCheck references

* fix tests

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>

* NodeRunnerRegistry (#128)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* not checking min stake for enable

Co-authored-by: Francisco <[email protected]>

* ScannerRegistry Migration to NodeRunnerRegistry (#129)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* fixed NodeRunnerRegistry._isOperational()

* delete MAX_SCANNERS

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* modified ScannerToNodeRunnerMigration

* delete event DeregisteredScanner(uint256 scannerId);

* remove misleading comments

* test name

* fix event missing params

* unused line

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* renamed migrate methods in NodeRunnerRegistry

* added opt out flags

Co-authored-by: Francisco <[email protected]>

* ScannerRegistry and Dispatch migration compatibility (#130)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* WIP: testing scanner registry post migration

* clean up deploy script constants

* fix tests

* todo, multiprocess deployment files

* refactored scanner signatures into util, scanner migration refactor, start dispatch testing

* adapt Dispatch

* fix tests

* WIP fix staking escrow tests

* ScannerRegistry must stay as StakeSubject, NodeRunnerRegistry must keep threshold for node runners. This breaks many tests, skipping until stake can be allocated to scanners through delegation

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* cleaned architecture and terms

* fix tests

* fix tests

Co-authored-by: Francisco <[email protected]>

* Stake Delegation (#134)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* WIP: testing scanner registry post migration

* clean up deploy script constants

* fix tests

* todo, multiprocess deployment files

* refactored scanner signatures into util, scanner migration refactor, start dispatch testing

* adapt Dispatch

* fix tests

* WIP fix staking escrow tests

* ScannerRegistry must stay as StakeSubject, NodeRunnerRegistry must keep threshold for node runners. This breaks many tests, skipping until stake can be allocated to scanners through delegation

* WIP

* cannot stake on managed subject

* adapting test for direct deposit

* fix tests

* WIP

* WIP

* WIP

* WIP: refactor, NodeRunnerRegistry must be 1 per chain and IStakeController renamed to IStakeSubjectHandler. Internal allocation method in FortaStaking

* temporarily relocate _old for speed in tests

* WIP: allocation for managed subjects

* Stake is distributed between enabled scanners only

* WIP: testing limits of allocation

* state allocation on deposit

* testing unallocation

* differentiates allocation and unallocation from deposit and withdraw

* fix tests, addedcomments

* unallocate on slashing test

* slashing only reduces allocation from activeStake

* WIP

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* cleaned architecture and terms

* fix tests

* fix tests

* WIP: code too large

* refator: StakeAllocation separated from FortaStaking, FortaStakingParameters -> StakeSubjectHandler, folder reorg

* fix tests slashing

* fix more tests

* WIP removing stake lpm

* refactor stake threshold

* fixed stake slashing

* tested delegation deposit

* reintroduce managed to disable staking on scanners

* removed IStakeController

* fix test

* fix

* reduce surface

* more surface

* Update contracts/components/agents/AgentRegistryEnable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* renaming

* rename camel case stakeSubjects

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* fixes

* rename

* last renames manager to gateway

* removed commented out code

* fixes

* refactor slash

* reduce total slash amount to exactly the amount requested

* fix test

* fix slash

Co-authored-by: Francisco <[email protected]>

* Migrate stake (#135)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* WIP: testing scanner registry post migration

* clean up deploy script constants

* fix tests

* todo, multiprocess deployment files

* refactored scanner signatures into util, scanner migration refactor, start dispatch testing

* adapt Dispatch

* fix tests

* WIP fix staking escrow tests

* ScannerRegistry must stay as StakeSubject, NodeRunnerRegistry must keep threshold for node runners. This breaks many tests, skipping until stake can be allocated to scanners through delegation

* WIP

* cannot stake on managed subject

* adapting test for direct deposit

* fix tests

* WIP

* WIP

* WIP

* WIP: refactor, NodeRunnerRegistry must be 1 per chain and IStakeController renamed to IStakeSubjectHandler. Internal allocation method in FortaStaking

* temporarily relocate _old for speed in tests

* WIP: allocation for managed subjects

* Stake is distributed between enabled scanners only

* WIP: testing limits of allocation

* state allocation on deposit

* testing unallocation

* differentiates allocation and unallocation from deposit and withdraw

* fix tests, addedcomments

* unallocate on slashing test

* slashing only reduces allocation from activeStake

* WIP

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* cleaned architecture and terms

* fix tests

* fix tests

* WIP: code too large

* refator: StakeAllocation separated from FortaStaking, FortaStakingParameters -> StakeSubjectHandler, folder reorg

* fix tests slashing

* fix more tests

* WIP removing stake lpm

* refactor stake threshold

* fixed stake slashing

* tested delegation deposit

* reintroduce managed to disable staking on scanners

* removed IStakeController

* fix test

* fix

* reduce surface

* more surface

* Update contracts/components/agents/AgentRegistryEnable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* renaming

* rename camel case stakeSubjects

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* fixes

* rename

* last renames manager to gateway

* removed commented out code

* fixes

* refactor slash

* reduce total slash amount to exactly the amount requested

* fix test

* stake migration

* fix migrate

* README.md

* remove redundant code

Co-authored-by: Francisco <[email protected]>

* fix test

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>
Ramarti added a commit that referenced this pull request Oct 31, 2022
* NodeRunner Registry

* remove vscode from git

* Remove whitelist and enforce minting limit in contract. (#110)

* added state machine contract

* state machine same states for all machines

* SlashingController initial commit

* Configurable slash reasons, in review states and proposal editing.

* deploying SlashingController

* fix state machine creation

* - Added stake freezing side effects to SlashingController
- Proposing slash checks for subject existence, unified interface isRegistered in AgentRegistry
- Fixed typos in docs (XXXRegistry reference to ERC1155 should be ERC721)

* WIP: slashing calculations

* test slashing amounts

* evidence handling

* added tests and comments

* fix onlyInState and natspec StateMachines

* SlashController: change frozen stake when reviewing proposal, fix events, tests

* SlashController: modify proposal tests, no need to check for proposal existance there

* SlashController: fix wrong next states size, removed unnecesary checks, reused error message MissingRole, tests

* FortaStaking: comments

* FortaStakingParameters: comments

* SlashingController: implements ISlashingController

* linting

* FortaStaking: make stake to shares converters public

* SlashController: removed MAX_STAKE penalty mode, since it will always be the max possible stake

* fix tests

* Update contracts/components/staking/SlashingController.sol

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy fix returning deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy protection on slash deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* SlashingController: msg.sender -> _msgSender(), fix role check for revert proposal

* SlashingController: immutable depositToken

* SlashingController: max string length for evidence

* StateMachines & SlashingController: refactor to more efficient state machines

* StateMachines attribution

* SlashingController and FortaStaking: reverted to accessControl SLASHER_ROLE for slash and freeze

* remove whitelist functionality, limit minting to Forta max supply

* fix escrow test

* Update contracts/token/Forta.sol

Co-authored-by: Francisco <[email protected]>

* bumped to minor versions on Forta token contracts, added versioning logic to README.md

* commented on whitelist duplication in FortaCommon

* fix test

* remove stray only in tests

* remove whitelist reference from tests

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>

* Remove Router (#112)

* added state machine contract

* state machine same states for all machines

* SlashingController initial commit

* Configurable slash reasons, in review states and proposal editing.

* deploying SlashingController

* fix state machine creation

* - Added stake freezing side effects to SlashingController
- Proposing slash checks for subject existence, unified interface isRegistered in AgentRegistry
- Fixed typos in docs (XXXRegistry reference to ERC1155 should be ERC721)

* WIP: slashing calculations

* test slashing amounts

* evidence handling

* added tests and comments

* fix onlyInState and natspec StateMachines

* SlashController: change frozen stake when reviewing proposal, fix events, tests

* SlashController: modify proposal tests, no need to check for proposal existance there

* SlashController: fix wrong next states size, removed unnecesary checks, reused error message MissingRole, tests

* FortaStaking: comments

* FortaStakingParameters: comments

* SlashingController: implements ISlashingController

* linting

* FortaStaking: make stake to shares converters public

* SlashController: removed MAX_STAKE penalty mode, since it will always be the max possible stake

* fix tests

* Update contracts/components/staking/SlashingController.sol

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy fix returning deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* Update contracts/components/staking/SlashingController.sol

reentrancy protection on slash deposit

Co-authored-by: Hadrien Croubois <[email protected]>

* SlashingController: msg.sender -> _msgSender(), fix role check for revert proposal

* SlashingController: immutable depositToken

* SlashingController: max string length for evidence

* StateMachines & SlashingController: refactor to more efficient state machines

* StateMachines attribution

* SlashingController and FortaStaking: reverted to accessControl SLASHER_ROLE for slash and freeze

* remove whitelist functionality, limit minting to Forta max supply

* fix escrow test

* flattened AgentRegistry_0_1_4.sol

* flattened ScannerRegistry_0_1_2.sol

* flattened AgentRegistry014, ScannerRegistry012, ScannerNodeVersion011, Dispatch015

* flatten FortaStaking FortaStakingParameters

* flattened FortaStakingParameters011 FortaStakoing011

* flattened dispatch, scanner node version, fortastaking and fortastakingparams

* test upgrade FortaStaking

* remove stray only

* deprecated Router, unified BaseComponentUpgradeables

* removed Router from README, tests

* expand deprecated comment and rename deprecated variable

* Update contracts/components/BaseComponentUpgradeable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/BaseComponentUpgradeable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/utils/Routed.sol

Co-authored-by: Francisco <[email protected]>

* expanded on versioned contract generation for test updates

* remove stray console.log in test

* mock router for upgrades testing

* Update README.md

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* Update test/components/upgrades.test.js

Co-authored-by: Francisco <[email protected]>

* disableRouter is not access control restricted and fails if already 0

* remove unsafeSkipStorageCheck references

* fix tests

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* NodeRunnerRegistry (#128)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* not checking min stake for enable

Co-authored-by: Francisco <[email protected]>

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* WIP: testing scanner registry post migration

* clean up deploy script constants

* fix tests

* todo, multiprocess deployment files

* refactored scanner signatures into util, scanner migration refactor, start dispatch testing

* adapt Dispatch

* fix tests

* WIP fix staking escrow tests

* ScannerRegistry must stay as StakeSubject, NodeRunnerRegistry must keep threshold for node runners. This breaks many tests, skipping until stake can be allocated to scanners through delegation

* WIP

* cannot stake on managed subject

* adapting test for direct deposit

* fix tests

* WIP

* WIP

* WIP

* WIP: refactor, NodeRunnerRegistry must be 1 per chain and IStakeController renamed to IStakeSubjectHandler. Internal allocation method in FortaStaking

* temporarily relocate _old for speed in tests

* WIP: allocation for managed subjects

* Stake is distributed between enabled scanners only

* WIP: testing limits of allocation

* state allocation on deposit

* testing unallocation

* differentiates allocation and unallocation from deposit and withdraw

* fix tests, addedcomments

* unallocate on slashing test

* slashing only reduces allocation from activeStake

* WIP

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* ScannerRegistry Migration to NodeRunnerRegistry (#129)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* fixed NodeRunnerRegistry._isOperational()

* delete MAX_SCANNERS

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* modified ScannerToNodeRunnerMigration

* delete event DeregisteredScanner(uint256 scannerId);

* remove misleading comments

* test name

* fix event missing params

* unused line

* Update contracts/components/scanners/ScannerToNodeRunnerMigration.sol

Co-authored-by: Francisco <[email protected]>

* renamed migrate methods in NodeRunnerRegistry

* added opt out flags

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* cleaned architecture and terms

* fix tests

* fix tests

* ScannerRegistry and Dispatch migration compatibility (#130)

* NodeRunner Registry

* remove vscode from git

* node runner cannot change chainId

* node runner registrtion with signature

* tested register scanner

* WIP

* finish NodeRunnerRegistry, comments and tests

* remove only

* fix typos

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistry.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* hardhat remove logs plugin

* removed logs

* reorg initializers in NodeRunnerRegistry contracts

* try fix on oz-upgrades custom comments

* fix ScannerNodeVersion tests

* removed stray virtual

* Update contracts/components/node_runners/NodeRunnerRegistryManaged.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* readability in NodeRunnerRegistryCore

* fix solidity linting config

* favor struct construction syntax

* ignore add return type

* removed nodeRunnerId argument from updateScannerMetadata and superfluous check

* changed concept of onlyOwnerOf for onlyNodeRunner in NodeRunnerRegistry

* replace the concept of isEnabled() for isOperational()

* flattened ScannerRegistry_0_1_3

* WIP

* self migration and priviledged migration, migration end setting

* testing migration, priviledged path

* test self migration, comments

* WIP more test coverage

* skip tests relaying on registering scanners

* removed unused storage variable in ScannerNodeRegistry

* update github action cache version

* WIP: testing scanner registry post migration

* clean up deploy script constants

* fix tests

* todo, multiprocess deployment files

* refactored scanner signatures into util, scanner migration refactor, start dispatch testing

* adapt Dispatch

* fix tests

* WIP fix staking escrow tests

* ScannerRegistry must stay as StakeSubject, NodeRunnerRegistry must keep threshold for node runners. This breaks many tests, skipping until stake can be allocated to scanners through delegation

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* cleaned architecture and terms

* fix tests

* fix tests

Co-authored-by: Francisco <[email protected]>

* WIP: code too large

* refator: StakeAllocation separated from FortaStaking, FortaStakingParameters -> StakeSubjectHandler, folder reorg

* fix tests slashing

* fix more tests

* WIP removing stake lpm

* refactor stake threshold

* fixed stake slashing

* tested delegation deposit

* reintroduce managed to disable staking on scanners

* WIP

* removed IStakeController

* WIP

* fix test

* fix

* lol

* reduce surface

* more surface

* Update contracts/components/agents/AgentRegistryEnable.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* renaming

* rename camel case stakeSubjects

* Update contracts/components/node_runners/NodeRunnerRegistryCore.sol

Co-authored-by: Francisco <[email protected]>

* fixes

* rename

* last renames manager to gateway

* removed commented out code

* WIP

* fixes

* reward distribution formula

* edit didAddStake

* add missing COMISSION_DELAY

* fix merge error

* make things compile

* add releaseReward compatibility

* add editorconfig with indent size

* add rewards distributor variable in fortastaking

* add test for rewards

* remove console.log

* mine block

* connect rewards to allocator

* fix

* fix accumulators for epochs

* compiling

* fix accumulators

* victory lap

* add test for stake mid epoch

* remove stake test

* add remove stake

* fix withdraw test

* add slash test

* add logic for rate in accumulators

* implement fee at RewardDistributor level

* Revert "add logic for rate in accumulators"

This reverts commit 562278d.

* add MAX_BPS constant

* add fee test

* introduce fees, fix claimRewards returning 0

* tested fee setting

* WIP

* fix tests

Co-authored-by: Hadrien Croubois <[email protected]>
Co-authored-by: Francisco <[email protected]>
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.

2 participants