From 19847934ce8dc7560dece372bec798434cc6f477 Mon Sep 17 00:00:00 2001 From: Mateusz Radomski <33978857+mateuszradomski@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:50:43 +0200 Subject: [PATCH] Migrate from Goerli to Holesky (#48) * Migrate to holesky * Fix formatting * Lint catch * Migrate to new viem version * Remove the gas quick-fix * Update the contract address * Update contract creation block --- packages/node/package.json | 2 +- packages/node/src/config/config.production.ts | 8 +- .../node/src/core/BatchDownloader.test.ts | 2 +- packages/node/src/core/BatchDownloader.ts | 15 +- .../ethereum/EthereumPrivateClient.ts | 3 - packages/shared/package.json | 2 +- packages/wallet/package.json | 2 +- packages/wallet/pages/index.tsx | 4 +- yarn.lock | 136 +++++++++--------- 9 files changed, 78 insertions(+), 96 deletions(-) diff --git a/packages/node/package.json b/packages/node/package.json index b36ff6a..d04b9de 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -38,7 +38,7 @@ "drizzle-orm": "^0.25.4", "lodash": "^4.17.21", "postgres": "^3.3.5", - "viem": "^0.3.22", + "viem": "^1.15.3", "zod": "^3.21.4" } } diff --git a/packages/node/src/config/config.production.ts b/packages/node/src/config/config.production.ts index 437b069..bd27864 100644 --- a/packages/node/src/config/config.production.ts +++ b/packages/node/src/config/config.production.ts @@ -1,6 +1,6 @@ import { EthereumAddress, Hex } from '@byor/shared' import { config as dotenv } from 'dotenv' -import { goerli } from 'viem/chains' +import { holesky } from 'viem/chains' import { Config } from './Config' import GENESIS_STATE from './genesis.json' @@ -10,12 +10,12 @@ export function getProductionConfig(): Config { dotenv() return { - chain: goerli, + chain: holesky, rpcUrl: getEnv('RPC_URL'), contractAddress: EthereumAddress( - '0x1155cBF8aAf5d086051A0D5a3f1B900473d22419', + '0x1c292ae278dCf230e9D31F39F3c1b088f5d72ca0', ), - contractCreationBlock: 9219782, + contractCreationBlock: 44830, batchDownloader: { intervalMs: 5_000, reorgOffset: 15n, diff --git a/packages/node/src/core/BatchDownloader.test.ts b/packages/node/src/core/BatchDownloader.test.ts index 4506453..5915e07 100644 --- a/packages/node/src/core/BatchDownloader.test.ts +++ b/packages/node/src/core/BatchDownloader.test.ts @@ -284,7 +284,7 @@ describe(BatchDownloader.name, () => { ) await expect(batchDownloader.getNewBatches()).toBeRejectedWith( - 'Size must be in increments of 32 bytes', + 'Data size of 5 bytes is too small for given parameters', ) }) }) diff --git a/packages/node/src/core/BatchDownloader.ts b/packages/node/src/core/BatchDownloader.ts index 8eb99e5..c053eb8 100644 --- a/packages/node/src/core/BatchDownloader.ts +++ b/packages/node/src/core/BatchDownloader.ts @@ -103,11 +103,6 @@ export class BatchDownloader { async eventsToCallData(events: BatchAppendedLogsType): Promise { const txs = await Promise.all( events.map((event) => { - assert( - event.transactionHash !== null, - 'Expected the transaction hash in the event to be non-null', - ) - return this.client.getTransaction(Hex(event.transactionHash)) }), ) @@ -127,11 +122,6 @@ export class BatchDownloader { async eventsToTimestamps(events: BatchAppendedLogsType): Promise { const blocks = await Promise.all( events.map((event) => { - assert( - event.blockHash !== null, - 'Expected the block hash in the event to be non-null', - ) - return this.client.getBlockHeader(Hex(event.blockHash)) }), ) @@ -154,5 +144,8 @@ export class BatchDownloader { } function eventsToPosters(events: BatchAppendedLogsType): EthereumAddress[] { - return events.map((e) => EthereumAddress(e.args.sender)) + return events.map((e) => { + assert(e.args.sender !== undefined, 'Unexepected lack of event sender') + return EthereumAddress(e.args.sender) + }) } diff --git a/packages/node/src/peripherals/ethereum/EthereumPrivateClient.ts b/packages/node/src/peripherals/ethereum/EthereumPrivateClient.ts index f2aa45c..2a236ff 100644 --- a/packages/node/src/peripherals/ethereum/EthereumPrivateClient.ts +++ b/packages/node/src/peripherals/ethereum/EthereumPrivateClient.ts @@ -26,9 +26,6 @@ export class EthereumPrivateClient extends EthereumClient { // eslint-disable-next-line account: this.privateProvider.account!, chain: this.privateProvider.chain, - gas: 100_000n, - maxFeePerGas: 100n, - maxPriorityFeePerGas: 100n }) } } diff --git a/packages/shared/package.json b/packages/shared/package.json index 52bff2c..676c7e6 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -19,6 +19,6 @@ "devDependencies": {}, "dependencies": { "abitype": "^0.8.11", - "viem": "^0.3.22" + "viem": "^1.15.3" } } diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 7b53844..bb7b13a 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -48,7 +48,7 @@ "tailwindcss": "3.3.2", "tailwindcss-animate": "^1.0.5", "typescript": "5.0.4", - "viem": "^0.3.50", + "viem": "^1.15.3", "wagmi": "^1.1.0", "zod": "^3.21.4" }, diff --git a/packages/wallet/pages/index.tsx b/packages/wallet/pages/index.tsx index 5460efc..6e3f907 100644 --- a/packages/wallet/pages/index.tsx +++ b/packages/wallet/pages/index.tsx @@ -1,7 +1,7 @@ import { localNetwork } from '@byor/shared' import { EthereumClient, w3mConnectors, w3mProvider } from '@web3modal/ethereum' import { Web3Modal } from '@web3modal/react' -import { goerli } from 'viem/chains' +import { holesky } from 'viem/chains' import { configureChains, createConfig, WagmiConfig } from 'wagmi' import { CommittedTransactionList } from '@/components/CommittedTransactionList' @@ -13,7 +13,7 @@ import { Wallet } from '@/components/Wallet' import { Navbar } from '../components/Navbar' import { Toaster } from '../components/ui/toaster' -const chains = [process.env.NODE_ENV === 'production' ? goerli : localNetwork] +const chains = [process.env.NODE_ENV === 'production' ? holesky : localNetwork] const projectId = '171b81f6da969b561d747dba97534b30' const { publicClient } = configureChains(chains, [w3mProvider({ projectId })]) diff --git a/yarn.lock b/yarn.lock index a6f602f..2c7a77f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@adraffy/ens-normalize@1.9.0": - version "1.9.0" - resolved "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.0.tgz" - integrity sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ== +"@adraffy/ens-normalize@1.9.4": + version "1.9.4" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.9.4.tgz#aae21cb858bbb0411949d5b7b3051f4209043f62" + integrity sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw== "@alloc/quick-lru@^5.2.0": version "5.2.0" @@ -855,12 +855,12 @@ resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.4.4.tgz#faab69239f8a9d0be7cd473e65f5a07735ef7b0e" integrity sha512-AHRITu/CrlQ+qzoqQtEMfaTu7GHaQ6bziQln/pVWpOYC1wU+Mq6VQQFlsDtMCnDztPZtppAXdvvbNS7pcfRzlw== -"@noble/curves@1.0.0", "@noble/curves@~1.0.0": - version "1.0.0" - resolved "https://registry.npmjs.org/@noble/curves/-/curves-1.0.0.tgz" - integrity sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw== +"@noble/curves@1.2.0", "@noble/curves@~1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== dependencies: - "@noble/hashes" "1.3.0" + "@noble/hashes" "1.3.2" "@noble/curves@^1.0.0": version "1.1.0" @@ -874,16 +874,21 @@ resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz" integrity sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ== -"@noble/hashes@1.3.0", "@noble/hashes@~1.3.0": - version "1.3.0" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz" - integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== - "@noble/hashes@1.3.1", "@noble/hashes@^1.3.0": version "1.3.1" resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz" integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== +"@noble/hashes@1.3.2", "@noble/hashes@~1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + +"@noble/hashes@~1.3.0": + version "1.3.0" + resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.0.tgz" + integrity sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg== + "@noble/secp256k1@1.7.1", "@noble/secp256k1@~1.7.0": version "1.7.1" resolved "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz" @@ -1488,6 +1493,11 @@ resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz" integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== +"@scure/base@~1.1.2": + version "1.1.3" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" + integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== + "@scure/bip32@1.1.5": version "1.1.5" resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz" @@ -1497,14 +1507,14 @@ "@noble/secp256k1" "~1.7.0" "@scure/base" "~1.1.0" -"@scure/bip32@1.3.0": - version "1.3.0" - resolved "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.0.tgz" - integrity sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q== +"@scure/bip32@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" + integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== dependencies: - "@noble/curves" "~1.0.0" - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" + "@noble/curves" "~1.2.0" + "@noble/hashes" "~1.3.2" + "@scure/base" "~1.1.2" "@scure/bip39@1.1.1": version "1.1.1" @@ -1514,10 +1524,10 @@ "@noble/hashes" "~1.2.0" "@scure/base" "~1.1.0" -"@scure/bip39@1.2.0": - version "1.2.0" - resolved "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.0.tgz" - integrity sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg== +"@scure/bip39@1.2.1": + version "1.2.1" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" + integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== dependencies: "@noble/hashes" "~1.3.0" "@scure/base" "~1.1.0" @@ -2115,6 +2125,13 @@ dependencies: "@types/node" "*" +"@types/ws@^8.5.5": + version "8.5.6" + resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.5.6.tgz#e9ad51f0ab79b9110c50916c9fcbddc36d373065" + integrity sha512-8B5EO9jLVCy+B58PLHvLDuOD8DRVMgQzq8d55SjLCOn9kqGyqOvy27exVaTio1q1nX5zLu8/6N0n2ThSxOM6tg== + dependencies: + "@types/node" "*" + "@types/yargs-parser@*": version "21.0.0" resolved "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz" @@ -2211,11 +2228,6 @@ "@typescript-eslint/types" "5.59.5" eslint-visitor-keys "^3.3.0" -"@wagmi/chains@0.2.16": - version "0.2.16" - resolved "https://registry.npmjs.org/@wagmi/chains/-/chains-0.2.16.tgz" - integrity sha512-rkWaI2PxCnbD8G07ZZff5QXftnSkYL0h5f4DkHCG3fGYYr/ZDvmCL4bMae7j7A9sAif1csPPBmbCzHp3R5ogCQ== - "@wagmi/chains@1.0.0": version "1.0.0" resolved "https://registry.npmjs.org/@wagmi/chains/-/chains-1.0.0.tgz" @@ -2631,16 +2643,16 @@ abbrev@1.0.x: resolved "https://registry.npmjs.org/abbrev/-/abbrev-1.0.9.tgz" integrity sha512-LEyx4aLEC3x6T0UguF6YILf+ntvmOaWsVfENmIW0E9H09vKlLDGelMjjSm0jkDHALj8A8quZ/HapKNigzwge+Q== -abitype@0.8.2: - version "0.8.2" - resolved "https://registry.npmjs.org/abitype/-/abitype-0.8.2.tgz" - integrity sha512-B1ViNMGpfx/qjVQi0RTc2HEFHuR9uoCoTEkwELT5Y7pBPtBbctYijz9BK6+Kd0hQ3S70FhYTO2dWWk0QNUEXMA== - abitype@0.8.7: version "0.8.7" resolved "https://registry.npmjs.org/abitype/-/abitype-0.8.7.tgz" integrity sha512-wQ7hV8Yg/yKmGyFpqrNZufCxbszDe5es4AZGYPBitocfSqXtjrTG9JMWFcc4N30ukl2ve48aBTwt7NJxVQdU3w== +abitype@0.9.8: + version "0.9.8" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.9.8.tgz#1f120b6b717459deafd213dfbf3a3dd1bf10ae8c" + integrity sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ== + abitype@^0.8.11: version "0.8.11" resolved "https://registry.yarnpkg.com/abitype/-/abitype-0.8.11.tgz#66e1cf2cbf46f48d0e57132d7c1c392447536cc1" @@ -8811,35 +8823,20 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -viem@^0.3.22: - version "0.3.22" - resolved "https://registry.npmjs.org/viem/-/viem-0.3.22.tgz" - integrity sha512-nnueiZTcUz1aHrUiVkRiLNT1+h2HAt1eGlKJQ8faDuvUn1mA0f8Cax1Z1CxhwkAhVZ8HqrebZifdJobPuLPZ0A== - dependencies: - "@adraffy/ens-normalize" "1.9.0" - "@noble/curves" "1.0.0" - "@noble/hashes" "1.3.0" - "@scure/bip32" "1.3.0" - "@scure/bip39" "1.2.0" - "@wagmi/chains" "0.2.16" - abitype "0.8.2" +viem@^1.15.3: + version "1.15.3" + resolved "https://registry.yarnpkg.com/viem/-/viem-1.15.3.tgz#936030cedbc445092626bd01510a67f442025050" + integrity sha512-DywrvMMOxd0f5B3UMat3yVcQZUyDd4Zhv8zU6EyfqblEItwB48J/vBbxSVhRaqVP0rtNMUGnX+ox/yoSCBWNdA== + dependencies: + "@adraffy/ens-normalize" "1.9.4" + "@noble/curves" "1.2.0" + "@noble/hashes" "1.3.2" + "@scure/bip32" "1.3.2" + "@scure/bip39" "1.2.1" + "@types/ws" "^8.5.5" + abitype "0.9.8" isomorphic-ws "5.0.0" - ws "8.12.0" - -viem@^0.3.50: - version "0.3.50" - resolved "https://registry.npmjs.org/viem/-/viem-0.3.50.tgz" - integrity sha512-s+LxCYZTR9F/qPk1/n1YDVAX9vSeVz7GraqBZWGrDuenCJxo9ArCoIceJ6ksI0WwSeNzcZ0VVbD/kWRzTxkipw== - dependencies: - "@adraffy/ens-normalize" "1.9.0" - "@noble/curves" "1.0.0" - "@noble/hashes" "1.3.0" - "@scure/bip32" "1.3.0" - "@scure/bip39" "1.2.0" - "@wagmi/chains" "1.0.0" - abitype "0.8.7" - isomorphic-ws "5.0.0" - ws "8.12.0" + ws "8.13.0" wagmi@^1.1.0: version "1.1.0" @@ -8998,21 +8995,16 @@ ws@7.4.6: resolved "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz" integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== -ws@8.12.0: - version "8.12.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.12.0.tgz" - integrity sha512-kU62emKIdKVeEIOIKVegvqpXMSTAMLJozpHZaJNDYqBjzlSYXQGviYwN1osDLJ9av68qHd4a2oSjd7yD4pacig== +ws@8.13.0, ws@^8.5.0: + version "8.13.0" + resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz" + integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== ws@^7.4.0, ws@^7.4.5, ws@^7.4.6, ws@^7.5.1: version "7.5.9" resolved "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -ws@^8.5.0: - version "8.13.0" - resolved "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== - wsrun@^5.2.4: version "5.2.4" resolved "https://registry.npmjs.org/wsrun/-/wsrun-5.2.4.tgz"