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

Insert ordered signatures in Safe Tx #1060

Merged
merged 5 commits into from
Jun 6, 2024

Conversation

falvaradorodriguez
Copy link
Contributor

Closes #713

The approach of the task changes due a utility for sorting and exporting signatures has been created in this task #722.

This implies that the responsibility for sorting belongs to this new utility and that it is not necessary to do the task as foreseen.

In the PR only the management that was duplicated in the SafeTx class is removed and the existing SafeSignature is used.

@falvaradorodriguez falvaradorodriguez requested a review from a team as a code owner June 5, 2024 08:48
@falvaradorodriguez falvaradorodriguez self-assigned this Jun 5, 2024
@coveralls
Copy link

coveralls commented Jun 5, 2024

Pull Request Test Coverage Report for Build 9381071744

Details

  • 45 of 45 (100.0%) changed or added relevant lines in 2 files are covered.
  • 5 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.004%) to 93.795%

Files with Coverage Reduction New Missed Lines %
gnosis/eth/ethereum_client.py 1 86.16%
gnosis/safe/tests/utils.py 1 60.0%
gnosis/safe/safe_tx.py 1 90.97%
gnosis/eth/tests/clients/test_sourcify_client.py 2 91.11%
Totals Coverage Status
Change from base Build 9380855027: 0.004%
Covered Lines: 8238
Relevant Lines: 8783

💛 - Coveralls

self.signatures[: 65 * new_owner_pos]
+ signature
+ self.signatures[65 * new_owner_pos :]
new_tx_signatures = SafeSignature.parse_signature(
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just signatures, because new is not accurated to the variable, I mean the variable contains old signatures and new signatures.
Other option could be unsorted_signatures is you want to remark that are unsorted and needs to be sorted.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated here 5c8cf1e

tx_signatures = SafeSignature.parse_signature(
self.signatures, self.safe_tx_hash
)
new_tx_signatures = list(filter(lambda x: x.owner != address, tx_signatures))
Copy link
Member

Choose a reason for hiding this comment

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

I would expect one signature by owner, why returns a list?
Anyway, do you think that make sense change the unsign? in this case remove one signature from the middle does not affect the sort.

Copy link
Contributor Author

@falvaradorodriguez falvaradorodriguez Jun 5, 2024

Choose a reason for hiding this comment

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

I think the problem is in the name of the method. The signatures stores the signatures of all owners in bytes... that's why you need to parse them to get the list to manage it (In this case, I am calculating the signatures without the signature of the owner to be removed.).

I did it to keep the logic at the same point. In this case SafeSignature. If you see that it doesn't help, I can remove this change, what do you say?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I keep it, I must change the name of the variable to be consistent with the above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I keep it, I must change the name of the variable to be consistent with the above.

Done here 314d30b

@coveralls
Copy link

coveralls commented Jun 5, 2024

Pull Request Test Coverage Report for Build 9387031259

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 45 of 45 (100.0%) changed or added relevant lines in 2 files are covered.
  • 25 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.3%) to 93.534%

Files with Coverage Reduction New Missed Lines %
gnosis/eth/ethereum_client.py 1 86.16%
gnosis/safe/tests/utils.py 1 60.0%
gnosis/safe/safe_tx.py 1 90.97%
gnosis/eth/clients/sourcify_client.py 9 78.43%
gnosis/eth/tests/clients/test_sourcify_client.py 13 66.67%
Totals Coverage Status
Change from base Build 9380855027: -0.3%
Covered Lines: 8217
Relevant Lines: 8785

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 6, 2024

Pull Request Test Coverage Report for Build 9398016275

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 45 of 45 (100.0%) changed or added relevant lines in 2 files are covered.
  • 32 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.3%) to 93.478%

Files with Coverage Reduction New Missed Lines %
gnosis/eth/ethereum_client.py 1 86.16%
gnosis/safe/tests/utils.py 1 60.0%
gnosis/safe/safe_tx.py 1 90.97%
gnosis/eth/clients/sourcify_client.py 13 70.59%
gnosis/eth/tests/clients/test_sourcify_client.py 16 64.44%
Totals Coverage Status
Change from base Build 9380855027: -0.3%
Covered Lines: 8212
Relevant Lines: 8785

💛 - Coveralls

@coveralls
Copy link

coveralls commented Jun 6, 2024

Pull Request Test Coverage Report for Build 9399810476

Details

  • 45 of 45 (100.0%) changed or added relevant lines in 2 files are covered.
  • 32 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.3%) to 93.51%

Files with Coverage Reduction New Missed Lines %
gnosis/eth/ethereum_client.py 1 86.16%
gnosis/safe/tests/utils.py 1 60.0%
gnosis/safe/safe_tx.py 1 90.97%
gnosis/eth/clients/sourcify_client.py 13 70.59%
gnosis/eth/tests/clients/test_sourcify_client.py 16 64.44%
Totals Coverage Status
Change from base Build 9381894097: -0.3%
Covered Lines: 8213
Relevant Lines: 8783

💛 - Coveralls

@falvaradorodriguez falvaradorodriguez merged commit 4ebc3e5 into main Jun 6, 2024
7 checks passed
@falvaradorodriguez falvaradorodriguez deleted the insert_ordered_signatures_safe_tx branch June 6, 2024 11:16
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2024
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.

Add function to insert ordered signature to SafeTx
3 participants