-
Notifications
You must be signed in to change notification settings - Fork 212
MetaTransaction V2 Packages #714
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
Conversation
bc14382
to
48ba16a
Compare
|
||
it('can get the EIP712 hash', () => { | ||
const actual = mtx.getHash(); | ||
const expected = '0xfc85ef2149bd49fcc8fee2571ed8f0ecd671dec03845637ab1ded3d891ac3386'; |
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.
in the original metatransaction v1 typescript tests, this is done by comparing mtx.getHash() to the MetaTransactionsFeatureContract getMetaTransactionHash() function. Not sure if that'd be valuable here, but I thought I'd share the code:
const mtx = getRandomMetaTransaction();
const expected = mtx.getHash();
const actual = await feature.getMetaTransactionHash(mtx).callAsync();
expect(actual).to.eq(expected);
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.
That is designed to test MetaTransactionsFeature
's solidity mtx hash implementation using this package's implementation as a baseline. We shouldn't also circularly use that solidity code as the baseline for this test, because that makes it easier for both implementations to be wrong. The tests here use hashes generated by a third-party implementation as their baseline, just like the v1 package tests in meta_transactions_test.ts
.
); | ||
} | ||
|
||
public getEIP712TypedData(): EIP712TypedData { |
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.
Is there a way we can test this function for correctness?
|
||
it('can get the struct hash', () => { | ||
const actual = mtx.getStructHash(); | ||
const expected = '0x57db4055edfed82a6d86103197c21390bf29412fb4585e08c708454e03d92516'; |
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.
Quick question: how are the expected hash generated? If it's computed via ethers
or solidity then we are good. Just want to make sure the expected hash is computed in a different method so that we can make sure our method implementation is correct. Same for other hashes in the test
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.
It's computed via ethers
, so hopefully we are fine
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.
Got it. Yeah should be fine 👍
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.
LGTM
48ba16a
to
2338b28
Compare
Description
Accompanying typescript utilities for #665
Testing instructions