Skip to content
This repository has been archived by the owner on May 22, 2023. It is now read-only.

Commit

Permalink
Merge pull request #517 from keep-network/repair-lcl-initialize-script
Browse files Browse the repository at this point in the history
Repair lcl-initialize script

The sortition pool creation logic in lcl-initialize.js script, didn't consider a case when getSortitionPool 
method returned a zero address. 

It is a workaround for ethereum/go-ethereum#21083 - instead of failing,
contract call returns address 0x0. Once we are able to update to the most recent abigen 
see keep-network/keep-common#45), the additional case for 0x0 address 
should be removed.
  • Loading branch information
pdyraga authored Aug 6, 2020
2 parents 9efaf8f + c722eb0 commit 577eec7
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion solidity/scripts/lcl-initialize.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,22 @@ module.exports = async function () {
application
)
} catch (err) {
console.error("failed to get sortition pool", err, "; creating a new one")
console.error("failed to get sortition pool", err)
}

// FIXME: Workaround for https://github.com/ethereum/go-ethereum/pull/21083 - instead of failing,
// contract call returns address 0x0. Once we are able to update to the most recent abigen
// (see https://github.com/keep-network/keep-common/issues/45), the additional case for 0x0 address
// should be removed.
if (
!sortitionPoolAddress ||
sortitionPoolAddress === "0x0000000000000000000000000000000000000000"
) {
try {
console.error(
`no sortition pool for application: [${application}]; creating a new one`
)

await bondedECDSAKeepFactory.createSortitionPool(application)

console.log(`created sortition pool for application: [${application}]`)
Expand Down

0 comments on commit 577eec7

Please sign in to comment.