-
Notifications
You must be signed in to change notification settings - Fork 22
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
Asset deactivation does not cause age penalty issue anymore #629
Conversation
|
contracts/Core/AssetManager.sol
Outdated
collections[id].assetIndex = uint16(activeCollections.length); | ||
// slither-disable-next-line incorrect-equality | ||
if (updateRegistry == epoch) { | ||
// slither-disable-next-line reentrancy-events,reentrancy-no-eth,reentrancy-benign |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have disabled the reentrancy slither issues on updateRegistry functions for now but we will need to address this.
If we shift the registry from the delegator to the asset Manager, the reentrancy issues can be fixed.
@hrishikeshio @abhishekvispute @SkandaBhat
contracts/Core/AssetManager.sol
Outdated
|
||
emit AssetCreated(AssetType.Job, numAssets, block.timestamp); | ||
delegator.setIDName(name, numAssets); | ||
emit AssetCreated(AssetType.Job, numJobs, block.timestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think lets discard this assetDefination only throughout the code
It creates confusion without adding any value now
Let it be collection and job everywhere
What do you think ?
Hmm one thing
I think we should merge this change after releasing version for Public Incent Testnet
as this is going to impact client side as well as razorScan
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also this AssetType its not needed anymore I think with this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enum maybe required for the client side because id 1 can be a job or collection. Lets discuss more on this
contracts/Core/AssetManager.sol
Outdated
@@ -82,37 +81,28 @@ contract AssetManager is AssetStorage, StateManager, AssetManagerParams, IAssetM | |||
uint32 epoch = _getEpoch(epochLength); | |||
if (assetStatus) { | |||
if (!collections[id].active) { | |||
activeCollections.push(id); | |||
collections[id].assetIndex = uint16(activeCollections.length); | |||
// slither-disable-next-line incorrect-equality |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are lines like L79 needed anymore, now we are not sharing same space for collection and jobs, so I think it can be removed or else it can be replaced by id <= numCollections
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll replace it with id <= numCollections
contracts/Core/AssetManager.sol
Outdated
collections[id].active = assetStatus; | ||
updateRegistry = epoch + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey what does updateRegistry mean ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Epoch in which the registry needs to be updated. I think i should rename to updateRegistryEpoch
contracts/Core/BlockManager.sol
Outdated
address randomNoManagerAddress | ||
address collectionManagerAddress, | ||
address randomNoManagerAddress, | ||
address delegatorAddress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs to be removed
contracts/Core/BlockManager.sol
Outdated
assetManager.executePendingDeactivations(epoch); | ||
uint32 updateRegistryEpoch = collectionManager.getUpdateRegistryEpoch(); | ||
// slither-disable-next-line incorrect-equality | ||
if (updateRegistryEpoch == epoch) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change from == to <= and add another condition of updateRegistry != 0
contracts/Core/BlockManager.sol
Outdated
if (sortedProposedBlockIds[epoch - 1].length == 0 || blockIndexToBeConfirmed == -1) { | ||
assetManager.executePendingDeactivations(epoch); | ||
uint32 updateRegistryEpoch = collectionManager.getUpdateRegistryEpoch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
registry needs to be updated irrespective of valid block. hence, shift it outside the if block
contracts/Core/CollectionManager.sol
Outdated
} | ||
|
||
function _updateRegistry() internal { | ||
uint8 j = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change it to uint16
checkState(State.Confirm, epochLength) | ||
{ | ||
require(id != 0, "ID cannot be 0"); | ||
require(collections[id].id == id, "Asset is not a collection"); | ||
require(id <= numCollections, "ID does not exist"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
require for the assetStatus to be opposite of collections[id].active. allows to remove updateregistry from if and reduces 1 if-else block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, there is conflict but
@SamAg19 please fix conflicts. |
fixes #626