From 0a11c3aed1a347f1bc810b3908e92e34f16a6f2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 01:38:12 +0100 Subject: [PATCH 1/6] fix gas limit bug --- src/components/ContractInteraction.vue | 2 +- src/plugins/server.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ContractInteraction.vue b/src/components/ContractInteraction.vue index 23a42a20..937ce76a 100644 --- a/src/components/ContractInteraction.vue +++ b/src/components/ContractInteraction.vue @@ -100,7 +100,7 @@ export default { }, callOptions: { from: null, - gasLimit: '100000', + gasLimit: null, gasPrice: null }, rpcConnectionStatus: false, diff --git a/src/plugins/server.js b/src/plugins/server.js index efdf1f4f..c5005782 100644 --- a/src/plugins/server.js +++ b/src/plugins/server.js @@ -161,7 +161,7 @@ const serverFunctions = { var provider = data.provider ? new ethers.providers.Web3Provider(data.provider, 'any') : serverFunctions._getProvider(data.rpcServer); var signer; var options = sanitize({ - gasLimit: data.options.gasLimit || 100000, + gasLimit: data.options.gasLimit, gasPrice: data.options.gasPrice, blockTag: data.options.blockTag }); From 1e9fec9c90ee7f70b4cacf15d7cf538a38e7c311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 01:39:03 +0100 Subject: [PATCH 2/6] update license & changelog --- CHANGELOG.md | 4 ++++ LICENSE | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48e7822e..14f66656 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [3.26.11] - 2024-02-16 +### Fixed +- Gas limit bug + ## [3.26.10] - 2024-02-15 ### Added - Background job to clean dangling token transfers diff --git a/LICENSE b/LICENSE index de531b2c..bfa9c657 100644 --- a/LICENSE +++ b/LICENSE @@ -17,7 +17,7 @@ Additional Use Grant: You may make use of the Licensed Work, provided that you d debugging or block exploring features of the Licensed Work. -Change Date: 2029-02-14 +Change Date: 2029-02-16 Change License: Apache License, Version 2.0 From e1a5753dd4b8a07f2752b3e68a215011c40d7ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 01:39:11 +0100 Subject: [PATCH 3/6] 3.26.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 16e7c0eb..329ef419 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ethernal", - "version": "3.26.10", + "version": "3.26.11", "private": true, "scripts": { "serve": "vue-cli-service serve", From f524303c53eb87e74aebc65229084cfd2296f187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 11:36:23 +0100 Subject: [PATCH 4/6] better reset --- run/lib/firebase.js | 2 +- run/models/workspace.js | 53 ++++++++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 20 deletions(-) diff --git a/run/lib/firebase.js b/run/lib/firebase.js index 6c4b5607..4a576208 100644 --- a/run/lib/firebase.js +++ b/run/lib/firebase.js @@ -34,7 +34,7 @@ const workspaceNeedsBatchReset = async (userId, workspaceId) => { const blocks = await workspace.getBlocks({ limit: getMaxBlockForSyncReset() }); - return blocks.length == getMaxBlockForSyncReset(); + return false; }; const resetExplorerTransactionQuota = async (userId, explorerId) => { diff --git a/run/models/workspace.js b/run/models/workspace.js index ba709711..862ad30e 100644 --- a/run/models/workspace.js +++ b/run/models/workspace.js @@ -1026,12 +1026,26 @@ module.exports = (sequelize, DataTypes) => { }); } - safeDestroyIntegrityCheck() { - return sequelize.models.IntegrityCheck.destroy({ where: { workspaceId: this.id }}); + async safeDestroyIntegrityCheck(transaction) { + const integrityCheck = await this.getIntegrityCheck(); + if (integrityCheck) + await integrityCheck.destroy(transaction); + + return this.update({ integrityCheckStartBlockNumber: null }, { transaction }); + } + + async safeDestroyRpcHealthCheck(transaction) { + const rpcHealthCheck = await this.getRpcHealthCheck(); + if (rpcHealthCheck) + return rpcHealthCheck.destroy({ transaction }); } - safeDestroyAccounts() { - return sequelize.models.Account.destroy({ where: { workspaceId: this.id }}); + async safeDestroyAccounts() { + return sequelize.transaction(async transaction => { + const accounts = await sequelize.models.Account.findAll(); + for (let i = 0; i < accounts.length; i++) + await accounts[i].safeDestroy(transaction); + }); } async reset(dayInterval, transaction) { @@ -1039,21 +1053,22 @@ module.exports = (sequelize, DataTypes) => { if (dayInterval) filter['where']['createdAt'] = { [Op.lt]: sequelize.literal(`NOW() - interval '${dayInterval} day'`)}; - const destroyAll = async (transaction) => { - await sequelize.models.IntegrityCheck.destroy(filter, { transaction }); - await sequelize.models.RpcHealthCheck.destroy(filter, { transaction }); - await sequelize.models.TokenBalanceChange.destroy(filter, { transaction }); - await sequelize.models.TokenTransfer.destroy(filter, { transaction }); - await sequelize.models.ContractSource.destroy(filter, { transaction }); - await sequelize.models.ContractVerification.destroy(filter, { transaction }); - await sequelize.models.Erc721Token.destroy(filter, { transaction }); - await sequelize.models.Block.destroy(filter, { transaction }); - await sequelize.models.Transaction.destroy(filter, { transaction }); - await sequelize.models.TransactionTraceStep.destroy(filter, { transaction }); - await sequelize.models.TransactionReceipt.destroy(filter, { transaction }); - await sequelize.models.TransactionLog.destroy(filter, { transaction }); - await sequelize.models.Contract.destroy(filter, { transaction }); - await sequelize.models.Account.destroy(filter, { transaction }); + const destroyAll = async transaction => { + await this.safeDestroyIntegrityCheck(transaction); + await this.safeDestroyRpcHealthCheck(transaction); + + const blocks = await sequelize.models.Block.findAll(filter); + for (let i = 0; i < blocks.length; i++) + await blocks[i].safeDestroy(transaction); + + const contracts = await sequelize.models.Contract.findAll(filter); + for (let i = 0; i < contracts.length; i++) + await contracts[i].safeDestroy(transaction); + + const accounts = await sequelize.models.Account.findAll(filter); + for (let i = 0; i < accounts.length; i++) + await accounts[i].safeDestroy(transaction); + }; return transaction ? From b84e8d1d9c8e10f97a4348f18030ee37073977da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 11:44:12 +0100 Subject: [PATCH 5/6] remove testing case --- run/lib/firebase.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run/lib/firebase.js b/run/lib/firebase.js index 4a576208..6c4b5607 100644 --- a/run/lib/firebase.js +++ b/run/lib/firebase.js @@ -34,7 +34,7 @@ const workspaceNeedsBatchReset = async (userId, workspaceId) => { const blocks = await workspace.getBlocks({ limit: getMaxBlockForSyncReset() }); - return false; + return blocks.length == getMaxBlockForSyncReset(); }; const resetExplorerTransactionQuota = async (userId, explorerId) => { From 0af792756ee8e721cee6a84720d3ec273cc728bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antoine=20de=20Chevign=C3=A9?= Date: Fri, 16 Feb 2024 12:17:50 +0100 Subject: [PATCH 6/6] fix variable wording --- run/lib/firebase.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/run/lib/firebase.js b/run/lib/firebase.js index 6c4b5607..98282a7f 100644 --- a/run/lib/firebase.js +++ b/run/lib/firebase.js @@ -1501,12 +1501,12 @@ const updateWorkspaceSettings = async (userId, workspace, settings) => { return newWorkspace.toJSON(); }; -const resetWorkspace = async (userId, workspace, hourInterval) => { +const resetWorkspace = async (userId, workspace, dayInterval) => { if (!userId || !String(workspace)) throw new Error('Missing parameter.'); const user = await User.findByAuthIdWithWorkspace(userId, String(workspace)); if (user && user.workspaces.length) - await user.workspaces[0].reset(hourInterval); + await user.workspaces[0].reset(dayInterval); }; const getUserbyStripeCustomerId = async (stripeCustomerId) => {