From 2f387277846684db36f67dd781056e47f0eda3c5 Mon Sep 17 00:00:00 2001 From: Antonio Salazar Cardozo Date: Wed, 6 Dec 2023 22:12:11 -0500 Subject: [PATCH 1/6] v0.53.0 --- .github/ISSUE_TEMPLATE/BUG.yml | 1 + manifest/manifest.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/BUG.yml b/.github/ISSUE_TEMPLATE/BUG.yml index 813613264..6c9aef454 100644 --- a/.github/ISSUE_TEMPLATE/BUG.yml +++ b/.github/ISSUE_TEMPLATE/BUG.yml @@ -51,6 +51,7 @@ body: label: Version description: What version of the extension are you running? options: + - v0.53.0 - v0.52.0 - v0.51.0 - v0.50.0 diff --git a/manifest/manifest.json b/manifest/manifest.json index 5d7f0d262..607f1afde 100644 --- a/manifest/manifest.json +++ b/manifest/manifest.json @@ -1,6 +1,6 @@ { "name": "Taho", - "version": "0.52.0", + "version": "0.53.0", "description": "The community owned and operated Web3 wallet.", "homepage_url": "https://taho.xyz", "author": "https://taho.xyz", diff --git a/package.json b/package.json index ca4965575..8a8081ad0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@tallyho/tally-extension", "private": true, - "version": "0.52.0", + "version": "0.53.0", "description": "Taho, the community owned and operated Web3 wallet.", "main": "index.js", "repository": "git@github.com:thesis/tally-extension.git", From 7fc5f1e26c43ef0e0678b7305cee5b1e9a02a404 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Tue, 12 Dec 2023 13:30:45 +0100 Subject: [PATCH 2/6] Hide Subscape features --- .env.defaults | 1 + background/features.ts | 1 + ui/pages/Wallet.tsx | 4 ++-- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.env.defaults b/.env.defaults index c9d03e485..33c1a64e1 100644 --- a/.env.defaults +++ b/.env.defaults @@ -30,6 +30,7 @@ SUPPORT_ARBITRUM_NOVA=false SUPPORT_SWAP_QUOTE_REFRESH=false SUPPORT_ACHIEVEMENTS_BANNER=false SUPPORT_NFT_SEND=false +HIDE_ISLAND_UI=true SUPPORT_THE_ISLAND=true SUPPORT_THE_ISLAND_ON_TENDERLY=false USE_MAINNET_FORK=false diff --git a/background/features.ts b/background/features.ts index e4a9b5c56..040ff38e7 100644 --- a/background/features.ts +++ b/background/features.ts @@ -23,6 +23,7 @@ export const RuntimeFlag = { SUPPORT_SWAP_QUOTE_REFRESH: process.env.SUPPORT_SWAP_QUOTE_REFRESH === "true", SUPPORT_CUSTOM_NETWORKS: process.env.SUPPORT_CUSTOM_NETWORKS === "true", SUPPORT_CUSTOM_RPCS: process.env.SUPPORT_CUSTOM_RPCS === "true", + HIDE_ISLAND_UI: process.env.HIDE_ISLAND_UI === "true", SUPPORT_THE_ISLAND: process.env.SUPPORT_THE_ISLAND === "true", SUPPORT_THE_ISLAND_ON_TENDERLY: process.env.SUPPORT_THE_ISLAND_ON_TENDERLY === "true", diff --git a/ui/pages/Wallet.tsx b/ui/pages/Wallet.tsx index 975194713..b9fe778f8 100644 --- a/ui/pages/Wallet.tsx +++ b/ui/pages/Wallet.tsx @@ -102,7 +102,7 @@ export default function Wallet(): ReactElement { return ( <>
- + {!isEnabled(FeatureFlags.HIDE_ISLAND_UI) && }
)} - + {!isEnabled(FeatureFlags.HIDE_ISLAND_UI) && }
Date: Tue, 12 Dec 2023 15:31:35 +0100 Subject: [PATCH 3/6] Add Subscape realms by adddress not name --- background/services/island/contracts.ts | 14 ++++++++------ background/services/island/index.ts | 18 ++++++------------ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/background/services/island/contracts.ts b/background/services/island/contracts.ts index ed39a7e22..60c535cf9 100644 --- a/background/services/island/contracts.ts +++ b/background/services/island/contracts.ts @@ -1930,12 +1930,14 @@ export const CLAIM_WITH_FRIENDS_ABI = [ }, ] as const -export const STARTING_REALM_NAMES = [ - "Creators", - "Defi", - "Educate", - "Social", - "Vampire", +export const STARTING_REALM_ADDRESSES = [ + "0xa5853ca1eac56bf78213b8300b695e7cfa563b4a", + "0x06894597d381542a55d2946e20117c29dbae2351", + "0xc92AF0c1f3111254b73eea97D803155b1E542Ee3", + "0x42a0b5cab976d7a2a0038138dd1279b96b73f029", + "0x26770639eB1262cfA47A4C3Aa27902fa8FCA3465", + "0x6a3d1d9a7eb615be82b5c50bba8c6ecc7606afe6", + "0xdc053c0beed726ee6316d4d04135d755466522c8", ] export function buildRealmContract( diff --git a/background/services/island/index.ts b/background/services/island/index.ts index 05bc6c8af..740ecbc4f 100644 --- a/background/services/island/index.ts +++ b/background/services/island/index.ts @@ -9,9 +9,8 @@ import { sameNetwork } from "../../networks" import { ClaimWithFriends, ISLAND_NETWORK, - STARTING_REALM_NAMES, + STARTING_REALM_ADDRESSES, TESTNET_TAHO, - TestnetTahoDeployer, buildRealmContract, } from "./contracts" import IndexingService from "../indexing" @@ -108,16 +107,11 @@ export default class IslandService extends BaseService { this.emitter.emit("monitoringTestnetAsset", TESTNET_TAHO) } - const connectedDeployer = TestnetTahoDeployer.connect(islandProvider) await Promise.all( - STARTING_REALM_NAMES.map(async (realmName) => { - const realmAddress = - await connectedDeployer.functions[ - `${realmName.toUpperCase()}_REALM` - ]() - const realmContract = buildRealmContract(realmAddress[0]).connect( - islandProvider, - ) + STARTING_REALM_ADDRESSES.map(async (realmAddress) => { + const realmContract = buildRealmContract( + normalizeEVMAddress(realmAddress), + ).connect(islandProvider) const realmVeTahoAddress = (await realmContract.functions.veTaho())[0] const realmVeAsset = @@ -134,7 +128,7 @@ export default class IslandService extends BaseService { if (realmXpAddress === ethers.constants.AddressZero) { logger.debug( - `XP token for realm ${realmName} at ${realmAddress} is not yet set, throwing an error to retry tracking later.`, + `XP token for realm at ${realmAddress} is not yet set, throwing an error to retry tracking later.`, ) throw new Error(`XP token does not exist for realm ${realmAddress}`) From 8686f2229e0915589348641c54adc5765274d060 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Wed, 13 Dec 2023 17:04:33 +0100 Subject: [PATCH 4/6] Create script to export pledge signers Let's allow to save pledge signers to JSON files using format supported on Snapshot --- .../pledge-signer-sync/pledge-export.js | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/pledge-signer-sync/pledge-export.js diff --git a/.github/workflows/pledge-signer-sync/pledge-export.js b/.github/workflows/pledge-signer-sync/pledge-export.js new file mode 100644 index 000000000..554175197 --- /dev/null +++ b/.github/workflows/pledge-signer-sync/pledge-export.js @@ -0,0 +1,121 @@ +// @ts-check +/* eslint-disable no-console */ // need logging +/* eslint-disable no-await-in-loop */ // need to process items in sequence +import { getAuth, signInWithEmailAndPassword } from "firebase/auth" +import { initializeApp } from "firebase/app" +import { + getFirestore, + query, + orderBy, + limit, + getDocs, + collection, + startAfter, + where, +} from "firebase/firestore" +import fs from "fs" + +const { FIRESTORE_USER, FIRESTORE_PASSWORD } = process.env + +if (!FIRESTORE_USER || !FIRESTORE_PASSWORD) { + console.error("Missing credentials") + process.exit(1) +} + +// Limit sync range to last X days (here: 30 days) +const TARGET_DATE = new Date(Date.now() - 30 * 24 * 60 * 60_000) +const CHUNK_SIZE = 10_000 + +const wait = (ms) => + new Promise((r) => { + setTimeout(r, ms) + }) + +const saveSnapshot = async (addresses, index) => { + if (!addresses) { + throw new Error("Unable to retrieve pledge signers addresses") + } + + console.log( + `Saving snapshot of ${addresses.length} addresses to ./exports/pledge-export-${index}.json`, + ) + + const jsonContent = { + score: addresses.map((address) => ({ address, score: 1 })), + } + + try { + fs.writeFileSync( + `./exports/pledge-export-${index}.json`, + JSON.stringify(jsonContent), + ) + console.log("Snapshot saved!\n") + } catch (err) { + console.error(err) + } +} + +const exportSnapshot = async () => { + const app = initializeApp({ + apiKey: "AIzaSyAa78OwfLesUAW8hdzbhUkc5U8LSVH3y7s", + authDomain: "tally-prd.firebaseapp.com", + projectId: "tally-prd", + storageBucket: "tally-prd.appspot.com", + messagingSenderId: "567502050788", + appId: "1:567502050788:web:bb953a931a98e396d363f1", + }) + + await signInWithEmailAndPassword( + getAuth(app), + FIRESTORE_USER, + FIRESTORE_PASSWORD, + ) + + const db = getFirestore(app) + const dbCollection = collection(db, "address") + + const fetchNextBatch = async (offset) => { + let currentQuery = query( + dbCollection, + orderBy("signedManifesto.timestamp", "desc"), + limit(CHUNK_SIZE), + where("signedManifesto.timestamp", ">=", TARGET_DATE), // Comment this line to export all addresses + ) + + if (offset) { + currentQuery = query(currentQuery, startAfter(offset)) + } + + return getDocs(currentQuery).then((snapshot) => snapshot.docs) + } + + let allDocsCount = 0 + let exportIndex = 0 + + let offsetDoc + let nextBatch = [] + + do { + nextBatch = await fetchNextBatch(offsetDoc) + + offsetDoc = nextBatch[nextBatch.length - 1] + + allDocsCount += nextBatch.length + + console.log("Retrieved:", allDocsCount, "addresses") + + await saveSnapshot( + nextBatch.map((doc) => doc.id), + exportIndex, + ) + + exportIndex += 1 + + await wait(1500) + } while (nextBatch.length === CHUNK_SIZE) +} + +exportSnapshot().then(() => { + console.log("Export complete!") + process.exit(0) +}) From ea3e569cf01a36e3eba78d6a2c671def12097291 Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Wed, 13 Dec 2023 17:29:54 +0100 Subject: [PATCH 5/6] Fix removing custom networks Add database transaction dependency to fix removing items from `customRpcConfig` table. --- background/services/chain/db.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/background/services/chain/db.ts b/background/services/chain/db.ts index bf5d77dbe..b7fdb5a90 100644 --- a/background/services/chain/db.ts +++ b/background/services/chain/db.ts @@ -292,6 +292,7 @@ export class ChainDatabase extends Dexie { this.baseAssets, this.rpcConfig, this.accountsToTrack, + this.customRpcConfig, async () => { await Promise.all([ this.networks.where({ chainID }).delete(), From 79db56a05ac16080d519e717055e4e05202aab2c Mon Sep 17 00:00:00 2001 From: Jagoda Berry Rybacka Date: Thu, 14 Dec 2023 12:10:05 +0100 Subject: [PATCH 6/6] Disable listeners on realm contract Listening on realm contracts causes `eth_getLogs` to spam RPC node. Let's disable for now to stop spamming Alchemy. --- background/services/island/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/background/services/island/index.ts b/background/services/island/index.ts index 740ecbc4f..56d02acaa 100644 --- a/background/services/island/index.ts +++ b/background/services/island/index.ts @@ -142,9 +142,10 @@ export default class IslandService extends BaseService { ) if (realmXpAsset !== undefined) { this.emitter.emit("monitoringTestnetAsset", realmXpAsset) - realmContract.on(realmContract.filters.XpDistributed(), () => { - this.checkXPDrop() - }) + // TODO: disabled because it causes `eth_getLogs` to spam the RPC node + // realmContract.on(realmContract.filters.XpDistributed(), () => { + // this.checkXPDrop() + // }) } }), )