From c5eedbad3cad44774a1c9459bc2f1c83591e647e Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Mon, 6 Jul 2020 14:22:45 +0100 Subject: [PATCH 01/13] feat(sdk): return signature as well as proof with returnproof flag --- .../services/ApiService/Prove/index.js | 3 ++- .../ApiService/Prove/responseDataKeys.js | 19 ++++++++++++++++++- packages/extension/src/client/apis/ZkAsset.js | 11 +++++------ packages/extension/src/ui/pages/Send.jsx | 8 +++++++- .../src/ui/steps/createNoteFromBalance.js | 4 ++++ packages/extension/src/ui/steps/send.js | 4 ++++ packages/extension/src/ui/steps/withdraw.js | 4 ++++ 7 files changed, 44 insertions(+), 9 deletions(-) diff --git a/packages/extension/src/background/services/ApiService/Prove/index.js b/packages/extension/src/background/services/ApiService/Prove/index.js index 51f93b0ab..b7a875735 100644 --- a/packages/extension/src/background/services/ApiService/Prove/index.js +++ b/packages/extension/src/background/services/ApiService/Prove/index.js @@ -73,6 +73,7 @@ export default async function prove(query, connection) { data: { args, }, + sender, } = query; const { proofType, @@ -80,7 +81,7 @@ export default async function prove(query, connection) { } = args; let returnData = {}; - if (!returnProof) { + if (sender === 'WEB_CLIENT') { returnData = await triggerProofUi(query, connection); } else { switch (proofType) { diff --git a/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js b/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js index ea7ba3dab..3d09dbd64 100644 --- a/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js +++ b/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js @@ -1,4 +1,9 @@ -const fetchOutputNotes = ({ proofData }) => { +const fetchOutputNotes = ({ + proofData, + proof, + signature, + signature2, +}) => { const { outputNotes, remainderNote, @@ -18,16 +23,28 @@ const fetchOutputNotes = ({ proofData }) => { noteHash, value, })), + proof, + signature, + signature2, + }; }; +const returnProof = ({ proof, signature, signature2 }) => ({ + proof, + signature, + signature2, +}); + export default { DEPOSIT_PROOF: [ fetchOutputNotes, + returnProof, ], WITHDRAW_PROOF: [], TRANSFER_PROOF: [ fetchOutputNotes, + returnProof, ], CREATE_NOTE_FROM_BALANCE_PROOF: [ (data) => { diff --git a/packages/extension/src/client/apis/ZkAsset.js b/packages/extension/src/client/apis/ZkAsset.js index 43ee80547..5206a1668 100644 --- a/packages/extension/src/client/apis/ZkAsset.js +++ b/packages/extension/src/client/apis/ZkAsset.js @@ -431,6 +431,7 @@ export default class ZkAsset { success, outputNotes, proofData, + ...rest } = await ConnectionService.query( 'constructProof', { @@ -447,14 +448,12 @@ export default class ZkAsset { }, ); - let proof; - if (proofData) { - proof = proofData - ? await recoverJoinSplitProof(proofData) - : null; - } + const proof = proofData + ? await recoverJoinSplitProof(rest.proof) + : null; return { + ...rest, success, outputNotes, proof, diff --git a/packages/extension/src/ui/pages/Send.jsx b/packages/extension/src/ui/pages/Send.jsx index 8e046bd46..2f0856f1c 100644 --- a/packages/extension/src/ui/pages/Send.jsx +++ b/packages/extension/src/ui/pages/Send.jsx @@ -21,6 +21,7 @@ const Send = ({ numberOfOutputNotes, inputNoteHashes, userAccess, + returnProof, }) => { const fetchInitialData = async () => { const gsnConfig = await getGSNConfig(); @@ -31,7 +32,10 @@ const Send = ({ const { address: currentAddress, } = currentAccount; - const steps = isGSNAvailable ? sendSteps.gsn : sendSteps.metamask; + let steps = isGSNAvailable ? sendSteps.gsn : sendSteps.metamask; + if (returnProof) { + steps = sendSteps.returnProof; + } const sender = proxyContract; const asset = await makeAsset(assetAddress); @@ -77,6 +81,7 @@ Send.propTypes = { numberOfOutputNotes: PropTypes.number, inputNoteHashes: PropTypes.arrayOf(PropTypes.string), userAccess: PropTypes.arrayOf(PropTypes.string), + returnProof: PropTypes.bool, }; Send.defaultProps = { @@ -84,6 +89,7 @@ Send.defaultProps = { numberOfOutputNotes: emptyIntValue, inputNoteHashes: [], userAccess: [], + returnProof: false, }; export default Send; diff --git a/packages/extension/src/ui/steps/createNoteFromBalance.js b/packages/extension/src/ui/steps/createNoteFromBalance.js index 6f072847f..c2ca69f04 100644 --- a/packages/extension/src/ui/steps/createNoteFromBalance.js +++ b/packages/extension/src/ui/steps/createNoteFromBalance.js @@ -88,6 +88,10 @@ const stepSendViaGSN = { }; export default { + returnProof: { + stepApprove, + stepSign, + }, gsn: [ stepApprove, stepSign, diff --git a/packages/extension/src/ui/steps/send.js b/packages/extension/src/ui/steps/send.js index 6506863a4..1a7c28ef2 100644 --- a/packages/extension/src/ui/steps/send.js +++ b/packages/extension/src/ui/steps/send.js @@ -88,6 +88,10 @@ const stepSendViaGSN = { }; export default { + returnProof: [ + stepApprove, + stepSignNotes, + ], gsn: [ stepApprove, stepSignNotes, diff --git a/packages/extension/src/ui/steps/withdraw.js b/packages/extension/src/ui/steps/withdraw.js index 4ff6c2d48..7ef72a4b7 100644 --- a/packages/extension/src/ui/steps/withdraw.js +++ b/packages/extension/src/ui/steps/withdraw.js @@ -93,6 +93,10 @@ const stepSendViaGSN = { }; export default { + returnProof: [ + stepApprove, + stepSignNotes, + ], gsn: [ stepApprove, stepSignNotes, From 841bcdce07806e5afbe1b44c957e232f6a48657d Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Mon, 6 Jul 2020 15:43:59 +0100 Subject: [PATCH 02/13] feat(sdk): rebase develop --- packages/extension/:w | 48 +++++++++++++++++++ .../ApiService/Prove/responseDataKeys.js | 7 ++- packages/extension/src/client/apis/ZkAsset.js | 11 ++--- packages/extension/src/ui/steps/send.js | 5 ++ 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 packages/extension/:w diff --git a/packages/extension/:w b/packages/extension/:w new file mode 100644 index 000000000..9fd33257e --- /dev/null +++ b/packages/extension/:w @@ -0,0 +1,48 @@ +const fetchOutputNotes = ({ + proofData, + proof, + signature, + signature2, +}) => { + const { + outputNotes, + remainderNote, + } = proofData || {}; + if (!outputNotes) return null; + + return { + outputNotes: outputNotes + .filter((note) => { + if (!remainderNote) return true; + return note.decryptedViewingKey !== remainderNote.decryptedViewingKey; + }) + .map(({ + noteHash, + value, + }) => ({ + noteHash, + value, + })), + }; +}; + +export default { + DEPOSIT_PROOF: [ + fetchOutputNotes, + ], + WITHDRAW_PROOF: [], + TRANSFER_PROOF: [ + fetchOutputNotes, + ], + CREATE_NOTE_FROM_BALANCE_PROOF: [ + (data) => { + const { + outputNotes, + } = fetchOutputNotes(data) || {}; + + return { + notes: outputNotes || [], + }; + }, + ], +}; diff --git a/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js b/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js index ea7ba3dab..9fd33257e 100644 --- a/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js +++ b/packages/extension/src/background/services/ApiService/Prove/responseDataKeys.js @@ -1,4 +1,9 @@ -const fetchOutputNotes = ({ proofData }) => { +const fetchOutputNotes = ({ + proofData, + proof, + signature, + signature2, +}) => { const { outputNotes, remainderNote, diff --git a/packages/extension/src/client/apis/ZkAsset.js b/packages/extension/src/client/apis/ZkAsset.js index 43ee80547..1b85c67f1 100644 --- a/packages/extension/src/client/apis/ZkAsset.js +++ b/packages/extension/src/client/apis/ZkAsset.js @@ -255,6 +255,7 @@ export default class ZkAsset { returnProof, sender, publicOwner, + ...rest, } = {}) => { if (!this.linkedTokenAddress) { throw new ApiError('zkAsset.private', { @@ -288,6 +289,7 @@ export default class ZkAsset { } return { + ...rest, success, outputNotes, proof, @@ -330,6 +332,7 @@ export default class ZkAsset { inputNoteHashes, returnProof, sender, + ...rest, } = {}) => { if (!this.linkedTokenAddress) { throw new ApiError('zkAsset.private', { @@ -367,6 +370,7 @@ export default class ZkAsset { } return { + ...rest, success, proof, }; @@ -447,17 +451,10 @@ export default class ZkAsset { }, ); - let proof; - if (proofData) { - proof = proofData - ? await recoverJoinSplitProof(proofData) - : null; - } return { success, outputNotes, - proof, }; }; diff --git a/packages/extension/src/ui/steps/send.js b/packages/extension/src/ui/steps/send.js index 6506863a4..da2863dde 100644 --- a/packages/extension/src/ui/steps/send.js +++ b/packages/extension/src/ui/steps/send.js @@ -88,6 +88,11 @@ const stepSendViaGSN = { }; export default { + + returnProof: [ + stepApprove, + stepSignNotes, + ], gsn: [ stepApprove, stepSignNotes, From 49f5d1d892d775eebcc16bed104062bdeb2857a9 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Mon, 6 Jul 2020 15:51:01 +0100 Subject: [PATCH 03/13] feat(sdk): fix lint --- .../extension/src/background/services/ApiService/Prove/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/extension/src/background/services/ApiService/Prove/index.js b/packages/extension/src/background/services/ApiService/Prove/index.js index b7a875735..c603958f5 100644 --- a/packages/extension/src/background/services/ApiService/Prove/index.js +++ b/packages/extension/src/background/services/ApiService/Prove/index.js @@ -77,7 +77,6 @@ export default async function prove(query, connection) { } = query; const { proofType, - returnProof, } = args; let returnData = {}; From 72f6fbc009e2a6cc7db52b8b2e9dc899c82cf83c Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Mon, 6 Jul 2020 17:40:35 +0100 Subject: [PATCH 04/13] feat(sdk): fix sendingnotes to contract with new return proof --- .../src/background/services/ApiService/Prove/JoinSplit.js | 3 ++- packages/extension/src/client/apis/ZkAsset.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/extension/src/background/services/ApiService/Prove/JoinSplit.js b/packages/extension/src/background/services/ApiService/Prove/JoinSplit.js index 218ae2fdb..a4e5a7280 100644 --- a/packages/extension/src/background/services/ApiService/Prove/JoinSplit.js +++ b/packages/extension/src/background/services/ApiService/Prove/JoinSplit.js @@ -197,7 +197,7 @@ const getAccountMapping = async ({ user: { account, error, - }, + } = {}, } = await query(request, userQuery(` address linkedPublicKey @@ -208,6 +208,7 @@ const getAccountMapping = async ({ } })); + accounts.forEach((account) => { accountMapping[account.address] = account; }); diff --git a/packages/extension/src/client/apis/ZkAsset.js b/packages/extension/src/client/apis/ZkAsset.js index e39cff398..191b034a4 100644 --- a/packages/extension/src/client/apis/ZkAsset.js +++ b/packages/extension/src/client/apis/ZkAsset.js @@ -255,7 +255,7 @@ export default class ZkAsset { returnProof, sender, publicOwner, - ...rest, + ...rest } = {}) => { if (!this.linkedTokenAddress) { throw new ApiError('zkAsset.private', { @@ -332,7 +332,7 @@ export default class ZkAsset { inputNoteHashes, returnProof, sender, - ...rest, + ...rest } = {}) => { if (!this.linkedTokenAddress) { throw new ApiError('zkAsset.private', { From 76791cef080de706038fb380b53b94e5c9b244f4 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Wed, 8 Jul 2020 18:32:09 +0100 Subject: [PATCH 05/13] feat(sdk): fix using infuraurl for fetching --- .../EventService/helpers/AssetsSyncManager/index.js | 3 +++ .../EventService/helpers/NotesSyncManager/index.js | 11 ++++++++--- .../EventService/helpers/NotesWatcher/index.js | 7 +++++++ .../services/EventService/utils/note/fetchNotes.js | 6 +++++- packages/extension/src/config/provider.js | 2 +- 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/packages/extension/src/background/services/EventService/helpers/AssetsSyncManager/index.js b/packages/extension/src/background/services/EventService/helpers/AssetsSyncManager/index.js index 2aaa684bc..80127a8ac 100644 --- a/packages/extension/src/background/services/EventService/helpers/AssetsSyncManager/index.js +++ b/packages/extension/src/background/services/EventService/helpers/AssetsSyncManager/index.js @@ -14,6 +14,9 @@ class SyncManager { constructor() { this.config = { syncInterval: 5000, // ms + blocksPerRequest: 50, // ~ per 3 months (~6000 per day) + precisionDelta: 10, // + maxNumberOfAttempts: 5, }; this.syncConfig = undefined; this.networks = new Map(); diff --git a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js index f59239fbf..8091e2231 100644 --- a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js +++ b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js @@ -17,7 +17,12 @@ const infuraLimitError = { message: 'query returned more than 10000 results', }; -const isInfuraLimitError = error => error && error.code === infuraLimitError.code; + +const uriTooLong = { + code: -32603, +}; + +const isInfuraLimitError = error => error && error.code === infuraLimitError.code || error.code === uriTooLong.code; const SYNCING_STATUS = { ACTIVE: 'ACTIVE', @@ -30,7 +35,7 @@ const SYNCING_STATUS = { class SyncManager { constructor() { this.config = { - blocksPerRequest: 540000, // ~ per 3 months (~6000 per day) + blocksPerRequest: 6000 * 30, // ~ per 3 months (~6000 per day) precisionDelta: 10, // maxNumberOfAttempts: 5, networkId: null, @@ -134,7 +139,7 @@ class SyncManager { lastSyncedBlock, assets, progressCallbacks, - retriedNumber = 0, + retriedNumber = 5, } = options; const syncAddress = this.addresses.get(address); diff --git a/packages/extension/src/background/services/EventService/helpers/NotesWatcher/index.js b/packages/extension/src/background/services/EventService/helpers/NotesWatcher/index.js index fadc07153..d48326f7b 100644 --- a/packages/extension/src/background/services/EventService/helpers/NotesWatcher/index.js +++ b/packages/extension/src/background/services/EventService/helpers/NotesWatcher/index.js @@ -242,6 +242,13 @@ class Watcher { return subscription; } + + handleFetchError = (error) => { + errorLog('Failed to sync CreateNote / UpdateMetadata / DestroyNote with web3.', error); + if (process.env.NODE_ENV === 'development') { + this.paused = true; + } + }; } export default Watcher; diff --git a/packages/extension/src/background/services/EventService/utils/note/fetchNotes.js b/packages/extension/src/background/services/EventService/utils/note/fetchNotes.js index 4ac86003b..7a926449f 100644 --- a/packages/extension/src/background/services/EventService/utils/note/fetchNotes.js +++ b/packages/extension/src/background/services/EventService/utils/note/fetchNotes.js @@ -1,8 +1,10 @@ +import Web3 from 'web3'; import Web3Service from '~/helpers/Web3Service'; import { ZkAsset, } from '~/config/contracts'; import decodeNoteLogs from './helpers/decodeNoteLogs'; +import { getProviderUrl } from '~/utils/network'; export default async function fetchNotes({ owner, @@ -16,7 +18,9 @@ export default async function fetchNotes({ ZkAsset.events.updateNoteMetaData, ], } = {}) { - const { abi, getPastLogs } = Web3Service.eth; + // TODO require network selection + const provider = new Web3.providers.HttpProvider(getProviderUrl(Web3Service.networkId)); + const { abi, getPastLogs } = new Web3(provider).eth; const eventsTopics = events .map(e => ZkAsset.config.abi.find(({ name, type }) => name === e && type === 'event')) diff --git a/packages/extension/src/config/provider.js b/packages/extension/src/config/provider.js index 1ba817ff9..77d0954e7 100644 --- a/packages/extension/src/config/provider.js +++ b/packages/extension/src/config/provider.js @@ -1,5 +1,5 @@ export const infuraProjectId = '09c4eed231c840d5ace14ba5389a1a7c'; -export const infuraProviderUrlPattern = 'wss://{networkName}.infura.io/ws/v3/{projectId}'; +export const infuraProviderUrlPattern = 'https://{networkName}.infura.io/v3/{projectId}'; export const defaultProviderUrl = 'ws://localhost:8545'; From 799bc0bb2afff12eb2c2efb76284919b7aaa6da5 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Wed, 8 Jul 2020 18:34:29 +0100 Subject: [PATCH 06/13] feat(sdk): delete w file --- packages/extension/:w | 48 ------------------------------------------- 1 file changed, 48 deletions(-) delete mode 100644 packages/extension/:w diff --git a/packages/extension/:w b/packages/extension/:w deleted file mode 100644 index 9fd33257e..000000000 --- a/packages/extension/:w +++ /dev/null @@ -1,48 +0,0 @@ -const fetchOutputNotes = ({ - proofData, - proof, - signature, - signature2, -}) => { - const { - outputNotes, - remainderNote, - } = proofData || {}; - if (!outputNotes) return null; - - return { - outputNotes: outputNotes - .filter((note) => { - if (!remainderNote) return true; - return note.decryptedViewingKey !== remainderNote.decryptedViewingKey; - }) - .map(({ - noteHash, - value, - }) => ({ - noteHash, - value, - })), - }; -}; - -export default { - DEPOSIT_PROOF: [ - fetchOutputNotes, - ], - WITHDRAW_PROOF: [], - TRANSFER_PROOF: [ - fetchOutputNotes, - ], - CREATE_NOTE_FROM_BALANCE_PROOF: [ - (data) => { - const { - outputNotes, - } = fetchOutputNotes(data) || {}; - - return { - notes: outputNotes || [], - }; - }, - ], -}; From f48ced0ce924551b688e29a1f2841ee343ed23ef Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Wed, 8 Jul 2020 18:41:10 +0100 Subject: [PATCH 07/13] feat(sdk): clean lint errors --- .../services/EventService/helpers/NotesSyncManager/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js index 8091e2231..adc84785e 100644 --- a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js +++ b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/index.js @@ -21,7 +21,7 @@ const infuraLimitError = { const uriTooLong = { code: -32603, }; - +// eslint-disable-next-line const isInfuraLimitError = error => error && error.code === infuraLimitError.code || error.code === uriTooLong.code; const SYNCING_STATUS = { From 68f466212adfc6636af70f82e3c15a770854051a Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 9 Jul 2020 10:59:04 +0100 Subject: [PATCH 08/13] feat(sdk): fix subscriptions --- .../services/EventService/utils/note/subscription.js | 8 ++++---- packages/extension/src/config/provider.js | 3 ++- packages/extension/src/utils/network/getProviderUrl.js | 7 ++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/packages/extension/src/background/services/EventService/utils/note/subscription.js b/packages/extension/src/background/services/EventService/utils/note/subscription.js index 4b3065774..fc5860318 100644 --- a/packages/extension/src/background/services/EventService/utils/note/subscription.js +++ b/packages/extension/src/background/services/EventService/utils/note/subscription.js @@ -1,3 +1,4 @@ +import Web3 from 'web3'; import Web3Service from '~/helpers/Web3Service'; import { ZkAsset, @@ -6,6 +7,7 @@ import { errorLog, } from '~/utils/log'; import decodeNoteLogs from './helpers/decodeNoteLogs'; +import { getProviderUrl } from '~/utils/network'; const subscribe = async ({ owner, @@ -18,10 +20,8 @@ const subscribe = async ({ return null; } - const { - abi, - subscribe: subscribeOn, - } = Web3Service.eth; + const provider = getProviderUrl(Web3Service.networkId, true); + const { abi, subscribe: subscribeOn } = new Web3(provider).eth; const eventsTopics = [ ZkAsset.events.createNote, diff --git a/packages/extension/src/config/provider.js b/packages/extension/src/config/provider.js index 77d0954e7..6ee3351b1 100644 --- a/packages/extension/src/config/provider.js +++ b/packages/extension/src/config/provider.js @@ -1,5 +1,6 @@ export const infuraProjectId = '09c4eed231c840d5ace14ba5389a1a7c'; -export const infuraProviderUrlPattern = 'https://{networkName}.infura.io/v3/{projectId}'; +export const infuraHttpProviderUrlPattern = 'https://{networkName}.infura.io/v3/{projectId}'; +export const infuraWsProviderUrlPattern = 'wss://{networkName}.infura.io/ws/v3/{projectId}'; export const defaultProviderUrl = 'ws://localhost:8545'; diff --git a/packages/extension/src/utils/network/getProviderUrl.js b/packages/extension/src/utils/network/getProviderUrl.js index 81d6b7fc3..acd29b4ee 100644 --- a/packages/extension/src/utils/network/getProviderUrl.js +++ b/packages/extension/src/utils/network/getProviderUrl.js @@ -1,14 +1,15 @@ import networks from '~/config/networks'; import { infuraProjectId, - infuraProviderUrlPattern, + infuraHttpProviderUrlPattern, + infuraWsProviderUrlPattern, defaultProviderUrl, } from '~/config/provider'; import { formatStrPattern, } from '~/utils/format'; -export default function getProviderUrl(networkId, projectId = infuraProjectId) { +export default function getProviderUrl(networkId, ws = false, projectId = infuraProjectId) { const networkKey = Object.keys(networks) .find(name => networks[name].id === networkId); const network = networks[networkKey]; @@ -20,7 +21,7 @@ export default function getProviderUrl(networkId, projectId = infuraProjectId) { networkName, } = network; - return formatStrPattern(infuraProviderUrlPattern, { + return formatStrPattern(ws ? infuraWsProviderUrlPattern : infuraHttpProviderUrlPattern, { networkName: networkName.toLowerCase(), projectId, }); From e2e944804b37e9f401a35d1143ce69438151c523 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 9 Jul 2020 13:31:27 +0100 Subject: [PATCH 09/13] feat(sdk): migrate db to fix hardcoding users --- packages/extension/src/background/tasks/acceptConnection.js | 2 +- packages/extension/src/config/database.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/extension/src/background/tasks/acceptConnection.js b/packages/extension/src/background/tasks/acceptConnection.js index f1a5fcd89..9cfb555a0 100644 --- a/packages/extension/src/background/tasks/acceptConnection.js +++ b/packages/extension/src/background/tasks/acceptConnection.js @@ -36,7 +36,7 @@ export default function acceptConnection() { if (clientProfile) { try { - await migrateIndexedDB(); + // await migrateIndexedDB(); networkConfig = await setupNetworkConfig(clientProfile); connection.initUi(); } catch (e) { diff --git a/packages/extension/src/config/database.js b/packages/extension/src/config/database.js index 2481a1e9b..2f984f618 100644 --- a/packages/extension/src/config/database.js +++ b/packages/extension/src/config/database.js @@ -1,3 +1,3 @@ -export const version = 1; +export const version = 2; export const sdkSettingDbName = 'aztec-sdk'; export const networkDbPrefix = 'aztec_network'; From d4c4e44d5eae5043c9e44b9c66f255042a855563 Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 16 Jul 2020 14:06:59 +0100 Subject: [PATCH 10/13] feat(sdk): reduce gas cost for sdk --- packages/extension/src/utils/Web3Service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/utils/Web3Service.js b/packages/extension/src/utils/Web3Service.js index af65beb17..20b527248 100644 --- a/packages/extension/src/utils/Web3Service.js +++ b/packages/extension/src/utils/Web3Service.js @@ -390,7 +390,7 @@ class Web3Service { method: gsnContract.methods[methodName], fromAddress: signingInfo.address, args, - gasPrice: gasPrice ? gasPrice * 2 : 18000000000, // set gas price 100% higher than last few blocks median to ensure we get in the block + gasPrice: gasPrice ? gasPrice * 1 : 18000000000, // set gas price 100% higher than last few blocks median to ensure we get in the block web3, }); }, From 4c8109ab3252735c626e6c250a8d035971cfe3ed Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 16 Jul 2020 14:07:28 +0100 Subject: [PATCH 11/13] feat(sdk): remove dai permit --- packages/extension/src/config/supportsPermitSignature.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/config/supportsPermitSignature.js b/packages/extension/src/config/supportsPermitSignature.js index 2cdd92a3d..18905f465 100644 --- a/packages/extension/src/config/supportsPermitSignature.js +++ b/packages/extension/src/config/supportsPermitSignature.js @@ -1,3 +1,3 @@ export default { - '0x6B175474E89094C44Da98b954EedeAC495271d0F': true, + // '0x6B175474E89094C44Da98b954EedeAC495271d0F': true, }; From 12e14c6577283681d873c0e90040a0a39ac37d5f Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 16 Jul 2020 15:20:48 +0100 Subject: [PATCH 12/13] feat(sdk): blocks sync manager --- .../services/EventService/helpers/NotesSyncManager/factory.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/factory.js b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/factory.js index 13ce378ea..0d281376f 100644 --- a/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/factory.js +++ b/packages/extension/src/background/services/EventService/helpers/NotesSyncManager/factory.js @@ -5,7 +5,7 @@ class NotesSyncManagerFactory { managersByNetworks = {}; config = { - blocksPerRequest: 5307319, // ~ per 3 months (~6000 per day) + blocksPerRequest: 100, // ~ per 3 months (~6000 per day) precisionDelta: 10, // networkId: null, }; From 6bbdb23a6098de0a993c134581b10cb2b58d5a8f Mon Sep 17 00:00:00 2001 From: Joe Andrews Date: Thu, 16 Jul 2020 18:14:29 +0100 Subject: [PATCH 13/13] feat(sdk): fix lint --- packages/extension/src/background/tasks/acceptConnection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/extension/src/background/tasks/acceptConnection.js b/packages/extension/src/background/tasks/acceptConnection.js index 9cfb555a0..5135e8f9a 100644 --- a/packages/extension/src/background/tasks/acceptConnection.js +++ b/packages/extension/src/background/tasks/acceptConnection.js @@ -14,7 +14,7 @@ import { errorLog, } from '~/utils/log'; import Connection from '../utils/connection'; -import migrateIndexedDB from './migrateIndexedDB'; +// import migrateIndexedDB from './migrateIndexedDB'; import setupNetworkConfig from './setupNetworkConfig'; const resourceOrigin = getResourceUrl('origin');