-
Notifications
You must be signed in to change notification settings - Fork 3
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
ZK-382: Implement deposit for token shortlist #97
Conversation
|
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.
leaving some initial comments
contracts/ShielderV0_1_0.sol
Outdated
* @custom:oz-upgrades-unsafe-allow external-library-linking | ||
*/ | ||
// solhint-disable-next-line contract-name-camelcase | ||
contract ShielderV0_1_0 is |
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.
The approach in this PR is to keep existing code (shielder-circuits
package, integration-tests
) pointing at the current mainnet release implementation, and to start adding new code next to it.
An alternative approach would be to modify Shielder.sol
etc. in place and add the mainnet release version next to it (in ShielderV_0_0_1.sol
and other files if necessary).
The latter seems better to me. V_0_0_1
is already tested, we don't need to run any tests for it. But it seems cleaner to work on the V_0_1_0
implementation in the existing ecosystem of crates/integration_tests
, shielder-rust-sdk
and shielder-relayer
, under the existing PR checks.
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.
renamed to Shielder
but kept in ShielderV0_1_0.sol
file
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.
My point here is to change existing code while making sure that existing tests pass. Currently you're adding code outside the existing testing framework, is there any good reason for it?
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.
rewriting tests for new circuits is out of scope of this PR. let's not make it giant.
/* | ||
* Make an ERC-20 token deposit into the Shielder | ||
*/ | ||
function depositERC20( |
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.
New contract code should be accompanied by test coverage. Our current way to do that is to use crates/integration-tests
.
The skipping of integration tests was discussed in the context of Shielder SDK, not contract code coverage.
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.
note sure it's currently meaningful to write integration tests without withdraw. let's leave it for another PR
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.
The new deposit is compatible with the old withdraw and new account, as long as you only use token index 0. The tests I have in mind do not use withdraw.
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.
rewriting tests for new circuits is out of scope of this PR. let's not make it giant.
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.
the implementation looks very good, bu the versioning is attacking from all angles 😄 As much as I can understand naming the contracts with the semversion included, imo it's not needed all over the place, - it shoud be enough to do semversioning in the tags and in the Cargo.toml
, which has the version field for this exact purpose
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.
Left comments noting that code is being added outside the existing testing framework; it seems preferable to iterate while keeping the tests.
Implement Deposit function for token shortlist feature:
ShielderV_0_1_0
TokenList
tokenIndex
inDepositEvent
zkOS-monorepo/contracts/ShielderV0_1_0.sol
Line 73 in 33a4a93
depositERC20
zkOS-monorepo/contracts/ShielderV0_1_0.sol
Lines 232 to 241 in 33a4a93
zkOS-monorepo/contracts/ShielderV0_1_0.sol
Lines 387 to 396 in 33a4a93