Skip to content

Commit d3c65c3

Browse files
authored
feat: add pre-loaded storage node assignment stream (#223)
* feat: add pre-loaded storage node assignment stream * 2nd attempt * docker-compose: rm restart thing * rm unused import
1 parent b56e16a commit d3c65c3

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

packages/docker-dev-chain-init/docker-compose.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ services:
3838
depends_on:
3939
- parity-node0
4040
- parity-sidechain-node0
41-
restart: on-failure # exits when successful
4241
environment:
4342
EE_URL: http://10.200.10.1
4443
CHAIN_URL: http://10.200.10.1:8545

packages/docker-dev-chain-init/index.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const {
55
Contract,
66
ContractFactory,
77
utils: {computeAddress, parseEther, formatEther, namehash, id, bigNumberify},
8+
constants: {MaxUint256},
89
Wallet,
910
providers: {JsonRpcProvider}
1011
} = require("ethers4")
@@ -270,6 +271,18 @@ async function deployStreamRegistries() {
270271
log(`granting role ${role} ensaddress ${ensa}`)
271272
const grantRoleTx = await streamRegistry.grantRole(role, ensa)
272273
await grantRoleTx.wait()
274+
275+
const storageNodePk = '0xaa7a3b3bb9b4a662e756e978ad8c6464412e7eef1b871f19e5120d4747bce966'
276+
const storageNodeWallet = new ethers.Wallet(storageNodePk, new ethers.providers.JsonRpcProvider(sidechainURL))
277+
const streamRegistry2 = streamRegistry.connect(storageNodeWallet)
278+
279+
log('Create storage node assignment stream')
280+
const storageNodeAssignmentPath = '/assignments'
281+
const storageNodeAssignmentsStreamId = '0xde1112f631486cfc759a50196853011528bc5fa0/assignments'
282+
const tx1 = await streamRegistry2.createStream(storageNodeAssignmentPath, JSON.stringify({ partitions: 1}), { gasLimit: 5999990 })
283+
await tx1.wait()
284+
const tx2 = await streamRegistry2.setPublicPermission(storageNodeAssignmentsStreamId, MaxUint256, MaxUint256, { gasLimit: 5999990 })
285+
await tx2.wait()
273286
}
274287

275288
async function smartContractInitialization() {

0 commit comments

Comments
 (0)