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

Add tests for EIP-1271 #416

Closed
wants to merge 8 commits into from
Closed

Add tests for EIP-1271 #416

wants to merge 8 commits into from

Conversation

moisses89
Copy link
Member

Closes #409

  • add test for nested Safes using EIP-1271
  • add test for nested Safes with signature len=0 for one owner

@moisses89 moisses89 requested a review from rmeissner June 14, 2022 10:44
@github-actions
Copy link

github-actions bot commented Jun 14, 2022

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

@moisses89
Copy link
Member Author

I have read the CLA Document and I hereby sign the CLA

@coveralls
Copy link

coveralls commented Jun 14, 2022

Pull Request Test Coverage Report for Build 4145622304

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 7 unchanged lines in 1 file lost coverage.
  • Overall coverage remained the same at 97.053%

Files with Coverage Reduction New Missed Lines %
contracts/SafeL2.sol 7 0%
Totals Coverage Status
Change from base Build 4112927572: 0.0%
Covered Lines: 307
Relevant Lines: 315

💛 - Coveralls

test/integration/gnosisSafeNestedSafes.spec.ts Outdated Show resolved Hide resolved
test/integration/gnosisSafeNestedSafes.spec.ts Outdated Show resolved Hide resolved
test/integration/gnosisSafeNestedSafes.spec.ts Outdated Show resolved Hide resolved
@mmv08
Copy link
Member

mmv08 commented Jan 25, 2023

I created a PR #499 that adds support for smart contract signatures in buildSignatureBytes and also introduces new function buildContractSignature. After (and if) it's merged, it'd be good to revisit this pr with the new functions

data: "",
dynamic: true,
};
const signature = buildSignatureBytes([signerSafe1,emptySignSafe2])
Copy link
Member Author

Choose a reason for hiding this comment

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

@mikhailxyz, emptySignSafe2 was created to include the address of safe2 in the staticpart.


it('should use EIP-1271 (contract signatures)', async () => {
const { safe1, safe2, parentSafe, handlerSafe1, handlerSafe2, staticPart} = await setupTests()
// Deposit some spare money for execution to parent safe
Copy link
Member

Choose a reason for hiding this comment

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

I was a little puzzled by the comment because technically smart contract wallets cant execute anything, would rename it for the test transfer

Copy link
Member Author

Choose a reason for hiding this comment

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

Take a look to b677115

await expect(await hre.ethers.provider.getBalance(parentSafe.address)).to.be.deep.eq(parseEther("0"))
})

it('should revert with hash not approved ', async () => {
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary space in the test description

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed b677115

const nonce = await parentSafe.nonce()
const messageData = await parentSafe.encodeTransactionData(to, value, data, operation, 0, 0, 0, AddressZero, AddressZero, nonce)

// Get hash transaction for each safe
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Get hash transaction for each safe
// Get message hash for each safe

Copy link
Member Author

Choose a reason for hiding this comment

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

Done b677115

@mmv08
Copy link
Member

mmv08 commented Feb 10, 2023

also the test seems to be not linted, you can run yarn lint:ts (we need to setup a GitHub action for this)

@moisses89 moisses89 requested a review from mmv08 February 10, 2023 16:11
Copy link
Member

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

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

lgtm but i'll leave the final decision to @rmeissner

@rmeissner rmeissner closed this Aug 28, 2023
@rmeissner rmeissner deleted the add_tests_eip1271 branch August 28, 2023 12:54
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tests missing for EIP-1271 signatures
6 participants