Skip to content

Commit

Permalink
Update dkg initiator
Browse files Browse the repository at this point in the history
  • Loading branch information
shanejearley committed Nov 9, 2023
1 parent 422e17b commit 363e33c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 21 deletions.
1 change: 1 addition & 0 deletions contracts/ethereum/keys/example.validators.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"0x728474D29c2F81eb17a669a7582A2C17f1042b57":[{"depositDataRoot":"0x4a71ca806314e6bbabe893c51316fc2d5afb068477b5558cf8193d9458a3ed6b","publicKey":"0x81a48f626b0d2d09c790c32325b067af7f557d991deab304c4a889604c2199231df5b9a332dcf280b5350013a8aa386c","operatorIds":[208,209,210,211],"shares":"0x818f430738d4f3ac28956138b23e3cc374744fa21c4a43a2ecb5271ba42ea2727b16d940ef25a88c67e150cf119457f80637ffd39f2125fbb6ef53d5ac25a62d67c3ecd88eb483545c2963a39ebe98be15fb87e5d572e5ff459b958fa1d89166b95a5fd5d8e6c319d5b2d1f3619e13cf5c3c6b8699987d53f7f32bb65a53034bf18d47426aad2c5196d3dc33636e7d8da3bc2fa88dc8455157428fa28116ac4539303adfbd5d099b83e7b3b18922cab84b7a75f8ad7a329cd34a35704b2388b8a0be4c9039e1327a2618d98bdf5b8d86df91d8a404832078d45be622d4586b1704852799468de26b914f00e129727850a7bd0854b3ed23185002751a1ecdc1aecf009b106779fac3af77ef887f6a5db0e873bdeec096546d1b6d366a8580a6c23423059e7b56c0b01d26e610953c17eec0269778a061321f559f4f75b045c38ce995396de833a19b1252d90b13beaa419b34afc340a3fea884e5d0b932664ada48649fd4c1d663317d9ee8fb900a96c4f2d31b94e89664cb4309d8dee8a7627f1e036a4b0c2ee00f03fcc839dac0cc90d61d0f74d3e5ebe03b3972c72b380b8d96f92505380e75789ec69180781d62b51c146afaba27fea3c9f8c0ad00542697ece9e318e008a622e09a4e4c9bd1fa62808c155880c8ed28d60997244e0b13784d69c2151b8ad8f5294b3b43cdb01c55695f1f29fc9563c2f7323400b4fb023ac944f5056b242f1c06e6d77f36f10d3167011f67a7c009892a3ec863e71250b100094206ba294fb36dddba0e4a6345e3c8229cbdcd3f3d99f90818a658d3773323df28294a3fd6efbb78066be60af0481146e6d37465955b351f1090327daddc0ee723e6b2658f3b61b3d5dd30dc294fdcfa624c24589405c985b8ac52b151c4b69773201bcc15ab6be0fec107aaf61e2e794a3bc93e843d0781abf1be02eb58362de67ba3835bc18ff4107c62546775ede71f51a745227186a0ad5e97b5c7a007af8684ba687e9a18eac7cdd5a9657818caff1832c45c51d4894a84c3ac8db580da06dc8c7e15652739faf8bc61e686d61fee695db3dcf80e019db6c1b7dab8533d204616506f587261be7141f7efca43b0466dd37bd1d493eb6eb309a563f347402a938e9ee470b4037296b42efdf8e0ec24e8ed706a0a0f9e03aeb3dd7f545cbad9498a4aa4c70ce77434c3cb09280dc3a187a76837bb58d3674d0b669b5b18bb1a0774914a653e0421259fbb7533bf666297abfefcf6de33c50aebc5064d5b30e73df9affbff05b8580e34482862f1820c64649f941fb1c06604728900b60fb6ba85159b628d62ffe50bf155ac888867bb591197886a38634ba976f1cc466ad6de64550d64fff2aa996cb619fa7198713ab84603160cb592d4ea995b4565b4797eee2e68e1b8ac35dc256f7abca2825a502ba1c8de2b062c92ac730717ae39eaaef3a54e9ddcc0f173b671e763a22b8ec8743c59c90290aa7ba3c8d1249adb64f2dd7de0ee2926bddc243063bf984937df3049e3552f13052affd752dcc312ab2a1ce6f3e4b96d20742b134da99c31a6b7064d0b4e42c434e9f2fb71bc63326ae23b4b589dc861089046efe1cd425060e001256c2416af547c87155c1b6dfba6205f293ee8668c51e8961dd89f3827d956f3976700831c1ea32addc3bc3179b26e10200b12d183bd5c7817d8ebee93a7d681edd72ef5ada86243b36635aea498b623a20681b6c7e370f83816614cd670fae6293760f28242829725427773dcc0ce190b1ab4cf18dde567cd497499552d1007b241b8db4a57a9d29833d0c461e4886b66404a3a9dd8187f847db62710d862f45857c246c4f4039d4e2d773e","signature":"0xb5ab3d7419e358f3d8843cdbe494f030119a541b9fe368b54e0db4e8ede075c548715be8f684cf5ae05abaf4f043ecfa02d9b71a9c664e41dcfb0242014a4a5bf4d14c2b7b6b7f0b9cb603a62e3d75c695b710ab1471f66eebf96c3c7a87d64e","withdrawalCredentials":"0x010000000000000000000000a33647f58bc8e8a8dfe9a1a74d8ab1b203252794"},{"depositDataRoot":"0x6fd73d63c31428a79f8d6ca0084d62ab3625eae31f60701af7318b82623bad54","publicKey":"0x8c819814e82e8d6c64224276667748634322568dedda44929adf6a84373be5519eda597419f25395c77557b8ded57611","operatorIds":[208,209,210,211],"shares":"0xa4b2394e243c847130b5d3877b79a48c964df45b7ca080f52d3fefad4b19a02ce5d95c33c6b4d58638a87d4e1735e351159750f441150af687460d1c6826bef702f4c0f25fd8fbe5348c3f2a9a815c2d1d97d606431c100661db0b271b17aec49293ca50f1ba385b1cfe9b4804b17b2ba63cc023f98ca030ceb5d05f7e5c221db2ab62c92d12aba120ec6e9ff95ec2bc96c02e66fb11edd10ce1fc83b48b7daa610efbe20b2a6f50c03e6335a16c3e9cda9a0c81e0424331697d3b21ed58b886aabaf0d43ba3edf351e23714e82ef6e8c0034d023b8828298f43505120f35f315e81cf5dc1f804bcd440589067b265ff8561830f957c2e8ab0006f7c734bec25e0f3510bd776e4a06d917e00e727b1b505273ccbfc6bc540c76f2376bab45e49b213210f9cbf99e77d4b5983df11cc0756891606c5cc9a8f7ffb722dc80fb4b3e4f79a130b60fb2791f450478375263fc13a2ce0c12cdfe62a46b6a0268e013200f45f7073745d1ad8767d91061e98bfbc607640f1a72929452b0201bf6b2a9a7fd61f1b32fc3b20f2e5603154e4eb7d93aa8879b364ec4b33c43aef53c740e62015424fb7d72fe3f2c6227ff2b6d8b7cbed0299564430684275d602f226792b980c894666be205c963d7e48a7c17d87e1dccb559e5118ef4a227da325a1364e1136d432610799e90fbc002caca86551570fe89f6b818a13168cfc327825700163feac6379608df533ea862f5ea09a2261d8c920f04d2afaf543a13e41c997844601ebc7e53e1681325fa40ecdb9c2d11438c2af6191334c55f8840f4cb3494d683d43941b6e6d0bce7d17ec3f050decc8ae6b019e73844a09657deeeb0b508775ac3b91d05be3b9e16ecf4f8a6a2514a4b2b49b454116de632d8946d158035b7e7f913ab1084906f41697a968ec3b04b333906ad5ae74a528cd80a511f3ec33750eddf279ca57d632d6958e8245eb1a610778587831120167895880befb0583a850342575d8eb69b328ee60fcb4e893870b2711168546573c846ac3faeff98f12cb51b19946a088eb9ce1ae98453378a6f52cbfbbf7ed87c93a53cb4e57975c3bd4a09f5a541ed900c74c8f713db6ad15196334dbc2bab15d6071a48821d5e12a85aa78b6019a31da2d065f1f36a43ece4ad8ccb0ee662c412ddc95970cda217834ce680d8a85130a47cd357c9a67f6122caa643625f8702cb79f4cf48bc27fd43efd1ab51b3469550cbecf4707078fec8379e7e19a6e5d53e7a4a237a6e36ac6fabf447919dc4c3181ddd1c47efd12ce574cbe8faf30af17fa5188e16bdcd7b9b6b6c9beae9e7bdd9d0b851e5b51cab3cd328fbede511b2c7c55b4fd1b027a810a8d5acf293d54e55c20d27bba824f4a3f33172e3d4fde780f00713b3669b2987e441af35734cf650122ed958349c8147a7158a5d4982b90d0b49afaad291721dac036b7f018136fd3c756d36a1024aa6972f9aa3343a38cfefb940afefc545d22e25ef452ab72b98f3a85d7c3673316dc391961d8e09a2505ab821fc98f72253d794751eeaa839c3f79239c194282638912cdced029c38aea28aaf932853d4cacc8909a251b9810b3dec73d2ee59b649f5cc9acf5a089dbf10fc197cdf328a5ba8008b63b5910f67ea92d300df15d9e83f837822ba5534062fe4ba26c92e8f9da3554fe43ad636c330d0b15d09d5c36bf0acf76a8be849c74d7eae6e088cf52d5222b36e7f54339c51230e8833f28048f16439ca117e79f84e801e502cc82a9ce689ac8caab56cb1081b4c58e356eabae2290582a77a4ea28f340e25d14376c9c6db3024a6bd16540687b1be0de6fcebfb25e2f18b0ec05a8fd1424a762ba","signature":"0xb05999c2fc3334b7cce049850567241b0311ab383b472923a90548cd40826f157ca895fe08759cfe1fa5bf325051f51a04cee69f05fc9400471f037b363e0f659b60647e3ffaa7dcd9d7be6a0b0083daf70ad62727f5e3e7e1e3227f74f44509","withdrawalCredentials":"0x010000000000000000000000b727bf88901079756017b7f24b8f0edf22253f92"},{"depositDataRoot":"0x9d6817f31638c456f695cc3b0e1011db5927d216040a046b0dcaa30eac8c1552","publicKey":"0x9566f0410dfb562a70a29ab48637bc33e4572699b31c9f6ee72bb0e28f4348810b75c618cfd277ef2722146d99ffa976","operatorIds":[208,209,210,211],"shares":"0xb95899b16a140dce0b1e531cd049e9ea0373b600ff7da84f9f9bce1719a05c6e740cbce06f9a9677bd34eea4f11c41840d400ee68c1e62131ba52dd4a9a0073eff656851020ea6b396692e2bc659c1a0404e67a7344d9329c0e5bff0fd0fce5fa01e52fa458e6a746082ffd14dab44c0fe21151931ce2efdf4c4e539e6bcf8adf47dcff820fd8c01ac9f6edc4e1661c1949620f9658e6b6efcd53daeab692d789d9a475b205b3d7b5d1ea6a7ae6b6dbd53db0e8fc916c07ec00bca602251c25e8c8eab9df99b659f9163e2429f1dfc898841f9cd9944756a420eab57c99bc4dfd9e3636705715bcee8cc5ce51119d85d988acb0fbaf8fc5229edd0083b1b1522363664fd415115c71706d4ce5e5e0673a3d31140eaec85d9d0170599da4107a94c99980d0371274077960b58f1088235787843740a702cb3cf487cc6e6f2aa3fc78738648f18d079c1b3ea713e104488eec66fa31e7c78bd3ba11e801a2e71b5cd33c97389c2b51533fa7925c90ea5cb2eaa73fae16d5ba98a7ef320e8edf1494b51f44ea8f9e5c27e8568475565b66b1ccde58f353821571976992e38a646b08e31c5532641733ec23e33c31b28ea33eabb509d70e3e5bfbe305b63a50ddc7dd3b2b10d3cc030f3dcf8894da0fa519f464bfa969fd6cfb83b8fe6769e99e7b746e37eaf467f19fdcabedb9e7762e77385895da65e93d4eb0522c03416d9a005622d99f42c3a03ba9c0eda7734d98db33a5a4af380733698af1a38c4cd0c1da10e6735f5ee6ddeaf24f4587be688fffe3a71f765e84652a79e275ae6ba2f28447666ec105269cedde17b05c8cfc55d9a12d501f754a276846109484e15e419688d4c5bf8c1974da33988a0025205b57db0de0186107b34de44ff0d47af3967df6e29959e3137873895094ca7c99571cf3a06f58be6a5b8e3771c6e011508b96413712817fef6202896b9376e6ee9824f6b540081ddbf1313286384e8fea737777bf6d2bc4b99d6049d7c0dd2f951e794c54148a2ed4d238e7015090e464ef18509ab3ace6d4805c20dc96bc745693d170fe307443e98f9f59db5b84865696f40aba029a01d5ad28f1d11bcee97fd11d9636340bf5c3b2e9bcbac56dc0d28a721de6c506b7628a8dd4c13078f9f8e61df12ffbdd8f70d5cc46384901c9dd8afe2296f23f149df2ef65912c1600b1269e2ca64090bb708e837c3d58641209c54344e681ca1079cc91658ce34de6ab50a934ebfd868a760350f02d880871f941e368981ef22e72cece561b1fe8f836391dce3bfb4010ea3b81e47a92da4d7df3f34d70a3bcb6acba971e597d8f7ebb523e239edcc116070b7a5f80a99cfea8707b4ccfad1104264835cb4133b4925d1da9ede38adf4ea6ec17c8ed4feaed2b9aec310b3c118c98f40340890bd92a87851f1264a87e377f73ac97c2df7fca6d92c3aba993339f6f78b28f80392bd830b34636c196e3674acb292045ae35d23f92354de7c5c9230741894bc8b0eec5e6c6f836cead04aad63ae70ce40e12e5d3d23055a5d532f6e852c5a17c697730cdb5e646b22b4b3295cd7db19edd94154ba6095cfe8f78a398016533ab8564ae66528f63d52af3829d77fcae1b813125fdfd0c01c01825b648c154969b6fa5e75e5398442033593a3ada6b4dec35f889d2492da2a166c74ecc7b95b03c603b36387056a169bff03aceeac50422d0963d5e3638d647a894035d9ba349141b24a29e86d33c08613cb90586d51cc4cdc5118dd4081e9987b7bf567829ed2a3d2192bce4117fc5b0842cf002f014ed8d3401a70244ffaf4a8745f69c8a133d3ff727f3085c5cd820db72ac2601db9e525b62d76c569","signature":"0xb89f4a22af934afc4a7ac2ff5d577d4000ea6b5fa1cba12481a987003962a8e0f54532b6e62c2cef6ab6751e55ab8b921314f2596d4c5dbf0135ef6927df8e5c3b1ca0601233f360c650cf1e9132a152e08a997b83553a5f736fa236b4dfebf3","withdrawalCredentials":"0x0100000000000000000000003991aec452c91110abf173631575862b1ed3d417"},{"depositDataRoot":"0xb46322e4d80a14d0df4969b9c7d9130208d0580bd8a1bd950122d3766c00e683","publicKey":"0x978df211d4c4b9712fb39e85fbb481ec765d492aec05d5c6ca9ee3fca9d80c1670d6e7ba2455bebd6e0629b0882ac8e3","operatorIds":[208,209,210,211],"shares":"0xb4a77ad35cdfe462922db9f0ff74862d939603b7a68ac3a0e2d6411b2539fe4bec83ac32446690c0c9d885134f6149131923681b5053d5facdfbf6601f837ae5c5f0dd398a10d7e62f8fb8c5e0f5493bc62892f0695c439354fecb67dc4f8263b83d68237ddb4ecdb1c8e603e5abd9f97ab9f1c52222bbbff9eb9874af60f9825bc6317e34a0b300f22c2520d0d569d2b3058f074af1a3c008c54d8dbc49beccca68b129b270aa4a4f1cc4abac26a1f549e34c6daddb4bd955aa08a8019a2cc0961fd8f2cee1bb0af110a3e07f8b2f6d48d962f1a1a4a94fbda69ad2a183a6f3821dd5b0765305f89d402bacf1ecdb6189a997974f4de0933df22e5db17816102fc540c3fc0866c21e474b79a9efc1a078bee074b1cf8b94aa7e43397130531a7bfb2ae865af3d0dc955ab6a46c05863f66c3db000003164cfc38ebe5173104c08c164b9624a00cbdf4d9e502b8256c3dac12447fa12e6fa27a9d2481456bdc8c872373a72e379310259937b376c51c212e3a75a239462cd6631b4f18fc7f9990ea54cfd6726a954310864d4cb6d7b517bead299e863e41c9433bcc11250b14a416ae334a1db1eeef5355c666f0f57f8abd31b8794859476d6280c5332cbdf5a07f409d4acd5b28f0c609d27d32e443c3eeb3e8a72d03b083d53e3d4463ca2135312746ca76bee3e216f0c9b9b7d981b36285d214bb746c5bc0437dcd61521502340a73da409d50b5afe2040eb35c37e6dc9f7a1df128663758b3607008dfd928a0800239879057f0596c0a7e6fc58c44bf7737edaae938cb23a1ce4a06c0677ed60b2c1e6e581445498b6208797ecc970c20f3349635a8793a48c3037b3f846909b28372dac78032f6d6814d46d9c2b46c9fb34dcb34eafffbd61f5883fb57d124cada0155716b731836f2945663cf2b7ede8447a3a15f14a92548e293b7d503f93d6f0490430de3986ce31c3f0dd0955e46f0c45343ae1fa75d68e1a4ac0e380b67b8bf819161d3e68b5e86019c5d4068c7a1746ef9dc453fd854385d22293b3fa5fb87793dfd73183a6df62765d2bf5b02147535635298a10a2c28f49c7c67a1d5fc04ffabd44e5b38f82a17ceb0cb9b8e0908f08e4c18ea03f179b049cd19631db9a7417b579d8eaf5ca065b09df8404014ef7a0d3ef74c0a910062d9675eaec3c2b4e2a5604a650c0ff8c39dabefe7f390241801e2f1efecb7806a10f3ead4877c9941ba83103833f43e921df662f2b4392e6395b5bb35a5ff1c69a6ecd6f7fbe8d9e22a373146faa444caefb8d01006582c9692348397bf4944c7d27319833b0ff5f52c5bbc6c1fe9bcd2150251b625058813475df1f971ec5d2b27ac94b39e5e5f7d329bdbe84b4cb5c22c59126f9af7e30589581ad2ddf288f2eb1c71d73518986238c850f0dc6b2614d5d8db15c63240dda01a965d065a41d60faa1a45095e9a73f8d4202ce49b9aa92f3de875a49f7f82ac67ac3b503fcc33dde6d0356c039c030a1ac214451b8fe0d222e6ccdbcf52bce773212c9833939310645317d604a4312ae69a3fc4d62c33647d12534de0615e29d2abae2fb7752a145f608390efbd30fc56e7664b09fe4758927bef7375b9a98cd66a7adb50791b9580037ffaef2599010bd062baa51519f454e388020502ad62d1f0d0ebfcd2e1a9ad7252da89e100183d5f1727d237ddacf618c2690296ed8a2d942172cfa86dce1d4501a4ae70d580df1a0eb69d4a6439835d06c9906afd343c128994006d79cc828df9a821bb11831a7ccda9f896cef76584e69fa785d48bd52f43ada32f76effc48b2dd8fa031d77ddd3646953ffdf4553cd4f89e3a455731d076c1c16d659f9c6","signature":"0x9203cb2abd860e13140515048432f82328383c43107793c689fa3f9308506ad93e13e365385f6902087bf347aa8d73a7193715283355939cb582d27c56dd778e84c1c6b0fdb8f70d84f7a74e84c30e3569c1110d8c01f688eb8a0a94e2912e81","withdrawalCredentials":"0x010000000000000000000000e4ef9fdd63657388224c8968653efaa543de7b59"}]}
8 changes: 3 additions & 5 deletions services/oracle/config/example.dkg.initiator.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
fork: 'prater'
depositOutputPath: ./data
initiatorPrivKey: ./keys/example.encrypted.initiator.json
initiatorPrivKeyPassword: ./keys/example.password.initiator.txt
keysharesOutputPath: ./data
network: 'prater'
privKey: ./keys/example.encrypted.initiator.json
privKeyPassword: ./keys/example.password.initiator.txt
54 changes: 38 additions & 16 deletions services/oracle/src/providers/dkg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,40 @@ export class Dkg {
async init(input: InitInput, retries: number | undefined = 25): Promise<Validator> {
try {
const operatorsInfo = await Promise.all(input.operatorIds.map(async (operatorId) => {
const response = await fetch(`https://api.ssv.network/v4/prater/operators/${operatorId}`)
const response = await fetch(`https://api.ssv.network/api/v4/prater/operators/${operatorId}`)
const { public_key, dkg_address: ip } = await response.json() as SSVOperator
return { id: operatorId, public_key, ip }
}))


const outputDir = "./data"

const operatorsInfoPath = `${outputDir}/operators.json`
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir)
fs.writeFileSync(operatorsInfoPath, JSON.stringify(operatorsInfo))

const ceremonyOutputPath = `${outputDir}/ceremony-${Date.now()}`
if (!fs.existsSync(ceremonyOutputPath)) fs.mkdirSync(ceremonyOutputPath)

const flags = [
`--configPath ${this.configPath}`,
`--operatorIDs ${input.operatorIds.join(",")}`,
`--operatorsInfo ${JSON.stringify(operatorsInfo)}`,
`--operatorsInfoPath ${operatorsInfoPath}`,
`--outputPath ${ceremonyOutputPath}`,
`--owner ${input.ownerAddress}`,
`--nonce ${input.ownerNonce}`,
`--withdrawAddress ${input.withdrawalAddress.split("0x")[1]}`
`--withdrawAddress ${input.withdrawalAddress}`
]

const command = `${this.cliPath} init ${flags.join(" ")}`
const response = await run(`${command}`) as string

const depositFileLine = response.split("Writing deposit data json to file")[1]
const depositFilePath = depositFileLine.split("{\"path\": \"")[1].split("\"}")[0]
await run(`${command}`)
const depositFileName = fs.readdirSync(ceremonyOutputPath).find((file) => file.startsWith("deposit-"))
const depositFilePath = `${ceremonyOutputPath}/${depositFileName}`
const [deposit] = JSON.parse(fs.readFileSync(depositFilePath, "utf8"))
const { deposit_data_root, pubkey, signature, withdrawal_credentials } = deposit

const keysharesFileLine = response.split("Writing keyshares payload to file")[1]
const keysharesFilePath = keysharesFileLine.split("{\"path\": \"")[1].split("\"}")[0]
const keysharesFileName = fs.readdirSync(ceremonyOutputPath).find((file) => file.startsWith("keyshares-"))
const keysharesFilePath = `${ceremonyOutputPath}/${keysharesFileName}`
const { payload } = JSON.parse(fs.readFileSync(`${keysharesFilePath}`, "utf8"))
const shares = payload.sharesData

Expand All @@ -62,8 +72,9 @@ export class Dkg {
if (retries === 0) {
throw error
}
await new Promise(resolve => setTimeout(resolve, 2500))
console.log(error)
console.log(`Retrying init ${retries} more times`)
await new Promise(resolve => setTimeout(resolve, 2500))
return await this.init(input, retries - 1)
}
}
Expand All @@ -82,18 +93,28 @@ export class Dkg {
return { id: operatorId, public_key, ip }
}))

const outputDir = "./data"

const operatorsInfoPath = `${outputDir}/operators.json`
if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir)
fs.writeFileSync(operatorsInfoPath, JSON.stringify(operatorsInfo))

const ceremonyOutputPath = `${outputDir}/ceremony-${Date.now()}`
if (!fs.existsSync(ceremonyOutputPath)) fs.mkdirSync(ceremonyOutputPath)

const flags = [
`--configPath ${this.configPath}`,
`--oldOperatorIDs ${input.oldOperatorIds.join(",")}`,
`--operatorIDs ${input.operatorIds.join(",")}`,
`--operatorsInfo ${JSON.stringify(operatorsInfo)}`
`--operatorsInfo ${JSON.stringify(operatorsInfo)}`,
`--outputPath ${ceremonyOutputPath}`
]

const command = `${this.cliPath} reshare ${flags.join(" ")}`
const response = await run(`${command}`) as string
await run(`${command}`)

const keysharesFileLine = response.split("Writing keyshares payload to file")[1]
const keysharesFilePath = keysharesFileLine.split("{\"path\": \"")[1].split("\"}")[0]
const keysharesFileName = fs.readdirSync(ceremonyOutputPath).find((file) => file.startsWith("keyshares-"))
const keysharesFilePath = `${ceremonyOutputPath}/${keysharesFileName}`
const { payload } = JSON.parse(fs.readFileSync(`${keysharesFilePath}`, "utf8"))
const shares = payload.sharesData

Expand All @@ -108,8 +129,9 @@ export class Dkg {
if (retries === 0) {
throw error
}
await new Promise(resolve => setTimeout(resolve, 2500))
console.log(error)
console.log(`Retrying reshare ${retries} more times`)
await new Promise(resolve => setTimeout(resolve, 2500))
return await this.reshare(input, retries - 1)
}
}
Expand Down

0 comments on commit 363e33c

Please sign in to comment.