This repository has been archived by the owner on Nov 27, 2024. It is now read-only.
fix: resolving additional bugs and some refactors #78
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation:
Small codebase changes
Modifications:
Bugs:
_newCastCount
in LlamaCore which has an upper bound condition. This will handle cases when someone has quantity greater thantype(uint96).max) - currentCount
. They get to vote too. (This is mostly applicable to ERC20s who can mint huge numbers). Addedtest_CanCastWhenCountisMax
tests.CastData
struct from an external contract. So added ahasTokenHolderCast
toTokenHolderCaster
that gets the values for votes and vetoes. Also added tests.role
at ActionCreation time. Currently the tokenholders will be able to Vote even if the underlying TokenHolderCaster no longer has the role. It'll only fail at Submission time which can be annoying.Refactors:
Removed the
checkIf(Dis)ApprovalEnabled
check in submit functions since they're checked in the underlyingcast
functions in the Llama Framework. Also removed the tests since there is no reasonable way to test this since thecastVote
andcastVeto
functions does have thecheckIf(Dis)ApprovalEnabled
check and it would have failed there. And we know for a fact that thecast(Dis)approval
being called in the submit functions have thecheckIf(Dis)ApprovalEnabled
check and we have tests for that in the Llama Framework.Note:
We also don't need an Action state check on the submit functions since they're checked in the underlyingcast
functions in the Llama Framework. There is no reasonable way to test this since thecastVote
andcastVeto
functions does have the Action state check and it would have failed there. And we know for a fact that thecast(Dis)approval
being called in the submit functions have the Action state check and we have tests for that in the Llama Framework.Removed the
approvalSubmitted
anddisapprovalSubmitted
bool and respectiveAlreadySubmittedApproval
andAlreadySubmittedDisapproval()
checks. This is since the underlying LlamaFramework handles it throughLlamaCore.DuplicateCast()
error in the worst case. But more likely is that it triggers theLlamaCore.InvalidActionState
since the state has already transitioned. And we know for a fact that thecast(Dis)approval
being called in the submit functions have the above checks and we have tests for that in the Llama Framework.Combined
AlreadyCastVote()
andAlreadyCastVeto()
errors into a singleDuplicateCast()
error that matches the error style in Llama Framework and reduces the number of defined errors.Combined
ActionNotActive()
andActionNotQueued()
errors into a singleInvalidActionState(ActionState current)
error that matches the error style in Llama Framework and reduces the number of defined errors. Moved this into the common_preCastAssertions
function to match Llama style.Changed
VotingDelayNotOver()
error toDelayPeriodNotOver()
error to match the other Period errors.Changed
CannotSubmitYet()
error toCastingPeriodNotOver()
error to match the other Period errors.Result:
Better and bug free code.