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

Integration tests #22

Merged
merged 4 commits into from
Aug 20, 2021
Merged

Integration tests #22

merged 4 commits into from
Aug 20, 2021

Conversation

kmadk
Copy link
Contributor

@kmadk kmadk commented Aug 19, 2021

Everything passes except for GovBravo CastVote tests which were failing already.

@kmadk kmadk requested review from drewstone and nepoche August 19, 2021 02:01
@drewstone
Copy link
Contributor

drewstone commented Aug 19, 2021

Feel free to skip those CastVote tests in the repo for now @KeltonMad. (i.e. mark them it.skip)

Copy link
Contributor

@drewstone drewstone left a comment

Choose a reason for hiding this comment

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

looks great! My only concerns have to do with approvals, especially in the new integration test. It seems we have some tests where we're approving a lot of calls for things I'm not so sure we need. More approvals means more TXes and we ought to make sure we minimize them wherever possible.

@@ -20,10 +20,18 @@ contract LinkableCompTokenAnchorPoseidon2 is LinkableAnchorPoseidon2 {
uint256 _denomination,
uint32 _merkleTreeHeight,
uint32 _chainID,
IMintableCompToken _token
TokenWrapper _token
Copy link
Contributor

Choose a reason for hiding this comment

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

It's always more optimised to use interfaces rather than importing the token contract directly (due to bytecode size). If you think we should use the TokenWrapper as the base then I would consider renaming IMintableCompToken or creating a new ITokenWrapper that handles this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will create a TokenWrapper Interface!

test/integration/compAnchorIntegration.js Show resolved Hide resolved
proof = res.proof;
publicSignals = res.publicSignals;
let vKey = await snarkjs.zKey.exportVerificationKey('test/fixtures/circuit_final.zkey');
res = await snarkjs.groth16.verify(vKey, publicSignals, proof);
Copy link
Contributor

Choose a reason for hiding this comment

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

you can remove the native verification from these tests

test/integration/compAnchorIntegration.js Outdated Show resolved Hide resolved
publicSignals = res.publicSignals;
vKey = await snarkjs.zKey.exportVerificationKey('test/fixtures/circuit_final.zkey');
res = await snarkjs.groth16.verify(vKey, publicSignals, proof);
assert.strictEqual(res, true);
Copy link
Contributor

Choose a reason for hiding this comment

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

these can be removed from integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great. Thank you

test/integration/compAnchorIntegration.js Outdated Show resolved Hide resolved
@drewstone
Copy link
Contributor

Also @KeltonMad I noticed some stylistic changes with comments (capitals vs not). I'd recommend being consistent in the comments at all times. It can lead us to a well-defined process if we do, and otherwise break one down if not.

kmadk and others added 2 commits August 19, 2021 11:39
Co-authored-by: drewstone <drewstone329@gmail.com>
Co-authored-by: drewstone <drewstone329@gmail.com>
// approve tokenwrapper to transfer destTokens from user2
await destToken.approve(destWrapperToken.address, initialTokenMintAmount, {from: user2});
// increase allowance for user1 to burn
await destWrapperToken.approve(DestChainLinkableAnchorInstance.address, initialTokenMintAmount, {from: user1});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain this one more? Increase allowance for a burn? If this is removed does the test fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes the test fails if this is removed. Burning requires an allowance similar to transferFrom. I am working on ways to optimize all these approvals for deposit-and-wrap and something similar with withdrawing unwrapping and burning.

@drewstone
Copy link
Contributor

Ping me whenever this is ready again @KeltonMad

@drewstone drewstone merged commit a06341c into main Aug 20, 2021
@drewstone drewstone deleted the governed-token-integration branch August 20, 2021 22:52
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.

2 participants