Skip to content

Commit

Permalink
Merge pull request #250 from OriginTrail/fix/sharding-table-migration
Browse files Browse the repository at this point in the history
Fixed migration of the ShardingTableStorage in the deployment script
  • Loading branch information
u-hubar authored Apr 18, 2024
2 parents f0e94c1 + 1f34be5 commit ce3b55f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
8 changes: 6 additions & 2 deletions contracts/v2/ShardingTable.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,15 @@ contract ShardingTableV2 is Named, Versioned, ContractStatus, Initializable {

ShardingTableStructsV1.Node[] memory nodes = stsv1.getMultipleNodes(startingIdentityId, numberOfNodes);

for (uint i = 0; i < nodes.length; i++) {
if (!stsv2.nodeExists(nodes[i].identityId)) {
for (uint i; i < nodes.length; ) {
if (nodes[i].identityId != 0 && !stsv2.nodeExists(nodes[i].identityId)) {
uint256 nodeHashRingPosition = uint256(profileStorage.getNodeAddress(nodes[i].identityId, 1));
_insertNode(_binarySearchForIndex(nodeHashRingPosition), nodes[i].identityId, nodeHashRingPosition);
}

unchecked {
i++;
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion deploy/027_deploy_sharding_table_v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
console.log(
`Migration COMPLETED iteration: ${iteration} with starting identityId: ${identityId}, number of nodes in batch: ${numberOfNodesInBatch}, ShardingTableStorage: ${shardingTableStorageAddress}`,
);
iteration += 1;

identityId = nodes[iteration * numberOfNodesInBatch]?.identityId;
iteration += 1;
}

hre.helpers.setParametersEncodedData.push(['ShardingTable', encodedDataArray]);
Expand Down
32 changes: 16 additions & 16 deletions deployments/otp_devnet_contracts.json
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,13 @@
"version": "1.1.1"
},
"ShardingTable": {
"evmAddress": "0x89822851D2A5b5256Fd19fa3b52538CAaE1f0acb",
"substrateAddress": "5EMjsczojCiGD9qj1tN9JPu3Q1NZzBq9e4fQmCRHarD5agFZ",
"evmAddress": "0x92B7d406B7A7E85Ed2A52708Ea9b5310107abb20",
"substrateAddress": "5EMjsczqaEXFUVk3yEJEfSzYevmKxnKouhEehGjygJis2RGQ",
"version": "2.0.1",
"gitBranch": "release/4.2.6",
"gitCommitHash": "731dc92083f8c8e705050f9da8d8d9be649e7465",
"deploymentBlock": 4434349,
"deploymentTimestamp": 1713367726304,
"gitBranch": "fix/sharding-table-migration",
"gitCommitHash": "9c6aeb3ff3314be26cc75b10578a95cb594c7e54",
"deploymentBlock": 4439394,
"deploymentTimestamp": 1713430498176,
"deployed": true
},
"Staking": {
Expand Down Expand Up @@ -230,16 +230,6 @@
"deploymentTimestamp": 1713367652683,
"deployed": true
},
"ShardingTableStorage": {
"evmAddress": "0xe1B302A7cAC8241620ED0e901aA0f76529C31864",
"substrateAddress": "5EMjsd17Q8ApLnR56hxkhH6pDpBz4u83wZLk3sB4um7jutVC",
"version": "2.0.0",
"gitBranch": "release/4.2.6",
"gitCommitHash": "731dc92083f8c8e705050f9da8d8d9be649e7465",
"deploymentBlock": 4434345,
"deploymentTimestamp": 1713367674764,
"deployed": true
},
"NodeOperatorFeesStorage": {
"evmAddress": "0x74982203A596469c252E12dE91571d3A2a65Ac73",
"substrateAddress": "5EMjsczjY9RSBkFnCVKPrP2QvtyvKNKuCsSZ4W7S2AMVKPDr",
Expand All @@ -249,6 +239,16 @@
"deploymentBlock": 4434347,
"deploymentTimestamp": 1713367700400,
"deployed": true
},
"ShardingTableStorage": {
"evmAddress": "0x72837c4842601Ac4a2b30c50427Ef1798ffCDf57",
"substrateAddress": "5EMjsczj7xwtqtcMxW6csrBVKGbfdz1hqqxbgKB3QXa6sxiy",
"version": "2.0.0",
"gitBranch": "fix/sharding-table-migration",
"gitCommitHash": "9c6aeb3ff3314be26cc75b10578a95cb594c7e54",
"deploymentBlock": 4439392,
"deploymentTimestamp": 1713430472547,
"deployed": true
}
},
"deployedTimestamp": 1689863125519
Expand Down

0 comments on commit ce3b55f

Please sign in to comment.