diff --git a/environments/local.toml b/environments/local.toml index 5112b6e..8bf80c6 100644 --- a/environments/local.toml +++ b/environments/local.toml @@ -51,22 +51,28 @@ privateKey = '' contractAddress = '' - [server.p2p.nitro] - store = '' - privateKey = '' - chainPrivateKey = '' - - [server.p2p.nitro.payments] - ratesFile = '' - requestTimeoutInSecs = 10 - - [server.p2p.nitro.payments.cache] - maxAccounts = 1000 - accountTTLInSecs = 1800 - maxVouchersPerAccount = 1000 - voucherTTLInSecs = 300 - maxPaymentChannels = 10000 - paymentChannelTTLInSecs = 1800 + [server.p2p.nitro] + store = '' + privateKey = '' + chainPrivateKey = '' + + [server.p2p.nitro.payments] + ratesFile = '' + requestTimeoutInSecs = 10 + + [server.p2p.nitro.payments.cache] + maxAccounts = 1000 + accountTTLInSecs = 1800 + maxVouchersPerAccount = 1000 + voucherTTLInSecs = 300 + maxPaymentChannels = 10000 + paymentChannelTTLInSecs = 1800 + + [server.p2p.consensus] + enabled = true + publicKey = '' + privateKey = '' + watcherPartyFile = '' [metrics] host = "127.0.0.1" diff --git a/package.json b/package.json index 562f5d6..a247c9c 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "import-state:dev": "DEBUG=vulcanize:* ts-node src/cli/import-state.ts", "inspect-cid": "DEBUG=vulcanize:* ts-node src/cli/inspect-cid.ts", "index-block": "DEBUG=vulcanize:* ts-node src/cli/index-block.ts", - "peer": "DEBUG='vulcanize:*, laconic:*' node --enable-source-maps dist/cli/peer.js" + "peer": "DEBUG='vulcanize:*, laconic:*' node --enable-source-maps dist/cli/peer.js", + "gen-consensus-keys": "DEBUG=laconic:* node --enable-source-maps dist/cli/gen-consensus-keys.js" }, "repository": { "type": "git", @@ -39,13 +40,12 @@ "homepage": "https://github.com/cerc-io/mobymask-v2-watcher-ts#readme", "dependencies": { "@apollo/client": "^3.3.19", - "@cerc-io/peer": "^0.2.56", - "@cerc-io/cli": "^0.2.56", - "@cerc-io/ipld-eth-client": "^0.2.56", - "@cerc-io/nitro-node": "^0.1.9", - "@cerc-io/nitro-util": "^0.1.9", - "@cerc-io/solidity-mapper": "^0.2.56", - "@cerc-io/util": "^0.2.56", + "@cerc-io/peer": "^0.2.57", + "@cerc-io/cli": "^0.2.57", + "@cerc-io/ipld-eth-client": "^0.2.57", + "@cerc-io/nitro-node": "^0.1.10", + "@cerc-io/solidity-mapper": "^0.2.57", + "@cerc-io/util": "^0.2.57", "@ethersproject/providers": "^5.4.4", "apollo-type-bigint": "^0.1.3", "debug": "^4.3.1", diff --git a/src/cli/gen-consensus-keys.ts b/src/cli/gen-consensus-keys.ts new file mode 100644 index 0000000..4271eb0 --- /dev/null +++ b/src/cli/gen-consensus-keys.ts @@ -0,0 +1,56 @@ +// +// Copyright 2023 Vulcanize, Inc. +// + +import crypto from 'crypto'; +import debug from 'debug'; +import fs from 'fs'; +import path from 'path'; +import { hideBin } from 'yargs/helpers'; +import yargs from 'yargs'; + +const log = debug('laconic:gen-consensus-keys'); + +interface Arguments { + file: string; +} + +async function main (): Promise { + const node = crypto.createECDH('secp256k1'); + node.generateKeys('hex'); + const obj = { + publicKey: node.getPublicKey('hex', 'compressed'), + privateKey: node.getPrivateKey('hex') + }; + + const argv: Arguments = _getArgv(); + if (argv.file) { + const exportFilePath = path.resolve(argv.file); + const exportFileDir = path.dirname(exportFilePath); + + if (!fs.existsSync(exportFileDir)) { + fs.mkdirSync(exportFileDir, { recursive: true }); + } + + fs.writeFileSync(exportFilePath, JSON.stringify(obj, null, 2)); + log(`Key pair exported to file ${exportFilePath}`); + } else { + log(obj); + } +} + +function _getArgv (): any { + return yargs(hideBin(process.argv)).parserConfiguration({ + 'parse-numbers': false + }).options({ + file: { + type: 'string', + alias: 'f', + describe: 'Peer Id export file path (json)' + } + }).argv; +} + +main().catch(err => { + log(err); +}); diff --git a/src/libp2p-utils.ts b/src/libp2p-utils.ts index f748cbb..e4f849f 100644 --- a/src/libp2p-utils.ts +++ b/src/libp2p-utils.ts @@ -4,9 +4,10 @@ import debug from 'debug'; import { ethers, Signer } from 'ethers'; +import assert from 'assert'; import { TransactionReceipt, TransactionResponse } from '@ethersproject/providers'; -import { PaymentsManager } from '@cerc-io/util'; +import { PaymentsManager, Consensus } from '@cerc-io/util'; import { utils as nitroUtils } from '@cerc-io/nitro-node'; import { abi as PhisherRegistryABI } from './artifacts/PhisherRegistry.json'; @@ -28,62 +29,74 @@ export function createMessageToL2Handler ( contractAddress: string, gasLimit?: number }, - paymentsManager: PaymentsManager + paymentsManager: PaymentsManager, + consensus?: Consensus ) { - return (peerId: string, data: any): void => { + return async (peerId: string, data: any): Promise => { log(`[${getCurrentTime()}] Received a message on mobymask P2P network from peer:`, peerId); - sendMessageToL2(signer, { contractAddress, gasLimit }, data, paymentsManager); - }; -} -export async function sendMessageToL2 ( - signer: Signer, - { contractAddress, gasLimit = DEFAULT_GAS_LIMIT }: { - contractAddress: string, - gasLimit?: number - }, - data: any, - paymentsManager: PaymentsManager -): Promise { - // Message envelope includes the payload as well as a payment (to, vhash, vsig) - const { - payload: { kind, message }, - payment - } = data; + // Message envelope includes the payload as well as a payment (vhash, vsig) + const { payload, payment } = data; - if (!paymentsManager.clientAddress) { - log('Ignoring payload, payments manager not subscribed to vouchers yet'); - return; - } + // TODO: Check payment status before sending tx to l2 + await handlePayment(paymentsManager, payment, payload.kind); - // Ignore if the payload is not meant for us - if (payment.to === paymentsManager.clientAddress) { - log('Ignoring payload not meant for this client'); - return; - } + sendMessageToL2(signer, { contractAddress, gasLimit }, payload, consensus); + }; +} + +export async function handlePayment ( + paymentsManager: PaymentsManager, + payment: { vhash: string, vsig: string }, + requestKind: string +): Promise { + assert(paymentsManager.clientAddress); // Retrieve sender address const signerAddress = nitroUtils.getSignerAddress(payment.vhash, payment.vsig); // Get the configured mutation cost const mutationRates = paymentsManager.mutationRates; - if (kind in mutationRates) { - const configuredMutationCost = BigInt(mutationRates[kind as string]); + if (requestKind in mutationRates) { + const configuredMutationCost = BigInt(mutationRates[requestKind as string]); // Check for payment voucher received from the sender Nitro account const [paymentVoucherReceived, paymentError] = await paymentsManager.authenticatePayment(payment.vhash, signerAddress, configuredMutationCost); if (!paymentVoucherReceived) { - log(`Rejecting a mutation request from ${signerAddress}: ${paymentError}`); - return; + // log(`Rejecting a mutation request from ${signerAddress}: ${paymentError}`); + log(paymentError); + return false; } - log(`Serving a paid mutation request for ${signerAddress}`); + // log(`Serving a paid mutation request for ${signerAddress}`); + log(`Payment received for a mutation request from ${signerAddress}`); + return true; } else { // Serve a mutation request for free if rate is not configured - log(`Mutation rate not configured for "${kind}", serving a free mutation request to ${signerAddress}`); + // log(`Mutation rate not configured for "${requestKind}", serving a free mutation request to ${signerAddress}`); + log(`Mutation rate not configured for "${requestKind}"`); + return true; + } +} + +export async function sendMessageToL2 ( + signer: Signer, + { contractAddress, gasLimit = DEFAULT_GAS_LIMIT }: { + contractAddress: string, + gasLimit?: number + }, + data: any, + consensus?: Consensus +): Promise { + // If consensus is setup, send tx to L2 only if we are the leader + if (consensus && !consensus.isLeader()) { + log('Not a leader, skipped sending L2 tx'); + return; } + const { kind, message } = data; + const contract = new ethers.Contract(contractAddress, PhisherRegistryABI, signer); let receipt: TransactionReceipt | undefined; diff --git a/src/server.ts b/src/server.ts index a9b6800..16067fc 100644 --- a/src/server.ts +++ b/src/server.ts @@ -11,15 +11,6 @@ import { ethers } from 'ethers'; import { ServerCmd } from '@cerc-io/cli'; -import { - P2PMessageService, - Node, - EthChainService, - PermissivePolicy, - DurableStore, - utils -} from '@cerc-io/nitro-node'; - import { createResolvers } from './resolvers'; import { Indexer } from './indexer'; import { Database } from './database'; @@ -29,8 +20,7 @@ import { virtualPaymentAppAddress, consensusAppAddress } from './nitro-addresses.json'; -import { Config, PaymentsManager, getConfig } from '@cerc-io/util'; -import { Peer } from '@cerc-io/peer'; +import { PaymentsManager, getConfig } from '@cerc-io/util'; import { RatesConfig } from './config'; @@ -41,74 +31,50 @@ export const main = async (): Promise => { await serverCmd.init(Database); await serverCmd.initIndexer(Indexer); - let nitroPaymentsManager: PaymentsManager | undefined; - let p2pMessageHandler = parseLibp2pMessage; + // Initialize / start the p2p nodes + const { peer } = await serverCmd.initP2P(); + + // Initialize / start the Nitro node + const nitro = await serverCmd.initNitro({ + nitroAdjudicatorAddress, + consensusAppAddress, + virtualPaymentAppAddress + }); - const { enablePeer, peer: { enableL2Txs, l2TxsConfig }, nitro: { payments } } = serverCmd.config.server.p2p; + // Initialize / start the consensus engine + const consensus = await serverCmd.initConsensus(); + + let nitroPaymentsManager: PaymentsManager | undefined; + const { enablePeer, peer: { enableL2Txs, l2TxsConfig, pubSubTopic }, nitro: { payments } } = serverCmd.config.server.p2p; if (enablePeer) { + assert(peer); + assert(nitro); + + // Setup the payments manager if peer is enabled const ratesConfig: RatesConfig = await getConfig(payments.ratesFile); nitroPaymentsManager = new PaymentsManager(payments, ratesConfig); + // Start subscription for payment vouchers received by the client + nitroPaymentsManager.subscribeToVouchers(nitro); + + // Register the pubsub topic handler + let p2pMessageHandler = parseLibp2pMessage; + + // Send L2 txs for messages if enabled if (enableL2Txs) { assert(l2TxsConfig); const wallet = new ethers.Wallet(l2TxsConfig.privateKey, serverCmd.ethProvider); - p2pMessageHandler = createMessageToL2Handler(wallet, l2TxsConfig, nitroPaymentsManager); + p2pMessageHandler = createMessageToL2Handler(wallet, l2TxsConfig, nitroPaymentsManager, consensus); } - } - const typeDefs = fs.readFileSync(path.join(__dirname, 'schema.gql')).toString(); - await serverCmd.exec(createResolvers, typeDefs, p2pMessageHandler, nitroPaymentsManager); - - if (enablePeer) { - assert(serverCmd.peer); - assert(nitroPaymentsManager); - - const client = await setupNitro(serverCmd.config, serverCmd.peer); - log(`Nitro client started with address: ${client.address}`); - - // Start subscription for payment vouchers received by the client - nitroPaymentsManager.subscribeToVouchers(client); + peer.subscribeTopic(pubSubTopic, (peerId, data) => { + p2pMessageHandler(peerId.toString(), data); + }); } -}; - -const setupNitro = async (config: Config, peer: Peer): Promise => { - // TODO: Use Nitro class from ts-nitro - const { - server: { - p2p: { - nitro - } - }, - upstream: { - ethServer: { - rpcProviderEndpoint - } - } - } = config; - - const signer = new utils.KeySigner(nitro.privateKey); - await signer.init(); - // TODO: Use serverCmd.peer private key for nitro-client? - const store = await DurableStore.newDurableStore(signer, path.resolve(nitro.store)); - const msgService = await P2PMessageService.newMessageService(store.getAddress(), peer); - - const chainService = await EthChainService.newEthChainService( - rpcProviderEndpoint, - nitro.chainPrivateKey, - nitroAdjudicatorAddress, - consensusAppAddress, - virtualPaymentAppAddress - ); - - return Node.new( - msgService, - chainService, - store, - undefined, - new PermissivePolicy() - ); + const typeDefs = fs.readFileSync(path.join(__dirname, 'schema.gql')).toString(); + await serverCmd.exec(createResolvers, typeDefs, nitroPaymentsManager); }; main().then(() => { diff --git a/yarn.lock b/yarn.lock index dad40f2..7153497 100644 --- a/yarn.lock +++ b/yarn.lock @@ -162,10 +162,10 @@ dependencies: xss "^1.0.8" -"@cerc-io/cache@^0.2.56": - version "0.2.56" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.56/cache-0.2.56.tgz#19a0d031b5e0635328be87be9e33c33ad1563900" - integrity sha512-jqCcsNkxBYn2Sin2VelXm5I5+QgRAAN9clSPN1QKNE3459iEhBrc2uNwRRzF2dX8Ko+iyPR3rUUenCdoKt6YOg== +"@cerc-io/cache@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcache/-/0.2.57/cache-0.2.57.tgz#7663d3684b3087678f38dd135f02fd7b0db3ceab" + integrity sha512-fHrsVXrpBy/AzUcwPXfU49OJ2kNj2ck2+QTWLydp2BynOo1jhF2XisraIGx9igRiAAU9ea4QsaVfwk4ibUPiVA== dependencies: canonical-json "^0.0.4" debug "^4.3.1" @@ -173,17 +173,19 @@ fs-extra "^10.0.0" level "^7.0.0" -"@cerc-io/cli@^0.2.56": - version "0.2.56" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.56/cli-0.2.56.tgz#f1f55805e7bca2dda2248ff280069792501718e7" - integrity sha512-8ScM43Y9Pg3pzutuXtr6q8pE6GGFyFYWFPVWJwvrPe5BUHetSgHbje8pyEQ/rZt015GBxa5ru+Qu23kRmqkX5Q== +"@cerc-io/cli@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fcli/-/0.2.57/cli-0.2.57.tgz#807bee7ec300132748aebfa781a1a36803f8b87c" + integrity sha512-SkEUCSBIDCZ+JB9tl0yNTKmWRWGA+VvPmZtWZzUNimhx6iedsGqgXhBAV+CCGBwQKm7r0u6x6gcCWM59//b1gw== dependencies: "@apollo/client" "^3.7.1" - "@cerc-io/cache" "^0.2.56" - "@cerc-io/ipld-eth-client" "^0.2.56" - "@cerc-io/peer" "^0.2.56" - "@cerc-io/rpc-eth-client" "^0.2.56" - "@cerc-io/util" "^0.2.56" + "@cerc-io/cache" "^0.2.57" + "@cerc-io/ipld-eth-client" "^0.2.57" + "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" + "@cerc-io/nitro-node" "^0.1.10" + "@cerc-io/peer" "^0.2.57" + "@cerc-io/rpc-eth-client" "^0.2.57" + "@cerc-io/util" "^0.2.57" "@ethersproject/providers" "^5.4.4" "@graphql-tools/utils" "^9.1.1" "@ipld/dag-cbor" "^8.0.0" @@ -199,13 +201,13 @@ typeorm "0.2.37" yargs "^17.0.1" -"@cerc-io/ipld-eth-client@^0.2.56": - version "0.2.56" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.56/ipld-eth-client-0.2.56.tgz#3f706b5aa6ff62d6034a4803f852e5bd715af081" - integrity sha512-Rr8/2Ierl69aB+bbjcmr3z7TpmbaKP+keuV4J0cegVcCudpKcomU2o3+q3Lo7A+TJRdZOlTqFYK5uyS/cdiaNQ== +"@cerc-io/ipld-eth-client@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fipld-eth-client/-/0.2.57/ipld-eth-client-0.2.57.tgz#c0f3913bd85ce43990783090bc27c767439c5a17" + integrity sha512-qyQoP43VFC5ug4WDGXL1jj92y5r+iHX8jKXLktAhNovhSH0TSKJaft7CkSMmgmv9zIdIa2/ca3VbT8JtRYXdSQ== dependencies: "@apollo/client" "^3.7.1" - "@cerc-io/cache" "^0.2.56" + "@cerc-io/cache" "^0.2.57" cross-fetch "^3.1.4" debug "^4.3.1" ethers "^5.4.4" @@ -215,7 +217,7 @@ ws "^8.11.0" zen-observable-ts "^1.1.0" -"@cerc-io/libp2p@0.42.2-laconic-0.1.4": +"@cerc-io/libp2p@0.42.2-laconic-0.1.4", "@cerc-io/libp2p@^0.42.2-laconic-0.1.4": version "0.42.2-laconic-0.1.4" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Flibp2p/-/0.42.2-laconic-0.1.4/libp2p-0.42.2-laconic-0.1.4.tgz#ac9347e70d6d3cee040ad02074cae3070b91a8fb" integrity sha512-gTC62YvkK3P7cWlaH8gQ6lDbqusNiaYI1q7y/+vQ/1s35uStwRn7fvXHC0aY9s36L4S3p1S0sxDzGXM8rtg6+w== @@ -287,7 +289,33 @@ wherearewe "^2.0.0" xsalsa20 "^1.1.0" -"@cerc-io/nitro-node@^0.1.8", "@cerc-io/nitro-node@^0.1.9": +"@cerc-io/nitro-node@^0.1.10": + version "0.1.10" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fnitro-node/-/0.1.10/nitro-node-0.1.10.tgz#6b37ca555e6ff4c111d68bf1cccc97c12c1905c8" + integrity sha512-kiP4ik5eCw/jM/+3ZOlXi7POMcabgJxup0AoOw2Gqz35lMfGL6QTzdAYU1lgDfq2zDOzKx0G3hcEnfIQ6lRMtA== + dependencies: + "@cerc-io/libp2p" "0.42.2-laconic-0.1.4" + "@cerc-io/nitro-protocol" "^2.0.0-alpha.4-ts-port-0.1.2" + "@cerc-io/nitro-util" "^0.1.10" + "@cerc-io/peer" "^0.2.56" + "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" + "@jpwilliams/waitgroup" "^2.1.0" + "@libp2p/crypto" "^1.0.4" + "@libp2p/tcp" "^6.0.0" + "@multiformats/multiaddr" "^11.1.4" + "@statechannels/exit-format" "^0.2.0" + assert "^2.0.0" + async-mutex "^0.4.0" + debug "^4.3.4" + ethers "^5.7.2" + heap "^0.2.7" + it-pipe "^2.0.5" + level "^8.0.0" + lodash "^4.17.21" + promjs "^0.4.2" + uint8arrays "^4.0.3" + +"@cerc-io/nitro-node@^0.1.8": version "0.1.9" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fnitro-node/-/0.1.9/nitro-node-0.1.9.tgz#bb46207825c2f1accb8c58f70746f61b381d918d" integrity sha512-tSh/pAY6q6qkR04Z/VFcDvt2/llGr1p4oNF7ZuXUWa1DP0Gxo83eUM2us+hJZzuay0S9eXhLQaPxtRvYeKmHTA== @@ -322,6 +350,21 @@ "@statechannels/exit-format" "^0.2.0" "@typechain/ethers-v5" "^9.0.0" +"@cerc-io/nitro-util@^0.1.10": + version "0.1.10" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fnitro-util/-/0.1.10/nitro-util-0.1.10.tgz#a185fe98ec12c9b7c67b7e882045bf358b803fc2" + integrity sha512-X7jRB8fp6EuUSb0HxReeHxYGWgUa7YgoDwpyHkTbWezlpkj8DmMs5hu/94b+oHmKZtxWxOEnhGfCPIc3soPhsg== + dependencies: + "@cerc-io/nitro-protocol" "^2.0.0-alpha.4-ts-port-0.1.2" + "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" + assert "^2.0.0" + debug "^4.3.4" + ethers "^5.7.2" + it-pipe "^3.0.1" + json-bigint "^1.0.0" + lodash "^4.17.21" + uint8arrays "^4.0.3" + "@cerc-io/nitro-util@^0.1.9": version "0.1.9" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fnitro-util/-/0.1.9/nitro-util-0.1.9.tgz#9c49b635a5b1e06a733fb737cff52bbfca2dcb8d" @@ -367,6 +410,35 @@ unique-names-generator "^4.7.1" yargs "^17.0.1" +"@cerc-io/peer@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fpeer/-/0.2.57/peer-0.2.57.tgz#b8add56683dcda363f013c513cb6c7e3f97b3802" + integrity sha512-kBAuqND3Y/pG1iiSqlZVKLS+VpI3K8dXgv4zKVDfUsNKt6XgNtPuVIY5o8Exm6qpm/hygJQyEGtO6/1sdytwMQ== + dependencies: + "@cerc-io/libp2p" "^0.42.2-laconic-0.1.4" + "@cerc-io/prometheus-metrics" "1.1.4" + "@chainsafe/libp2p-gossipsub" "^6.0.0" + "@chainsafe/libp2p-noise" "^11.0.0" + "@libp2p/floodsub" "^6.0.0" + "@libp2p/mplex" "^7.1.1" + "@libp2p/peer-id-factory" "^2.0.0" + "@libp2p/pubsub-peer-discovery" "^8.0.0" + "@libp2p/websockets" "^5.0.5" + "@multiformats/multiaddr" "^11.1.4" + assert "^2.0.0" + buffer "^6.0.3" + chai "^4.3.4" + debug "^4.3.1" + it-length-prefixed "^8.0.4" + it-map "^2.0.0" + it-pipe "^2.0.5" + it-pushable "^3.1.2" + mocha "^8.4.0" + p-event "^5.0.1" + uint8arrays "^4.0.3" + unique-names-generator "^4.7.1" + yargs "^17.0.1" + "@cerc-io/prometheus-metrics@1.1.4": version "1.1.4" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fprometheus-metrics/-/1.1.4/prometheus-metrics-1.1.4.tgz#51006b0b5bf6168394390c78072a1c0bb2b02f28" @@ -379,14 +451,14 @@ it-stream-types "^1.0.4" promjs "^0.4.2" -"@cerc-io/rpc-eth-client@^0.2.56": - version "0.2.56" - resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.56/rpc-eth-client-0.2.56.tgz#68a837e8fbf322aa3022849cb4daea12a55a63c4" - integrity sha512-LB88643LssG/+oD1DJquNccq5qJgbwwWm0wyLSSWvpxQV5CPDa7X2/a8wRI9POIfcirrf1G2ZklpZL4+zLaEyg== +"@cerc-io/rpc-eth-client@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Frpc-eth-client/-/0.2.57/rpc-eth-client-0.2.57.tgz#18cacf3374fef1bc2f3db5429dc47f28baff837c" + integrity sha512-wxp75GY1pmi96l3zFq/DNlfX3iR3otj2/wvwIPBAcQ1beOvy2B0loQPxr7alnh7K/bpuZ3h/T0bjP9avG5H6pA== dependencies: - "@cerc-io/cache" "^0.2.56" - "@cerc-io/ipld-eth-client" "^0.2.56" - "@cerc-io/util" "^0.2.56" + "@cerc-io/cache" "^0.2.57" + "@cerc-io/ipld-eth-client" "^0.2.57" + "@cerc-io/util" "^0.2.57" chai "^4.3.4" ethers "^5.4.4" left-pad "^1.3.0" @@ -399,6 +471,13 @@ dependencies: dotenv "^10.0.0" +"@cerc-io/solidity-mapper@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fsolidity-mapper/-/0.2.57/solidity-mapper-0.2.57.tgz#e383ccadf1f8474bac2c8aa6f1da0b32b1c9e73f" + integrity sha512-dKqY0Va0rBkUU7igKLEDomAu6eEG16Pko8oLAHVzuLYZPx1vp2iJhQQhl1lYf2kCjB9Ntik7izhZlLEUMlGQZQ== + dependencies: + dotenv "^10.0.0" + "@cerc-io/ts-channel@1.0.3-ts-nitro-0.1.1": version "1.0.3-ts-nitro-0.1.1" resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Fts-channel/-/1.0.3-ts-nitro-0.1.1/ts-channel-1.0.3-ts-nitro-0.1.1.tgz#0768781313a167295c0bf21307f47e02dc17e936" @@ -444,6 +523,55 @@ ws "^8.11.0" yargs "^17.0.1" +"@cerc-io/util@^0.2.57": + version "0.2.57" + resolved "https://git.vdb.to/api/packages/cerc-io/npm/%40cerc-io%2Futil/-/0.2.57/util-0.2.57.tgz#dd13fe820f02b91d34503ea9301679f7e098ea87" + integrity sha512-B7Voz1NCC4YumQtKohNSMdWShb+7p7RkpCueD1/eV4kSylgaCZADfAOQLNeQGpXTzs1bhQvWMsqt22DnWtJthg== + dependencies: + "@apollo/utils.keyvaluecache" "^1.0.1" + "@cerc-io/nitro-node" "^0.1.10" + "@cerc-io/peer" "^0.2.57" + "@cerc-io/solidity-mapper" "^0.2.57" + "@cerc-io/ts-channel" "1.0.3-ts-nitro-0.1.1" + "@ethersproject/providers" "^5.4.4" + "@graphql-tools/schema" "^9.0.10" + "@graphql-tools/utils" "^9.1.1" + "@ipld/dag-cbor" "^6.0.12" + "@libp2p/interface-connection" "^3.0.2" + "@libp2p/interface-peer-id" "^2.0.0" + "@libp2p/peer-id" "^2.0.0" + apollo-server-core "^3.11.1" + apollo-server-express "^3.11.1" + apollo-server-plugin-response-cache "^3.8.1" + bunyan "^1.8.15" + debug "^4.3.1" + decimal.js "^10.3.1" + ethers "^5.4.4" + express "^4.18.2" + express-queue "^0.0.13" + fs-extra "^10.0.0" + graphql "^15.5.0" + graphql-subscriptions "^2.0.0" + graphql-ws "^5.11.2" + ipfs-http-client "^56.0.3" + it-length-prefixed "^8.0.4" + it-pipe "^2.0.5" + it-pushable "^3.1.2" + js-yaml "^4.1.0" + json-bigint "^1.0.0" + lodash "^4.17.21" + lru-cache "^10.0.0" + mokka "^1.4.2" + multiformats "^9.4.8" + pg "^8.5.1" + pg-boss "^6.1.0" + prom-client "^14.0.1" + toml "^3.0.0" + typeorm "0.2.37" + typeorm-naming-strategies "^2.0.0" + ws "^8.11.0" + yargs "^17.0.1" + "@chainsafe/is-ip@^2.0.1": version "2.0.1" resolved "https://registry.yarnpkg.com/@chainsafe/is-ip/-/is-ip-2.0.1.tgz#62cb285669d91f88fd9fa285048dde3882f0993b" @@ -2500,7 +2628,7 @@ bn.js@^4.11.9: resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.2.1: +bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== @@ -2594,6 +2722,16 @@ buffer@^6.0.1, buffer@^6.0.3: base64-js "^1.3.1" ieee754 "^1.2.1" +bunyan@^1.8.15: + version "1.8.15" + resolved "https://registry.yarnpkg.com/bunyan/-/bunyan-1.8.15.tgz#8ce34ca908a17d0776576ca1b2f6cbd916e93b46" + integrity sha512-0tECWShh6wUysgucJcBAoYegf3JJoZWibxdqhTm7OHPeT42qdjkZ29QCMcKwbgU1kiH+auSIasNRXMLWXafXig== + optionalDependencies: + dtrace-provider "~0.8" + moment "^2.19.3" + mv "~2" + safe-json-stringify "~1" + busboy@^1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" @@ -3026,6 +3164,13 @@ dotenv@^8.2.0: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.6.0.tgz#061af664d19f7f4d8fc6e4ff9b584ce237adcb8b" integrity sha512-IrPdXQsk2BbzvCBGBOTmmSH5SodmqZNt4ERAZDmW4CT+tL8VtvinqywuANaFu4bOMWki16nqf0e4oC0QIaDr/g== +dtrace-provider@~0.8: + version "0.8.8" + resolved "https://registry.yarnpkg.com/dtrace-provider/-/dtrace-provider-0.8.8.tgz#2996d5490c37e1347be263b423ed7b297fb0d97e" + integrity sha512-b7Z7cNtHPhH9EJhNNbbeqTcXB8LGFFZhq1PGgEvpeHlzd36bhbdTWoE/Ba/YguqpBSlAPKnARWhVlhunCMwfxg== + dependencies: + nan "^2.14.0" + ee-first@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/ee-first/-/ee-first-1.1.1.tgz#590c61156b0ae2f4f0255732a158b266bc56b21d" @@ -3038,7 +3183,7 @@ electron-fetch@^1.7.2: dependencies: encoding "^0.1.13" -elliptic@6.5.4: +elliptic@6.5.4, elliptic@^6.5.4: version "6.5.4" resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.4.tgz#da37cebd31e79a1367e941b592ed1fbebd58abbb" integrity sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ== @@ -3716,6 +3861,17 @@ glob@7.1.6: once "^1.3.0" path-is-absolute "^1.0.0" +glob@^6.0.1: + version "6.0.4" + resolved "https://registry.yarnpkg.com/glob/-/glob-6.0.4.tgz#0f08860f6a155127b2fadd4f9ce24b1aab6e4d22" + integrity sha512-MKZeRNyYZAVVVG1oZeLaWie1uweH40m9AZwIwxyPbTSX4hHrVYSzLg0Ro5Z5R7XKkIX+Cc6oD1rqeDJnwsB8/A== + dependencies: + inflight "^1.0.4" + inherits "2" + minimatch "2 || 3" + once "^1.3.0" + path-is-absolute "^1.0.0" + glob@^7.0.5, glob@^7.1.3, glob@^7.1.6: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" @@ -4939,6 +5095,13 @@ minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg== +"minimatch@2 || 3", minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + minimatch@3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" @@ -4946,13 +5109,6 @@ minimatch@3.0.4: dependencies: brace-expansion "^1.1.7" -minimatch@^3.0.3, minimatch@^3.0.4, minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2: - version "3.1.2" - resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" - integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== - dependencies: - brace-expansion "^1.1.7" - minimist@^1.2.0, minimist@^1.2.6: version "1.2.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c" @@ -4963,6 +5119,13 @@ mkdirp@^1.0.4: resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-1.0.4.tgz#3eb5ed62622756d79a5f0e2a221dfebad75c2f7e" integrity sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw== +mkdirp@~0.5.1: + version "0.5.6" + resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.6.tgz#7def03d2432dcae4ba1d611445c48396062255f6" + integrity sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw== + dependencies: + minimist "^1.2.6" + mocha@^8.4.0: version "8.4.0" resolved "https://registry.yarnpkg.com/mocha/-/mocha-8.4.0.tgz#677be88bf15980a3cae03a73e10a0fc3997f0cff" @@ -4999,6 +5162,19 @@ module-error@^1.0.1, module-error@^1.0.2: resolved "https://registry.yarnpkg.com/module-error/-/module-error-1.0.2.tgz#8d1a48897ca883f47a45816d4fb3e3c6ba404d86" integrity sha512-0yuvsqSCv8LbaOKhnsQ/T5JhyFlCYLPXK3U2sgV10zoKQwzs/MyfuQUOZQ1V/6OCOJsK/TRgNVrPuPDqtdMFtA== +mokka@^1.4.2: + version "1.4.2" + resolved "https://registry.yarnpkg.com/mokka/-/mokka-1.4.2.tgz#b0d7117e216672ff2deda6ef2212bcfa0edb8114" + integrity sha512-Vgki/Fr9fqUMZzChGC1yH64AQg+qkMdZZe3xKrTwYBVGEuq8j2GdnDg8voYXwWl+MLfNzWBnNiejq2xZ8PmojA== + dependencies: + bn.js "^5.2.0" + elliptic "^6.5.4" + +moment@^2.19.3: + version "2.29.4" + resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + mortice@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/mortice/-/mortice-3.0.1.tgz#27c1943b1841502c7b27a9c8fea789f87c124515" @@ -5053,6 +5229,15 @@ multiformats@^9.0.2, multiformats@^9.4.2, multiformats@^9.4.5, multiformats@^9.4 resolved "https://registry.yarnpkg.com/multiformats/-/multiformats-9.9.0.tgz#c68354e7d21037a8f1f8833c8ccd68618e8f1d37" integrity sha512-HoMUjhH9T8DDBNT+6xzkrd9ga/XiBI4xLr58LJACwK6G3HTOPeMz4nB4KJs33L2BelrIJa7P0VuNaVF3hMYfjg== +mv@~2: + version "2.1.1" + resolved "https://registry.yarnpkg.com/mv/-/mv-2.1.1.tgz#ae6ce0d6f6d5e0a4f7d893798d03c1ea9559b6a2" + integrity sha512-at/ZndSy3xEGJ8i0ygALh8ru9qy7gWW1cmkaqBN29JmMlIvM//MEO9y1sk/avxuwnPcfhkejkLsuPxH81BrkSg== + dependencies: + mkdirp "~0.5.1" + ncp "~2.0.0" + rimraf "~2.4.0" + mz@^2.4.0: version "2.7.0" resolved "https://registry.yarnpkg.com/mz/-/mz-2.7.0.tgz#95008057a56cafadc2bc63dde7f9ff6955948e32" @@ -5062,6 +5247,11 @@ mz@^2.4.0: object-assign "^4.0.1" thenify-all "^1.0.0" +nan@^2.14.0: + version "2.18.0" + resolved "https://registry.yarnpkg.com/nan/-/nan-2.18.0.tgz#26a6faae7ffbeb293a39660e88a76b82e30b7554" + integrity sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w== + nanoid@3.1.20: version "3.1.20" resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.1.20.tgz#badc263c6b1dcf14b71efaa85f6ab4c1d6cfc788" @@ -5107,6 +5297,11 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== +ncp@~2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/ncp/-/ncp-2.0.0.tgz#195a21d6c46e361d2fb1281ba38b91e9df7bdbb3" + integrity sha512-zIdGUrPRFTUELUvr3Gmc7KZ2Sw/h1PiVM0Af/oHB6zgnV1ikqSfRk+TOufi79aHYCW3NiOXmr1BP5nWbzojLaA== + negotiator@0.6.3: version "0.6.3" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.3.tgz#58e323a72fedc0d6f9cd4d31fe49f51479590ccd" @@ -5815,6 +6010,13 @@ rimraf@^3.0.2: dependencies: glob "^7.1.3" +rimraf@~2.4.0: + version "2.4.5" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.4.5.tgz#ee710ce5d93a8fdb856fb5ea8ff0e2d75934b2da" + integrity sha512-J5xnxTyqaiw06JjMftq7L9ouA448dw/E7dKghkP9WpKNuwmARNNg+Gk8/u5ryb9N/Yo2+z3MCwuqFK/+qPOPfQ== + dependencies: + glob "^6.0.1" + run-parallel-limit@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/run-parallel-limit/-/run-parallel-limit-1.1.0.tgz#be80e936f5768623a38a963262d6bef8ff11e7ba" @@ -5839,6 +6041,11 @@ safe-buffer@~5.1.0, safe-buffer@~5.1.1: resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== +safe-json-stringify@~1: + version "1.2.0" + resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz#356e44bc98f1f93ce45df14bcd7c01cda86e0afd" + integrity sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg== + safe-regex-test@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/safe-regex-test/-/safe-regex-test-1.0.0.tgz#793b874d524eb3640d1873aad03596db2d4f2295"