From 5a1903ca80fac25a005e74ea216703f2dab9017e Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Tue, 10 Sep 2024 20:54:34 -0400 Subject: [PATCH 1/3] Fix for localnet syncing ports. --- node/harmony/node_syncing.go | 11 +++++++---- node/harmony/node_test.go | 10 +++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/node/harmony/node_syncing.go b/node/harmony/node_syncing.go index b1ee21ea7d..15f097e2ec 100644 --- a/node/harmony/node_syncing.go +++ b/node/harmony/node_syncing.go @@ -206,10 +206,13 @@ func (p *LocalSyncingPeerProvider) SyncingPeers(shardID uint32) (peers []p2p.Pee return nil, errors.Errorf( "shard ID %d out of range 0..%d", shardID, p.numShards-1) } - firstPort := uint32(p.basePort) + shardID - endPort := uint32(p.basePort) + p.numShards*p.shardSize - for port := firstPort; port < endPort; port += p.numShards { - if port == uint32(p.selfPort) { + shards := [][]string{ + {"6000", "6004", "6008", "6012", "6016", "6020", "6100", "6104", "6108", "6112", "6116", "6120"}, + {"6002", "6006", "6010", "6014", "6018", "6022", "6102", "6106", "6110", "6114", "6118", "6122"}, + } + selfport := fmt.Sprint(p.selfPort) + for _, port := range shards[shardID] { + if port == selfport { continue // do not sync from self } peers = append(peers, p2p.Peer{IP: "127.0.0.1", Port: fmt.Sprint(port)}) diff --git a/node/harmony/node_test.go b/node/harmony/node_test.go index d96a266241..f77353d49d 100644 --- a/node/harmony/node_test.go +++ b/node/harmony/node_test.go @@ -113,22 +113,22 @@ func TestLocalSyncingPeerProvider(t *testing.T) { p := makeLocalSyncingPeerProvider() expectedBeaconPeers := []p2p.Peer{ {IP: "127.0.0.1", Port: "6000"}, - {IP: "127.0.0.1", Port: "6002"}, {IP: "127.0.0.1", Port: "6004"}, + {IP: "127.0.0.1", Port: "6008"}, } if actualPeers, err := p.SyncingPeers(0); assert.NoError(t, err) { - assert.ElementsMatch(t, actualPeers, expectedBeaconPeers) + assert.ElementsMatch(t, actualPeers[:3], expectedBeaconPeers) } }) t.Run("Shard1Chain", func(t *testing.T) { p := makeLocalSyncingPeerProvider() expectedShard1Peers := []p2p.Peer{ // port 6001 omitted because self - {IP: "127.0.0.1", Port: "6003"}, - {IP: "127.0.0.1", Port: "6005"}, + {IP: "127.0.0.1", Port: "6002"}, + {IP: "127.0.0.1", Port: "6006"}, } if actualPeers, err := p.SyncingPeers(1); assert.NoError(t, err) { - assert.ElementsMatch(t, actualPeers, expectedShard1Peers) + assert.ElementsMatch(t, actualPeers[:2], expectedShard1Peers) } }) t.Run("InvalidShard", func(t *testing.T) { From a6baac508946451b8c7e6d5c7a4619b60a51f111 Mon Sep 17 00:00:00 2001 From: frozen <355847+Frozen@users.noreply.github.com> Date: Thu, 12 Sep 2024 11:05:46 -0400 Subject: [PATCH 2/3] Cleanup. --- test/deploy.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/deploy.sh b/test/deploy.sh index 0f3d3f56ad..daf48df802 100755 --- a/test/deploy.sh +++ b/test/deploy.sh @@ -198,3 +198,4 @@ setup launch_localnet sleep "${DURATION}" cleanup || true + From a7e8f069e13104614dee78ea210710d517b576f4 Mon Sep 17 00:00:00 2001 From: "Nita Neou (Soph)" Date: Fri, 13 Sep 2024 13:44:14 +0700 Subject: [PATCH 3/3] align external localnet ports with internal --- .../local-resharding-with-external.txt | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/test/configs/local-resharding-with-external.txt b/test/configs/local-resharding-with-external.txt index bb12da4c49..d146dd2678 100644 --- a/test/configs/local-resharding-with-external.txt +++ b/test/configs/local-resharding-with-external.txt @@ -1,37 +1,35 @@ # shard 0 # internal node 127.0.0.1 9000 validator .hmy/65f55eb3052f9e9f632b2923be594ba77c55543f5c58ee1454b9cfd658d25e06373b0f7d42a19c84768139ea294f6204.key -127.0.0.1 9002 validator .hmy/02c8ff0b88f313717bc3a627d2f8bb172ba3ad3bb9ba3ecb8eed4b7c878653d3d4faf769876c528b73f343967f74a917.key -127.0.0.1 9004 validator .hmy/e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09.key -127.0.0.1 9006 validator .hmy/2d61379e44a772e5757e27ee2b3874254f56073e6bd226eb8b160371cc3c18b8c4977bd3dcb71fd57dc62bf0e143fd08.key -127.0.0.1 9008 validator .hmy/86dc2fdc2ceec18f6923b99fd86a68405c132e1005cf1df72dca75db0adfaeb53d201d66af37916d61f079f34f21fb96.key -127.0.0.1 9010 validator .hmy/95117937cd8c09acd2dfae847d74041a67834ea88662a7cbed1e170350bc329e53db151e5a0ef3e712e35287ae954818.key -# external node -127.0.0.1 9014 external .hmy/extbls/4f41a37a3a8d0695dd6edcc58142c6b7d98e74da5c90e79b587b3b960b6a4f5e048e6d8b8a000d77a478d44cd640270c.key -127.0.0.1 9016 external .hmy/extbls/7dcc035a943e29e17959dabe636efad7303d2c6f273ace457ba9dcc2fd19d3f37e70ba1cd8d082cf8ff7be2f861db48c.key -127.0.0.1 9018 external .hmy/extbls/b0917378b179a519a5055259c4f8980cce37d58af300b00dd98b07076d3d9a3b16c4a55f84522f553872225a7b1efc0c.key +127.0.0.1 9004 validator .hmy/02c8ff0b88f313717bc3a627d2f8bb172ba3ad3bb9ba3ecb8eed4b7c878653d3d4faf769876c528b73f343967f74a917.key +127.0.0.1 9008 validator .hmy/e751ec995defe4931273aaebcb2cd14bf37e629c554a57d3f334c37881a34a6188a93e76113c55ef3481da23b7d7ab09.key +127.0.0.1 9012 validator .hmy/2d61379e44a772e5757e27ee2b3874254f56073e6bd226eb8b160371cc3c18b8c4977bd3dcb71fd57dc62bf0e143fd08.key +127.0.0.1 9016 validator .hmy/86dc2fdc2ceec18f6923b99fd86a68405c132e1005cf1df72dca75db0adfaeb53d201d66af37916d61f079f34f21fb96.key +127.0.0.1 9020 validator .hmy/95117937cd8c09acd2dfae847d74041a67834ea88662a7cbed1e170350bc329e53db151e5a0ef3e712e35287ae954818.key # fn node -127.0.0.1 9050 validator .hmy/52ecce5f64db21cbe374c9268188f5d2cdd5bec1a3112276a350349860e35fb81f8cfe447a311e0550d961cf25cb988d.key -127.0.0.1 9052 validator .hmy/678ec9670899bf6af85b877058bea4fc1301a5a3a376987e826e3ca150b80e3eaadffedad0fedfa111576fa76ded980c.key -# 127.0.0.1 9054 validator .hmy/16513c487a6bb76f37219f3c2927a4f281f9dd3fd6ed2e3a64e500de6545cf391dd973cc228d24f9bd01efe94912e714.key +127.0.0.1 9100 validator .hmy/52ecce5f64db21cbe374c9268188f5d2cdd5bec1a3112276a350349860e35fb81f8cfe447a311e0550d961cf25cb988d.key +127.0.0.1 9104 validator .hmy/678ec9670899bf6af85b877058bea4fc1301a5a3a376987e826e3ca150b80e3eaadffedad0fedfa111576fa76ded980c.key +# external node +127.0.0.1 9108 external .hmy/extbls/4f41a37a3a8d0695dd6edcc58142c6b7d98e74da5c90e79b587b3b960b6a4f5e048e6d8b8a000d77a478d44cd640270c.key +127.0.0.1 9112 external .hmy/extbls/7dcc035a943e29e17959dabe636efad7303d2c6f273ace457ba9dcc2fd19d3f37e70ba1cd8d082cf8ff7be2f861db48c.key +127.0.0.1 9116 external .hmy/extbls/b0917378b179a519a5055259c4f8980cce37d58af300b00dd98b07076d3d9a3b16c4a55f84522f553872225a7b1efc0c.key # explorer node -127.0.0.1 9098 explorer null 0 +127.0.0.1 9120 explorer null 0 # shard 1 # internal node -127.0.0.1 9100 validator .hmy/40379eed79ed82bebfb4310894fd33b6a3f8413a78dc4d43b98d0adc9ef69f3285df05eaab9f2ce5f7227f8cb920e809.key -127.0.0.1 9102 validator .hmy/ee2474f93cba9241562efc7475ac2721ab0899edf8f7f115a656c0c1f9ef8203add678064878d174bb478fa2e6630502.key -127.0.0.1 9104 validator .hmy/776f3b8704f4e1092a302a60e84f81e476c212d6f458092b696df420ea19ff84a6179e8e23d090b9297dc041600bc100.key -127.0.0.1 9106 validator .hmy/c4e4708b6cf2a2ceeb59981677e9821eebafc5cf483fb5364a28fa604cc0ce69beeed40f3f03815c9e196fdaec5f1097.key -127.0.0.1 9108 validator .hmy/49d15743b36334399f9985feb0753430a2b287b2d68b84495bbb15381854cbf01bca9d1d9f4c9c8f18509b2bfa6bd40f.key -127.0.0.1 9110 validator .hmy/68ae289d73332872ec8d04ac256ca0f5453c88ad392730c5741b6055bc3ec3d086ab03637713a29f459177aaa8340615.key +127.0.0.1 9002 validator .hmy/40379eed79ed82bebfb4310894fd33b6a3f8413a78dc4d43b98d0adc9ef69f3285df05eaab9f2ce5f7227f8cb920e809.key +127.0.0.1 9006 validator .hmy/ee2474f93cba9241562efc7475ac2721ab0899edf8f7f115a656c0c1f9ef8203add678064878d174bb478fa2e6630502.key +127.0.0.1 9010 validator .hmy/776f3b8704f4e1092a302a60e84f81e476c212d6f458092b696df420ea19ff84a6179e8e23d090b9297dc041600bc100.key +127.0.0.1 9014 validator .hmy/c4e4708b6cf2a2ceeb59981677e9821eebafc5cf483fb5364a28fa604cc0ce69beeed40f3f03815c9e196fdaec5f1097.key +127.0.0.1 9118 validator .hmy/49d15743b36334399f9985feb0753430a2b287b2d68b84495bbb15381854cbf01bca9d1d9f4c9c8f18509b2bfa6bd40f.key +127.0.0.1 9122 validator .hmy/68ae289d73332872ec8d04ac256ca0f5453c88ad392730c5741b6055bc3ec3d086ab03637713a29f459177aaa8340615.key +# fn node +127.0.0.1 9102 validator .hmy/a547a9bf6fdde4f4934cde21473748861a3cc0fe8bbb5e57225a29f483b05b72531f002f8187675743d819c955a86100.key +127.0.0.1 9106 validator .hmy/63f479f249c59f0486fda8caa2ffb247209489dae009dfde6144ff38c370230963d360dffd318cfb26c213320e89a512.key # external node -127.0.0.1 9114 external .hmy/extbls/5a18d4aa3e6aff4835f07588ae66be19684476d38799f63e54c6b5732fad1e86dce7458b1c295404fb54a0d61e50bb97.key -127.0.0.1 9116 external .hmy/extbls/81296eedba05047594385e3086e1dab52c9eb9e56f46d86f58447cccc20535d646120171961d74968d27a2ec0f8af285.key +127.0.0.1 9110 external .hmy/extbls/5a18d4aa3e6aff4835f07588ae66be19684476d38799f63e54c6b5732fad1e86dce7458b1c295404fb54a0d61e50bb97.key +127.0.0.1 9114 external .hmy/extbls/81296eedba05047594385e3086e1dab52c9eb9e56f46d86f58447cccc20535d646120171961d74968d27a2ec0f8af285.key 127.0.0.1 9118 external .hmy/extbls/89eab762e7364d6cf89f7a6c54da794f74eba2e29147992ac66adcef0f0654ef8a727710ee55ad8b532da0dd87811915.key -# fn node -127.0.0.1 9150 validator .hmy/a547a9bf6fdde4f4934cde21473748861a3cc0fe8bbb5e57225a29f483b05b72531f002f8187675743d819c955a86100.key -127.0.0.1 9152 validator .hmy/63f479f249c59f0486fda8caa2ffb247209489dae009dfde6144ff38c370230963d360dffd318cfb26c213320e89a512.key -# 127.0.0.1 9154 validator .hmy/576d3c48294e00d6be4a22b07b66a870ddee03052fe48a5abbd180222e5d5a1f8946a78d55b025de21635fd743bbad90.key # explorer node -127.0.0.1 9096 explorer null 1 +127.0.0.1 9122 explorer null 1