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

Fix wrong domain separator for contract versions below 1.3.0 #422

Merged
merged 4 commits into from
Jan 12, 2023

Conversation

moisses89
Copy link
Member

@moisses89 moisses89 commented Jan 2, 2023

Closes #421

  • Add domainSeparator calculation for contract version 1.1.1
  • Add test eip1271 signing for v1.1.1 `

@moisses89 moisses89 requested a review from a team as a code owner January 2, 2023 17:38
@moisses89 moisses89 requested review from fmrsabino, Uxio0 and hectorgomezv and removed request for a team January 2, 2023 17:38
@coveralls
Copy link

coveralls commented Jan 2, 2023

Pull Request Test Coverage Report for Build 3900620694

  • 9 of 10 (90.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.08%) to 90.228%

Changes Missing Coverage Covered Lines Changed/Added Lines %
gnosis/safe/safe.py 7 8 87.5%
Totals Coverage Status
Change from base Build 3749167831: -0.08%
Covered Lines: 3527
Relevant Lines: 3909

💛 - Coveralls

self.ethereum_client.get_chain_id(),
self.address,
],
version = self.contract.functions.VERSION().call()
Copy link
Member Author

Choose a reason for hiding this comment

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

I am following the implementation of domain_separator which is computed instead of calling the contract.
I'm not sure why, but maybe this was implemented at this way to avoid asking the blockchain one more time.
If this were the reason, then this implementation should be changed to create a @cached_property of the contract version or perhaps call domain_separator directly to the blockchain instead of requesting the version once more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say that the library was just assuming 1.3.0 for the domain separator. Therefore, it wouldn't perform any RPC calls given that assumption.

gnosis/safe/safe.py Show resolved Hide resolved
self.ethereum_client.get_chain_id(),
self.address,
],
version = self.contract.functions.VERSION().call()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd say that the library was just assuming 1.3.0 for the domain separator. Therefore, it wouldn't perform any RPC calls given that assumption.

gnosis/safe/safe.py Outdated Show resolved Hide resolved
gnosis/safe/safe.py Outdated Show resolved Hide resolved
gnosis/safe/tests/test_signatures.py Outdated Show resolved Hide resolved
gnosis/safe/safe.py Outdated Show resolved Hide resolved
Copy link
Contributor

@fmrsabino fmrsabino left a comment

Choose a reason for hiding this comment

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

🚀 🚀 🚀

@moisses89 moisses89 merged commit c000120 into master Jan 12, 2023
@moisses89 moisses89 deleted the fix_domain_separator branch January 12, 2023 10:22
@github-actions github-actions bot locked and limited conversation to collaborators Jan 12, 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.

DomainSeparator is wrong calculated for version < 1.3.0
4 participants