diff --git a/src/config/evm-network.ts b/src/config/evm-network.ts index 9ed860a..32523f1 100644 --- a/src/config/evm-network.ts +++ b/src/config/evm-network.ts @@ -93,8 +93,31 @@ const evmNetworks: Record = { }, contracts: { factory: "0x96f7849C6D0EB09024e482Cc9c249096e3368a16" }, }, + 42170: { + name: "Arbitrum Nova", + nativeCurrency: { + name: "Ether", + symbol: "ETH", + decimals: 18, + }, + rpc: ["https://nova.arbitrum.io/rpc"], + explorers: [ + { + name: "Arbitrum Nova Chain Explorer", + url: "https://nova-explorer.arbitrum.io", + icon: "blockscout", + standard: "EIP3091", + }, + ], + txConst: { + blockTimeSec: 3, + rbfTimes: 5, + boardcastTimes: 10, + }, + contracts: { factory: "0x6B7315a594263A886e8DecE2FfCB7b37cab0941b" }, + }, 421613: { - name: "Arbitrum - Goerli", + name: "Arbitrum Goerli", nativeCurrency: { name: "Arbitrum Ether", symbol: "ETH", diff --git a/src/scripts/sync.ts b/src/scripts/sync.ts index 2aff3eb..b58b491 100644 --- a/src/scripts/sync.ts +++ b/src/scripts/sync.ts @@ -39,6 +39,10 @@ function loadCache() { start: 9623490, last: 9623490, }, + 42170: { + start: 2699199, + last: 2699199, + }, }, hubs: {}, ns: { diff --git a/src/storage/ETHStorage.ts b/src/storage/ETHStorage.ts index 06e758b..81be0c1 100644 --- a/src/storage/ETHStorage.ts +++ b/src/storage/ETHStorage.ts @@ -2,6 +2,7 @@ import { Ref, Status, Storage } from "./storage.js" import { ethers } from "ethers" import { TxManager } from "../common/tx-manager.js" import { Git3Protocol } from "../common/git3-protocol.js" +import { Retrier } from "../common/queue-task.js" export class ETHStorage implements Storage { repoName: string @@ -21,12 +22,15 @@ export class ETHStorage implements Storage { async hasPermission(ref: string): Promise { let sender = await this.wallet.getAddress() - let isMember = await this.contract.isRepoMembership(Buffer.from(this.repoName),sender) + let isMember = await this.contract.isRepoMembership(Buffer.from(this.repoName), sender) return isMember } async download(path: string): Promise<[Status, Buffer]> { - const res = await this.contract.download(Buffer.from(this.repoName), Buffer.from(path)) + const res = await Retrier( + async () => await this.contract.download(Buffer.from(this.repoName), Buffer.from(path)), + { maxRetry: 10 } + ) const buffer = Buffer.from(res[0].slice(2), "hex") console.error(`=== download file ${path} succeed ===`) return [Status.SUCCEED, buffer] @@ -111,7 +115,10 @@ export class ETHStorage implements Storage { } async listRefs(): Promise { - const res: string[][] = await this.contract.listRepoRefs(Buffer.from(this.repoName)) + const res: string[][] = await Retrier( + async () => await this.contract.listRepoRefs(Buffer.from(this.repoName)), + { maxRetry: 3 } + ) let refs = res.map((i) => ({ ref: Buffer.from(i[1].slice(2), "hex") .toString("utf8") diff --git a/src/storage/SLIStorage.ts b/src/storage/SLIStorage.ts index a30eaf8..971dc56 100644 --- a/src/storage/SLIStorage.ts +++ b/src/storage/SLIStorage.ts @@ -51,10 +51,9 @@ export class SLIStorage implements Storage { }) } - async hasPermission(ref: string): Promise { let sender = await this.wallet.getAddress() - let isMember = await this.contract.isRepoMembership(Buffer.from(this.repoName),sender) + let isMember = await this.contract.isRepoMembership(Buffer.from(this.repoName), sender) return isMember } @@ -173,7 +172,10 @@ export class SLIStorage implements Storage { } async listRefs(): Promise { - const res: string[][] = await this.contract.listRepoRefs(Buffer.from(this.repoName)) + const res: string[][] = await Retrier( + async () => await this.contract.listRepoRefs(Buffer.from(this.repoName)), + { maxRetry: 3 } + ) let refs = res.map((i) => ({ ref: Buffer.from(i[1].slice(2), "hex") .toString("utf8")