Skip to content

Commit

Permalink
fixed staking script parsing pub_key error
Browse files Browse the repository at this point in the history
  • Loading branch information
AryaLanjewar3005 committed Feb 6, 2025
1 parent dae3db2 commit 9063339
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions src/setup/devnet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1372,14 +1372,23 @@ export class Devnet {
// return { ...account, pub_key: s.pub_key };
// })
this.config.accounts = this.signerDumpData
.slice(0, this.config.numOfBorValidators)
.map((s) => {
const account = getAccountFromPrivateKey(s.priv_key)
const sanitizedPubKey = s.pub_key.startsWith('0x04')
? '0x' + s.pub_key.slice(4)
: s.pub_key // Remove "04" prefix if present
return { ...account, pub_key: sanitizedPubKey }
})
.slice(0, this.config.numOfBorValidators)

Check failure on line 1375 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 10 spaces but found 2
.map((s) => {

Check failure on line 1376 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 10 spaces but found 2
const account = getAccountFromPrivateKey(s.priv_key)

Check failure on line 1377 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 12 spaces but found 4

// Extract key from the format 'PubKeySecp256k1{04...}'

Check failure on line 1379 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 12 spaces but found 4
const match = s.pub_key.match(/{(.*)}/)

Check failure on line 1380 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 12 spaces but found 4
let sanitizedPubKey = s.pub_key

Check failure on line 1381 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 12 spaces but found 4

if (match) {

Check failure on line 1383 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 12 spaces but found 4
const keyWithPrefix = match[1] // Extract the key inside braces

Check failure on line 1384 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 14 spaces but found 6
sanitizedPubKey = keyWithPrefix.startsWith('04')

Check failure on line 1385 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 14 spaces but found 6
? '0x' + keyWithPrefix.slice(2) // Remove '04' and add '0x'

Check failure on line 1386 in src/setup/devnet/index.js

View workflow job for this annotation

GitHub Actions / Prettier and Lint

Expected indentation of 16 spaces but found 8
: '0x' + keyWithPrefix
}

return { ...account, pub_key: sanitizedPubKey }
})

if (this.config.numOfErigonValidators > 0) {
const erigonAccounts = this.signerDumpData
Expand Down

0 comments on commit 9063339

Please sign in to comment.