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: H-02 Votes Can Be Blocked #593

Merged
merged 7 commits into from
Oct 10, 2023
Merged

fix: H-02 Votes Can Be Blocked #593

merged 7 commits into from
Oct 10, 2023

Conversation

Orland0x
Copy link
Contributor

@Orland0x Orland0x commented Oct 9, 2023

Replaces the _commits (commit -> address) mapping with a double mapping (commit, address -> bool).

This allows the same commit to be made by 2 different addresses, which wasn't possible before.

This closes #555 as now its impossible for a user to block another by making a valid commit for their action before they do.

Copy link
Contributor

@pscott pscott left a comment

Choose a reason for hiding this comment

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

utACK, any reason you chose double mapping instead of adding the l1 message sender address?

@@ -473,7 +473,7 @@ describe('Ethereum Transaction Authenticator', function () {
);
expect.fail('Should have failed');
} catch (err: any) {
expect(err.message).to.contain(shortString.encodeShortString('Invalid sender address'));
expect(err.message).to.contain(shortString.encodeShortString('Commit not found'));
}
Copy link
Contributor

Choose a reason for hiding this comment

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

could we add a test that tests the "attack" vector that OZ mentioned? Just to add it as a regression test for later work

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah sorry added but forgot to push

@Orland0x
Copy link
Contributor Author

utACK, any reason you chose double mapping instead of adding the l1 message sender address?

I had a think about the other approach but not sure its really feasible as it would mean computing the hash on-chain in order to include msg.sender. We use posiodon which isnt really possible to do on L1. Could switch to keccak but then it would be expensive to verify on Starknet

@Orland0x Orland0x merged commit 930e244 into develop Oct 10, 2023
@Orland0x Orland0x deleted the audit_h02 branch October 10, 2023 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

audit: H-02 Votes Can Be Blocked
2 participants