Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed staking script parsing pub_key error #275

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
// 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
Loading