-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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
Migrate AccessManager
tests to ethers
#4710
Migrate AccessManager
tests to ethers
#4710
Conversation
|
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.
Partial review, (6/10 files)
}); | ||
|
||
it('panics in short calldata', async function () { | ||
// We avoid adding the `restricted` modifier to the fallback function because other tests may depend on it | ||
// being accessible without restrictions. We check for the internal `_checkCanCall` instead. | ||
await expectRevert.unspecified(this.managed.$_checkCanCall(other, '0x1234')); | ||
await expect(this.managed.$_checkCanCall(this.roleMember, '0x1234')).to.be.reverted; |
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 there is a way to check that the revert was a panic. We should do that.
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.
Note, if we don't specify the panic code, it will work just like we want. Sources: https://github.com/NomicFoundation/hardhat/blob/main/packages/hardhat-chai-matchers/src/internal/reverted/revertedWithPanic.ts
await expect(this.managed.$_checkCanCall(this.roleMember, '0x1234')).to.be.reverted; | |
await expect(this.managed.$_checkCanCall(this.roleMember, '0x1234')).to.be.revertedWithPanic(); |
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.
This doesn't work but I'm not sure why. If done like this, we get an error saying that it reverted without a reason:
AssertionError: Expected transaction to be reverted with some panic code, but it reverted without a reason
Array slices don't specify if they panic in the docs, but the section with the panic codes does mention it panics for "... an array slice at an out-of-bounds or negative index"
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.
Interresting. Lets leave it like that for now. I'll try to come up with a minimum reproductive example and report it somewhere.
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 opened this ticket. Seems to be a vague interpretation of what the panic code means. Seems to be referring to only accessing an array out of bounds but it does mention array slices in the docs.
Let's see what they say
AcessManager
tests to ethersAccessManager
tests to ethers
Similar to #4689, #4657 and #4694.
Tests for the AccessManager were migrated to ethers along with the
constants.js
,namespaced-storage.js
andaccess-manager.js
helpersPR Checklist
npx changeset add
)