Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Account hardener, second class txs (#1537)
* Refactored index.ts to support multiple cli commands/modes. Split out previous logic into migrate_accounts.ts and pulled some logic out of aztec_connect.ts into helper file get_rollup_blocks.ts. Started implementation of fix_accounts.ts for accounts that can have an alias reassigned to their public key * pulling blocks into worldstate, correct root. * account fixer now uses SDK, generates keys and aliasHash, constructs AccountTx, performs FFT and gets signing data. Rearranged fixAccounts function * minor tweak to fix-accounts test script * For fixAccounts function of account-migrator, refactored the initialization of modules like worker pools, fft, prover, etc to match account_prover.test.ts. This fixed a memory access out-of-bounds error in WASM. Am now computing schnorr signature properly, generating account proof, and verifying account proof * Updates to fix-accounts-local.sh so it detects when falafel is ready, parses rollup address, runs e2e test and then runs fixAccounts test locally. Can launch full test including ganache, 2 halloumis and a falafel all with a single run of this script * Began making shift over to Halloumi proofs while investigating why falafel is rejecting proofs generated directly by the account-migrator * Updated barretenberg rollup_cli and account proofs to accept account txs from halloumi for proof generation. Updated falafel to accept second-class transactions that do not pay a fee (still need to remove them from get_pending_txs and enforce that they only fill up empty space in blocks. fixAccounts is now submitting account txs to halloumi for proof generation before submitting them to falafel for validation and inclusion in rollup blocks. Falafel now has an e2e 'dev' start mode that sets up for e2e but also runs in dev mode for continuous rebuilding * some cleanup in the account fixer. Started adding code (commented out) to write/read account proofs to/from json files * Added logic for writing/reading account proofs to json files in batches before sending to falafel. Moved createFundedWalletProvider to utility file as is done for e2e tests. General cleanup in fix_accounts. * Moved sendSecondClassTxs into a 'limited' rollup provider instantiated in account fixer. * submitting actual batches of 2nd class txs to falafel * Moved sendSecondClassTxs into a new class. Moved all account fixing logic into AccountFixer class in account_fixer.ts * log fix * Added invertPublicKey wasm bindings. Creating new account first to then be used by many migration TXs for account fixing/hardening * Fixed account-migrator package deps. Began changes to pull real accounts from mainnet for account hardening/fixing * broke yarn lock file after merge * 2nd class txs now only fill up empty slots in rollup block. account fixer force flushes the rollup when in test mode * rename account fixer to hardener * added validateAuth for second class txs * fix account.cpp info text * rename function to get rollup publish conditions in rollup coordinator. Updated core SDK's pendingAliases to use a Map so that when multiple migration txs are submitted with the same alias, it only updates the SDK with the last tx's alias/acc-public-key pair * More private helper functions to break up long code blocks in hardener. Added some function header comments. * fixed falafel bug and broken falafel tests * separate modes for generation of proofs and submission of proofs * hardener now hardens 'initial' accounts. Added 'verifyHardened' command * minor cleanup in sdk and halloumi * hardener readme and script update * added pendingSecondClassTxs to status endpoint * Added falafel-monitoring mode for hardener. Hardener now ensures a unique set of accounts before generating proofs. Other fixes and cleanup to hardener * hardener cleanup * debugger working properly * Added schnorr public key inversion test to barretenberg JS. Added inversion function comments to barretenberg and bJS * prettier for barretenberg js * Typos in zk-money and bberg JS (intial -> initial). Split hardener commands into subcommands `harden createHardener` etc. Updated migrator README * comments and prints cleanup * revert falafel package.json and start_e2e.sh back to defi-bridge-project version. Commented account hardener and cleaned up harden-command modes (new full-sequence mode that performs all harden steps). * Tweaks to falafel after code review, bug in rollup_db getTotalTxCount, revert minor/style circuit change. Large updates to Account Hardener after review. Some additional comments and TODOs * include second class tx count (total and per type) in rollup profile print. * comment local hardener test script * fixed bug where second class txs could surpass block-slot limit * added rollup coordinator tests to check that: 1. rollup does not publish when filled with second class txs, 2. second-class txs are omitted when block is full with 1st class, 3. second-class txs are included when there is empty space and a rollup is going to publish anyway, 3. second class txs are omitted if they would surpass gas/call-data limits * prettier rollup_coordinator * compiler warning in rollup coord test * Hardener now always pulls ALL accounts from ALL blocks and segregates the target accounts for proof generation/verification * hardener constants updated (batch size and max second-class txs in falafel. Format fix in rolllup profile printer. Added metrics gauge for 2nd-class txs * Was able to reduce second-class-tx-related changeset in rollup_coordinator.test.ts via use of mockResolvedValueOnce to inject second class txs into rollupDb * improved hardener script. cleanup in hardener logging * various yarn package related issues resolved after large merge * bugs found by ci in barretenberg and falafel after large merge * type fix in rollup coordinator test * cleanup for db/account-hardener PR * revert zkmoney change not appropriate in hardener PR * minor style fix in account hardener local testing script * changed terminology: invert -> negate (for negation of public key Y coord) * fix account hardener after PR #1640 * simplify public key negation * fixes after merge update * fix account hardener after Crs->NetCrs rename
- Loading branch information