Skip to content

Commit

Permalink
URSM Deployment Related Updates (#1307)
Browse files Browse the repository at this point in the history
* URSM Related Updates - per staging deployment
  • Loading branch information
hareeshnagaraj committed Mar 16, 2021
1 parent f461037 commit c981803
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
10 changes: 5 additions & 5 deletions contracts/migrations/4_user_replica_set_migration.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ module.exports = (deployer, network, accounts) => {
)
let userReplicaSetManagerProxyAddress = deployedProxyTx.address
console.log(`UserReplicaSetManager Proxy Contract deployed at ${deployedProxyTx.address}`)
// Register proxy contract against Registry
await registry.addContract(userReplicaSetManagerKey, userReplicaSetManagerProxyAddress)
// Confirm registered address matches proxy
let retrievedAddressFromRegistry = await registry.getContract(userReplicaSetManagerKey)
console.log(`Registered ${retrievedAddressFromRegistry} with key ${userReplicaSetManagerKeyString}/${userReplicaSetManagerKey}`)

// Confirm seed is not yet complete
let userReplicaSetManagerInst = await UserReplicaSetManager.at(deployedProxyTx.address)
Expand All @@ -97,10 +102,5 @@ module.exports = (deployer, network, accounts) => {
)
seedComplete = await userReplicaSetManagerInst.getSeedComplete({ from: userReplicaSetBootstrapAddress })
console.log(`Seed complete: ${seedComplete}`)
// Register proxy contract against Registry
await registry.addContract(userReplicaSetManagerKey, userReplicaSetManagerProxyAddress)
// Confirm registered address matches proxy
let retrievedAddressFromRegistry = await registry.getContract(userReplicaSetManagerKey)
console.log(`Registered ${retrievedAddressFromRegistry} with key ${userReplicaSetManagerKeyString}/${userReplicaSetManagerKey}`)
})
}
3 changes: 2 additions & 1 deletion contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"fs-extra": "^7.0.0",
"openzeppelin-solidity": "^2.1.0",
"@openzeppelin/upgrades": "2.8.0",
"truffle": "5.0.42"
"truffle": "5.0.42",
"truffle-hdwallet-provider": "^1.0.13"
},
"devDependencies": {
"@openzeppelin/test-helpers": "0.5.5",
Expand Down
13 changes: 11 additions & 2 deletions contracts/truffle-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require('babel-register')({
})

require('babel-polyfill')
const HDWalletProvider = require('truffle-hdwallet-provider');

module.exports = {
// See <http://truffleframework.com/docs/advanced/configuration>
Expand Down Expand Up @@ -46,8 +47,16 @@ module.exports = {
skipDryRun: true
},
poa_sokol: {
host: 'localhost',
port: 8545,
provider: function () {
return new HDWalletProvider(
[
// Private keys in array format here
],
"https://sokol.poa.network",
0,
2
)
},
network_id: '77',
gas: 8000000,
gasPrice: 1000000000,
Expand Down
10 changes: 5 additions & 5 deletions discovery-provider/src/tasks/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,15 @@ def fetch_tx_receipts(self, block_transactions):
# has been set in the L2 contract registry - if so, update the global contract_addresses object
# This change is to ensure no indexing restart is necessary when UserReplicaSetManager is
# added to the registry.
def update_user_replica_set_manager_address_if_necessary(self):
def update_ursm_address(self):
web3 = update_task.web3
shared_config = update_task.shared_config
abi_values = update_task.abi_values
user_replica_set_manager_address = contract_addresses["user_replica_set_manager"]
if user_replica_set_manager_address == zero_address:
logger.info(
f"index.py | update_ursm_address, found {user_replica_set_manager_address}"
)
registry_address = web3.toChecksumAddress(
shared_config["contracts"]["registry"]
)
Expand All @@ -162,9 +165,6 @@ def update_user_replica_set_manager_address_if_necessary(self):
if user_replica_set_manager_address != zero_address:
contract_addresses["user_replica_set_manager"] = web3.toChecksumAddress(user_replica_set_manager_address)
logger.info(f"index.py | Updated user_replica_set_manager_address={user_replica_set_manager_address}")
logger.info(
f"index.py | update_user_replica_set_manager_address_if_necessary, found {user_replica_set_manager_address}"
)

def index_blocks(self, db, blocks_list):
web3 = update_task.web3
Expand All @@ -173,6 +173,7 @@ def index_blocks(self, db, blocks_list):
num_blocks = len(blocks_list)
block_order_range = range(len(blocks_list) - 1, -1, -1)
for i in block_order_range:
update_ursm_address(self)
block = blocks_list[i]
block_index = num_blocks - i
block_number = block.number
Expand Down Expand Up @@ -585,7 +586,6 @@ def update_task(self):
if have_lock:
logger.info(f"index.py | {self.request.id} | update_task | Acquired disc_prov_lock")
initialize_blocks_table_if_necessary(db)
update_user_replica_set_manager_address_if_necessary(self)

latest_block = get_latest_block(db)

Expand Down

0 comments on commit c981803

Please sign in to comment.