Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose subxt onclineclient / rpc #125

Merged
merged 13 commits into from
Oct 24, 2023
Merged

Expose subxt onclineclient / rpc #125

merged 13 commits into from
Oct 24, 2023

Conversation

pgherveou
Copy link
Contributor

just wanted to throw a quick implementation that exposes the OnclineClient on the node.
This would make the sdk super useful to enable cross chain e2e tests in ink!

@github-actions
Copy link

Coverage after merging pg/node_client into main

77.26%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
crates/configuration/src
   global_settings.rs98.46%100%93.33%99.13%
   hrmp_channel.rs95.88%100%89.47%97.44%
   network.rs99.22%100%97.78%99.36%117, 122, 130, 175, 80, 88
   parachain.rs97.59%100%95.19%97.85%51–53, 551–560, 67–70
   relaychain.rs96.60%100%92.65%97.09%338–347, 77–79
   utils.rs40%100%40%40%11–13, 15–17, 19–21
crates/configuration/src/shared
   errors.rs50%100%50%50%
   helpers.rs100%100%100%100%
   node.rs98.32%100%92.68%98.93%124, 130
   resources.rs96.09%100%94.52%96.43%102, 114, 126–128, 147–150
   types.rs90.40%100%84.16%92.22%279–281, 350–352, 378–379, 381–383, 60–62
crates/orchestrator/src
   errors.rs0%100%0%0%8
   lib.rs0%100%0%0%100–103, 105–108, 112–115, 117–123, 125, 129, 131–146, 150–173, 177–186, 189, 192–196, 198, 200–204, 207–225, 227–232, 234–255, 259–261, 264, 267–272, 274–277, 280–284, 287, 289–302, 304–306, 309–313, 315, 317–330, 332–335, 337–339, 343–345, 347–371, 379, 383–384, 394, 401–403, 405–414, 416–417, 419–427, 429–436, 438–439, 44, 440–445, 447–449, 45, 450–458, 46, 461, 47–49, 51–56, 58–64, 66–69, 75, 77–92, 98–99
   network.rs0%100%0%0%100–108, 111–117, 119–127, 130–155, 157–168, 171, 173–177, 185–188, 190, 192, 194–196, 199–204, 206–208, 210–212, 214–216, 218–220, 222–224, 226–228, 230–232, 32–40, 43, 56–70, 77–82, 85–94, 96, 98–99
   network_spec.rs93.67%100%83.33%95.52%11, 38
   spawner.rs0%100%0%0%100–109, 111, 115–117, 120–122, 124, 130–150, 152, 154–164, 166–171, 173–175, 177–186, 188–193, 195–199, 20, 201–204, 43–56, 58–59, 61, 63–66, 70–71, 73, 76–96, 98–99
crates/orchestrator/src/generators
   bootnode_addr.rs97.20%100%100%96.84%
   chain_spec.rs3.24%100%5%3.08%100–111, 113–128, 130, 135–148, 151–157, 159–161, 164–192, 194–197, 199–201, 203–216, 218–219, 22, 220, 223–225, 227, 229–241, 243, 246–251, 253–254, 256–269, 271, 274–279, 281–282, 285–298, 300–305, 307–309, 311–313, 316–321, 323–352, 355, 358–361, 364, 366–367, 369–379, 38, 380–384, 386, 388–389, 392–397, 405–443, 454–459, 46, 460–462, 472–480, 482–494, 496–504, 507–509, 513–516, 518–519, 524–535, 539–552, 554, 557–558, 561–567, 569–574, 580–585, 587, 589, 591–598, 600–603, 606–607, 611–612, 614, 616–617, 619–623, 625–628, 630, 632–633, 635–636, 638–640, 642–644, 646–648, 651–653, 656–660, 662, 664–672, 674–675, 680–687, 689–699, 703–706, 708, 710, 712–717, 719–729, 731–746, 748–749, 75, 750–755, 757, 76, 761–769, 77, 770–781, 783, 792–802, 804, 806–823, 825–829, 831, 833, 84–87, 95–99
   command.rs0%100%0%0%100–112, 114–120, 122, 125–130, 132–133, 136–148, 15, 150, 153–155, 157–158, 16, 161–169, 17, 170–179, 18, 180–189, 19, 190–197, 199, 20, 201, 203–209, 21, 210–219, 22, 220–224, 226–229, 23, 231–233, 235–239, 24, 240–243, 246–250, 252–256, 258, 261–269, 271, 274–290, 293–298, 300, 303–305, 307–308, 311–333, 335, 337, 44–62, 64–66, 68–76, 79–97
   errors.rs0%100%0%0%4
   identity.rs82.35%100%60%86.21%13
   key.rs95.05%100%84.62%96.59%31
   keystore.rs0%100%0%0%19–26, 28–31, 34–46, 48–55, 57–64, 66, 68–86
   para_artifact.rs15.94%100%10%16.95%12, 18, 25, 44–46, 48–64, 66–69, 72–81, 83–88, 92–93
   port.rs93.75%100%83.33%96.15%
crates/orchestrator/src/network
   node.rs0%100%0%0%100–105, 108–109, 11, 110, 112, 114–120, 122–124, 126–129, 131–135, 139–147, 27–46, 50–53, 55–57, 59–61, 65–68, 71–74, 81–86, 96–99
   parachain.rs0%100%0%0%100, 102–105, 15, 25–33, 35–47, 49–53, 56–60, 63–70, 72, 74, 77–82, 85–86, 88–93, 97–99
   relaychain.rs0%100%0%0%14–21, 5
crates/orchestrator/src/network_helper
   verifier.rs0%100%0%0%10–11, 16, 18–25, 27–32, 34, 7–9
crates/orchestrator/src/network_spec
   node.rs39.17%100%16.67%40.35%108, 146–150, 152–153, 155, 158, 16, 160–163, 165–168, 173–178, 180, 183, 185–215, 217, 90–91, 93–96
   parachain.rs72.04%100%50%73.03%100, 107, 125, 130–133, 136, 147–150, 153, 17, 71–73, 76, 78–80, 86, 95
   relaychain.rs88.71%100%66.67%91.07%100, 17, 70, 93
crates/orchestrator/src/shared
   types.rs26.09%100%11.76%34.48%15, 30, 36, 45–49, 52, 61, 72
crates/prom-metrics-parser/src
   lib.rs91.94%100%80%92.98%105, 127, 55–57, 7, 81
crates/provider/src
   lib.rs50%100%50%50%
   native.rs92.32%100%92.06%92.35%1002, 1010, 1037, 1042, 1046, 1066, 1070, 109, 1106, 1113, 1129, 1167, 1171, 1209, 1220, 1254, 1265, 1279, 1285, 1322, 1333, 1365, 1373, 1400, 1408, 1447, 1462, 1467, 1477, 1502, 1514, 1543, 1553, 1569, 1576, 1602, 1626, 1664, 1668–1670, 1673, 1699, 1735, 1759, 1818, 1857, 191, 1921, 1947, 2017, 2059, 2095, 2106, 2131, 2135–2137, 2140, 2172, 226–230, 301, 320, 327, 333, 335, 342, 344–345, 359, 39, 403–405, 407–409, 411–413, 435–437, 439–441, 462, 502, 511, 535, 547, 555, 567, 581, 601, 606, 619, 639–640, 645–647, 668, 699, 703, 707, 787, 890, 897, 902, 907, 912, 919, 932
crates/provider/src/shared
   types.rs84.47%100%74.29%86.41%123, 140–146, 15–18, 230, 249–256, 79
crates/support/src
   fs.rs75%100%66.67%80%
   net.rs0%100%0%0%10, 4–9
   process.rs100%100%100%100%
crates/support/src/fs
   in_memory.rs95.55%100%96.45%95.37%108, 252, 276, 327, 379, 387, 395, 403, 41–42, 425, 43, 433, 44, 46, 48–51, 53, 548, 570, 58, 598, 615, 633, 640, 659, 686, 703
   local.rs96.23%100%93.98%96.77%63, 8, 89–94
crates/support/src/process
   fake.rs82.47%100%84.62%82.03%126–131, 147, 205, 22, 229–230, 232–249, 302, 319–323, 333, 360, 39–40, 47, 63, 82, 91
   os.rs0%100%0%0%100–102, 16–18, 20–23, 25–27, 29–32, 34–36, 38–40, 43, 47–52, 54–56, 58–60, 62–64, 66–68, 70–71, 76–82, 84–89, 9, 91–95, 97–99
crates/test-runner/src
   lib.rs100%100%100%100%

1 similar comment
@github-actions
Copy link

Coverage after merging pg/node_client into main

77.26%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
crates/configuration/src
   global_settings.rs98.46%100%93.33%99.13%
   hrmp_channel.rs95.88%100%89.47%97.44%
   network.rs99.22%100%97.78%99.36%117, 122, 130, 175, 80, 88
   parachain.rs97.59%100%95.19%97.85%51–53, 551–560, 67–70
   relaychain.rs96.60%100%92.65%97.09%338–347, 77–79
   utils.rs40%100%40%40%11–13, 15–17, 19–21
crates/configuration/src/shared
   errors.rs50%100%50%50%
   helpers.rs100%100%100%100%
   node.rs98.32%100%92.68%98.93%124, 130
   resources.rs96.09%100%94.52%96.43%102, 114, 126–128, 147–150
   types.rs90.40%100%84.16%92.22%279–281, 350–352, 378–379, 381–383, 60–62
crates/orchestrator/src
   errors.rs0%100%0%0%8
   lib.rs0%100%0%0%100–103, 105–108, 112–115, 117–123, 125, 129, 131–146, 150–173, 177–186, 189, 192–196, 198, 200–204, 207–225, 227–232, 234–255, 259–261, 264, 267–272, 274–277, 280–284, 287, 289–302, 304–306, 309–313, 315, 317–330, 332–335, 337–339, 343–345, 347–371, 379, 383–384, 394, 401–403, 405–414, 416–417, 419–427, 429–436, 438–439, 44, 440–445, 447–449, 45, 450–458, 46, 461, 47–49, 51–56, 58–64, 66–69, 75, 77–92, 98–99
   network.rs0%100%0%0%100–108, 111–117, 119–127, 130–155, 157–168, 171, 173–177, 185–188, 190, 192, 194–196, 199–204, 206–208, 210–212, 214–216, 218–220, 222–224, 226–228, 230–232, 32–40, 43, 56–70, 77–82, 85–94, 96, 98–99
   network_spec.rs93.67%100%83.33%95.52%11, 38
   spawner.rs0%100%0%0%100–109, 111, 115–117, 120–122, 124, 130–150, 152, 154–164, 166–171, 173–175, 177–186, 188–193, 195–199, 20, 201–204, 43–56, 58–59, 61, 63–66, 70–71, 73, 76–96, 98–99
crates/orchestrator/src/generators
   bootnode_addr.rs97.20%100%100%96.84%
   chain_spec.rs3.24%100%5%3.08%100–111, 113–128, 130, 135–148, 151–157, 159–161, 164–192, 194–197, 199–201, 203–216, 218–219, 22, 220, 223–225, 227, 229–241, 243, 246–251, 253–254, 256–269, 271, 274–279, 281–282, 285–298, 300–305, 307–309, 311–313, 316–321, 323–352, 355, 358–361, 364, 366–367, 369–379, 38, 380–384, 386, 388–389, 392–397, 405–443, 454–459, 46, 460–462, 472–480, 482–494, 496–504, 507–509, 513–516, 518–519, 524–535, 539–552, 554, 557–558, 561–567, 569–574, 580–585, 587, 589, 591–598, 600–603, 606–607, 611–612, 614, 616–617, 619–623, 625–628, 630, 632–633, 635–636, 638–640, 642–644, 646–648, 651–653, 656–660, 662, 664–672, 674–675, 680–687, 689–699, 703–706, 708, 710, 712–717, 719–729, 731–746, 748–749, 75, 750–755, 757, 76, 761–769, 77, 770–781, 783, 792–802, 804, 806–823, 825–829, 831, 833, 84–87, 95–99
   command.rs0%100%0%0%100–112, 114–120, 122, 125–130, 132–133, 136–148, 15, 150, 153–155, 157–158, 16, 161–169, 17, 170–179, 18, 180–189, 19, 190–197, 199, 20, 201, 203–209, 21, 210–219, 22, 220–224, 226–229, 23, 231–233, 235–239, 24, 240–243, 246–250, 252–256, 258, 261–269, 271, 274–290, 293–298, 300, 303–305, 307–308, 311–333, 335, 337, 44–62, 64–66, 68–76, 79–97
   errors.rs0%100%0%0%4
   identity.rs82.35%100%60%86.21%13
   key.rs95.05%100%84.62%96.59%31
   keystore.rs0%100%0%0%19–26, 28–31, 34–46, 48–55, 57–64, 66, 68–86
   para_artifact.rs15.94%100%10%16.95%12, 18, 25, 44–46, 48–64, 66–69, 72–81, 83–88, 92–93
   port.rs93.75%100%83.33%96.15%
crates/orchestrator/src/network
   node.rs0%100%0%0%100–105, 108–109, 11, 110, 112, 114–120, 122–124, 126–129, 131–135, 139–147, 27–46, 50–53, 55–57, 59–61, 65–68, 71–74, 81–86, 96–99
   parachain.rs0%100%0%0%100, 102–105, 15, 25–33, 35–47, 49–53, 56–60, 63–70, 72, 74, 77–82, 85–86, 88–93, 97–99
   relaychain.rs0%100%0%0%14–21, 5
crates/orchestrator/src/network_helper
   verifier.rs0%100%0%0%10–11, 16, 18–25, 27–32, 34, 7–9
crates/orchestrator/src/network_spec
   node.rs39.17%100%16.67%40.35%108, 146–150, 152–153, 155, 158, 16, 160–163, 165–168, 173–178, 180, 183, 185–215, 217, 90–91, 93–96
   parachain.rs72.04%100%50%73.03%100, 107, 125, 130–133, 136, 147–150, 153, 17, 71–73, 76, 78–80, 86, 95
   relaychain.rs88.71%100%66.67%91.07%100, 17, 70, 93
crates/orchestrator/src/shared
   types.rs26.09%100%11.76%34.48%15, 30, 36, 45–49, 52, 61, 72
crates/prom-metrics-parser/src
   lib.rs91.94%100%80%92.98%105, 127, 55–57, 7, 81
crates/provider/src
   lib.rs50%100%50%50%
   native.rs92.32%100%92.06%92.35%1002, 1010, 1037, 1042, 1046, 1066, 1070, 109, 1106, 1113, 1129, 1167, 1171, 1209, 1220, 1254, 1265, 1279, 1285, 1322, 1333, 1365, 1373, 1400, 1408, 1447, 1462, 1467, 1477, 1502, 1514, 1543, 1553, 1569, 1576, 1602, 1626, 1664, 1668–1670, 1673, 1699, 1735, 1759, 1818, 1857, 191, 1921, 1947, 2017, 2059, 2095, 2106, 2131, 2135–2137, 2140, 2172, 226–230, 301, 320, 327, 333, 335, 342, 344–345, 359, 39, 403–405, 407–409, 411–413, 435–437, 439–441, 462, 502, 511, 535, 547, 555, 567, 581, 601, 606, 619, 639–640, 645–647, 668, 699, 703, 707, 787, 890, 897, 902, 907, 912, 919, 932
crates/provider/src/shared
   types.rs84.47%100%74.29%86.41%123, 140–146, 15–18, 230, 249–256, 79
crates/support/src
   fs.rs75%100%66.67%80%
   net.rs0%100%0%0%10, 4–9
   process.rs100%100%100%100%
crates/support/src/fs
   in_memory.rs95.55%100%96.45%95.37%108, 252, 276, 327, 379, 387, 395, 403, 41–42, 425, 43, 433, 44, 46, 48–51, 53, 548, 570, 58, 598, 615, 633, 640, 659, 686, 703
   local.rs96.23%100%93.98%96.77%63, 8, 89–94
crates/support/src/process
   fake.rs82.47%100%84.62%82.03%126–131, 147, 205, 22, 229–230, 232–249, 302, 319–323, 333, 360, 39–40, 47, 63, 82, 91
   os.rs0%100%0%0%100–102, 16–18, 20–23, 25–27, 29–32, 34–36, 38–40, 43, 47–52, 54–56, 58–60, 62–64, 66–68, 70–71, 76–82, 84–89, 9, 91–95, 97–99
crates/test-runner/src
   lib.rs100%100%100%100%

@pepoviola
Copy link
Collaborator

Hey @pgherveou thanks for your contribution 🙌, something like this is definitely useful for teams but we need to brainstorming about the API since we also want to expose other ways to interact with the node in the context of the network.

@pgherveou
Copy link
Contributor Author

Sure feel free to close, just wanted to try it out

@github-actions
Copy link

Coverage after merging pg/node_client into main

77.30%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
crates/configuration/src
   global_settings.rs98.46%100%93.33%99.13%
   hrmp_channel.rs95.88%100%89.47%97.44%
   network.rs99.22%100%97.78%99.36%117, 122, 130, 175, 80, 88
   parachain.rs97.59%100%95.19%97.85%51–53, 551–560, 67–70
   relaychain.rs96.60%100%92.65%97.09%338–347, 77–79
   utils.rs40%100%40%40%11–13, 15–17, 19–21
crates/configuration/src/shared
   errors.rs50%100%50%50%
   helpers.rs100%100%100%100%
   node.rs98.32%100%92.68%98.93%124, 130
   resources.rs96.09%100%94.52%96.43%102, 114, 126–128, 147–150
   types.rs90.40%100%84.16%92.22%279–281, 350–352, 378–379, 381–383, 60–62
crates/orchestrator/src
   errors.rs0%100%0%0%8
   lib.rs0%100%0%0%100–103, 105–108, 112–115, 117–123, 125, 129, 131–146, 150–173, 177–186, 189, 192–196, 198, 200–204, 207–225, 227–232, 234–255, 259–261, 264, 267–272, 274–277, 280–284, 287, 289–302, 304–306, 309–313, 315, 317–330, 332–335, 337–339, 343–345, 347–371, 379, 383–384, 394, 401–403, 405–414, 416–417, 419–427, 429–436, 438–439, 44, 440–445, 447–449, 45, 450–458, 46, 461, 47–49, 51–56, 58–64, 66–69, 75, 77–92, 98–99
   network.rs0%100%0%0%100–108, 111–117, 119–127, 130–155, 157–168, 171, 173–177, 185–188, 190, 192, 194–196, 199–204, 206–208, 210–212, 214–216, 218–220, 222–224, 226–228, 230–232, 32–40, 43, 56–70, 77–82, 85–94, 96, 98–99
   network_spec.rs93.67%100%83.33%95.52%11, 38
   spawner.rs0%100%0%0%100–109, 111, 115–117, 120–122, 124, 130–150, 152, 154–164, 166, 168, 170–172, 174–183, 185–190, 192–196, 198–199, 20, 200–201, 43–56, 58–59, 61, 63–66, 70–71, 73, 76–96, 98–99
crates/orchestrator/src/generators
   bootnode_addr.rs97.20%100%100%96.84%
   chain_spec.rs3.24%100%5%3.08%100–111, 113–128, 130, 135–148, 151–157, 159–161, 164–192, 194–197, 199–201, 203–216, 218–219, 22, 220, 223–225, 227, 229–241, 243, 246–251, 253–254, 256–269, 271, 274–279, 281–282, 285–298, 300–305, 307–309, 311–313, 316–321, 323–352, 355, 358–361, 364, 366–367, 369–379, 38, 380–384, 386, 388–389, 392–397, 405–443, 454–459, 46, 460–462, 472–480, 482–494, 496–504, 507–509, 513–516, 518–519, 524–535, 539–552, 554, 557–558, 561–567, 569–574, 580–585, 587, 589, 591–598, 600–603, 606–607, 611–612, 614, 616–617, 619–623, 625–628, 630, 632–633, 635–636, 638–640, 642–644, 646–648, 651–653, 656–660, 662, 664–672, 674–675, 680–687, 689–699, 703–706, 708, 710, 712–717, 719–729, 731–746, 748–749, 75, 750–755, 757, 76, 761–769, 77, 770–781, 783, 792–802, 804, 806–823, 825–829, 831, 833, 84–87, 95–99
   command.rs0%100%0%0%100–112, 114–120, 122, 125–130, 132–133, 136–148, 15, 150, 153–155, 157–158, 16, 161–169, 17, 170–179, 18, 180–189, 19, 190–197, 199, 20, 201, 203–209, 21, 210–219, 22, 220–224, 226–229, 23, 231–233, 235–239, 24, 240–243, 246–250, 252–256, 258, 261–269, 271, 274–290, 293–298, 300, 303–305, 307–308, 311–333, 335, 337, 44–62, 64–66, 68–76, 79–97
   errors.rs0%100%0%0%4
   identity.rs82.35%100%60%86.21%13
   key.rs95.05%100%84.62%96.59%31
   keystore.rs0%100%0%0%19–26, 28–31, 34–46, 48–55, 57–64, 66, 68–86
   para_artifact.rs15.94%100%10%16.95%12, 18, 25, 44–46, 48–64, 66–69, 72–81, 83–88, 92–93
   port.rs93.75%100%83.33%96.15%
crates/orchestrator/src/network
   node.rs0%100%0%0%100–105, 108–109, 11, 110, 112, 114–120, 122–124, 126–129, 131–135, 139–147, 27–46, 50–53, 55–57, 59–61, 65–68, 71–74, 81–86, 96–99
   parachain.rs0%100%0%0%100, 102–105, 15, 25–33, 35–47, 49–53, 56–60, 63–70, 72, 74, 77–82, 85–86, 88–93, 97–99
   relaychain.rs0%100%0%0%14–21, 5
crates/orchestrator/src/network_helper
   verifier.rs0%100%0%0%10–11, 16, 18–25, 27–32, 34, 7–9
crates/orchestrator/src/network_spec
   node.rs39.17%100%16.67%40.35%108, 146–150, 152–153, 155, 158, 16, 160–163, 165–168, 173–178, 180, 183, 185–215, 217, 90–91, 93–96
   parachain.rs72.04%100%50%73.03%100, 107, 125, 130–133, 136, 147–150, 153, 17, 71–73, 76, 78–80, 86, 95
   relaychain.rs88.71%100%66.67%91.07%100, 17, 70, 93
crates/orchestrator/src/shared
   types.rs26.09%100%11.76%34.48%15, 30, 36, 45–49, 52, 61, 72
crates/prom-metrics-parser/src
   lib.rs91.94%100%80%92.98%105, 127, 55–57, 7, 81
crates/provider/src
   lib.rs50%100%50%50%
   native.rs92.32%100%92.06%92.35%1002, 1010, 1037, 1042, 1046, 1066, 1070, 109, 1106, 1113, 1129, 1167, 1171, 1209, 1220, 1254, 1265, 1279, 1285, 1322, 1333, 1365, 1373, 1400, 1408, 1447, 1462, 1467, 1477, 1502, 1514, 1543, 1553, 1569, 1576, 1602, 1626, 1664, 1668–1670, 1673, 1699, 1735, 1759, 1818, 1857, 191, 1921, 1947, 2017, 2059, 2095, 2106, 2131, 2135–2137, 2140, 2172, 226–230, 301, 320, 327, 333, 335, 342, 344–345, 359, 39, 403–405, 407–409, 411–413, 435–437, 439–441, 462, 502, 511, 535, 547, 555, 567, 581, 601, 606, 619, 639–640, 645–647, 668, 699, 703, 707, 787, 890, 897, 902, 907, 912, 919, 932
crates/provider/src/shared
   types.rs84.47%100%74.29%86.41%123, 140–146, 15–18, 230, 249–256, 79
crates/support/src
   fs.rs75%100%66.67%80%
   net.rs0%100%0%0%10, 4–9
   process.rs100%100%100%100%
crates/support/src/fs
   in_memory.rs95.55%100%96.45%95.37%108, 252, 276, 327, 379, 387, 395, 403, 41–42, 425, 43, 433, 44, 46, 48–51, 53, 548, 570, 58, 598, 615, 633, 640, 659, 686, 703
   local.rs96.23%100%93.98%96.77%63, 8, 89–94
crates/support/src/process
   fake.rs82.47%100%84.62%82.03%126–131, 147, 205, 22, 229–230, 232–249, 302, 319–323, 333, 360, 39–40, 47, 63, 82, 91
   os.rs0%100%0%0%100–102, 16–18, 20–23, 25–27, 29–32, 34–36, 38–40, 43, 47–52, 54–56, 58–60, 62–64, 66–68, 70–71, 76–82, 84–89, 9, 91–95, 97–99
crates/test-runner/src
   lib.rs100%100%100%100%

@github-actions
Copy link

Coverage after merging pg/node_client into main

77.29%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
crates/configuration/src
   global_settings.rs98.46%100%93.33%99.13%
   hrmp_channel.rs95.88%100%89.47%97.44%
   network.rs99.22%100%97.78%99.36%117, 122, 130, 175, 80, 88
   parachain.rs97.59%100%95.19%97.85%51–53, 551–560, 67–70
   relaychain.rs96.60%100%92.65%97.09%338–347, 77–79
   utils.rs40%100%40%40%11–13, 15–17, 19–21
crates/configuration/src/shared
   errors.rs50%100%50%50%
   helpers.rs100%100%100%100%
   node.rs98.32%100%92.68%98.93%124, 130
   resources.rs96.09%100%94.52%96.43%102, 114, 126–128, 147–150
   types.rs90.40%100%84.16%92.22%279–281, 350–352, 378–379, 381–383, 60–62
crates/orchestrator/src
   errors.rs0%100%0%0%8
   lib.rs0%100%0%0%100–103, 105–108, 112–115, 117–123, 125, 129, 131–146, 150–173, 177–186, 189, 192–196, 198, 200–204, 207–225, 227–232, 234–255, 259–261, 264, 267–272, 274–277, 280–284, 287, 289–302, 304–306, 309–313, 315, 317–330, 332–335, 337–339, 343–345, 347–371, 379, 383–384, 394, 401–403, 405–414, 416–417, 419–427, 429–436, 438–439, 44, 440–445, 447–449, 45, 450–458, 46, 461, 47–49, 51–56, 58–64, 66–69, 75, 77–92, 98–99
   network.rs0%100%0%0%100–108, 111–117, 119–127, 130–155, 157–168, 171, 173–177, 185–188, 190, 192, 194–196, 199–204, 206–208, 210–212, 214–216, 218–220, 222–224, 226–228, 230–232, 32–40, 43, 56–70, 77–82, 85–94, 96, 98–99
   network_spec.rs93.67%100%83.33%95.52%11, 38
   spawner.rs0%100%0%0%100–109, 111, 115–117, 120–122, 124, 130–150, 152, 154–164, 166–168, 170–172, 174–183, 185–190, 192–196, 198–199, 20, 200–201, 43–56, 58–59, 61, 63–66, 70–71, 73, 76–96, 98–99
crates/orchestrator/src/generators
   bootnode_addr.rs97.20%100%100%96.84%
   chain_spec.rs3.24%100%5%3.08%100–111, 113–128, 130, 135–148, 151–157, 159–161, 164–192, 194–197, 199–201, 203–216, 218–219, 22, 220, 223–225, 227, 229–241, 243, 246–251, 253–254, 256–269, 271, 274–279, 281–282, 285–298, 300–305, 307–309, 311–313, 316–321, 323–352, 355, 358–361, 364, 366–367, 369–379, 38, 380–384, 386, 388–389, 392–397, 405–443, 454–459, 46, 460–462, 472–480, 482–494, 496–504, 507–509, 513–516, 518–519, 524–535, 539–552, 554, 557–558, 561–567, 569–574, 580–585, 587, 589, 591–598, 600–603, 606–607, 611–612, 614, 616–617, 619–623, 625–628, 630, 632–633, 635–636, 638–640, 642–644, 646–648, 651–653, 656–660, 662, 664–672, 674–675, 680–687, 689–699, 703–706, 708, 710, 712–717, 719–729, 731–746, 748–749, 75, 750–755, 757, 76, 761–769, 77, 770–781, 783, 792–802, 804, 806–823, 825–829, 831, 833, 84–87, 95–99
   command.rs0%100%0%0%100–112, 114–120, 122, 125–130, 132–133, 136–148, 15, 150, 153–155, 157–158, 16, 161–169, 17, 170–179, 18, 180–189, 19, 190–197, 199, 20, 201, 203–209, 21, 210–219, 22, 220–224, 226–229, 23, 231–233, 235–239, 24, 240–243, 246–250, 252–256, 258, 261–269, 271, 274–290, 293–298, 300, 303–305, 307–308, 311–333, 335, 337, 44–62, 64–66, 68–76, 79–97
   errors.rs0%100%0%0%4
   identity.rs82.35%100%60%86.21%13
   key.rs95.05%100%84.62%96.59%31
   keystore.rs0%100%0%0%19–26, 28–31, 34–46, 48–55, 57–64, 66, 68–86
   para_artifact.rs15.94%100%10%16.95%12, 18, 25, 44–46, 48–64, 66–69, 72–81, 83–88, 92–93
   port.rs93.75%100%83.33%96.15%
crates/orchestrator/src/network
   node.rs0%100%0%0%100–105, 108–109, 11, 110, 112, 114–120, 122–124, 126–129, 131–135, 139–147, 27–46, 50–53, 55–57, 59–61, 65–68, 71–74, 81–86, 96–99
   parachain.rs0%100%0%0%100, 102–105, 15, 25–33, 35–47, 49–53, 56–60, 63–70, 72, 74, 77–82, 85–86, 88–93, 97–99
   relaychain.rs0%100%0%0%14–21, 5
crates/orchestrator/src/network_helper
   verifier.rs0%100%0%0%10–11, 16, 18–25, 27–32, 34, 7–9
crates/orchestrator/src/network_spec
   node.rs39.17%100%16.67%40.35%108, 146–150, 152–153, 155, 158, 16, 160–163, 165–168, 173–178, 180, 183, 185–215, 217, 90–91, 93–96
   parachain.rs72.04%100%50%73.03%100, 107, 125, 130–133, 136, 147–150, 153, 17, 71–73, 76, 78–80, 86, 95
   relaychain.rs88.71%100%66.67%91.07%100, 17, 70, 93
crates/orchestrator/src/shared
   types.rs26.09%100%11.76%34.48%15, 30, 36, 45–49, 52, 61, 72
crates/prom-metrics-parser/src
   lib.rs91.94%100%80%92.98%105, 127, 55–57, 7, 81
crates/provider/src
   lib.rs50%100%50%50%
   native.rs92.32%100%92.06%92.35%1002, 1010, 1037, 1042, 1046, 1066, 1070, 109, 1106, 1113, 1129, 1167, 1171, 1209, 1220, 1254, 1265, 1279, 1285, 1322, 1333, 1365, 1373, 1400, 1408, 1447, 1462, 1467, 1477, 1502, 1514, 1543, 1553, 1569, 1576, 1602, 1626, 1664, 1668–1670, 1673, 1699, 1735, 1759, 1818, 1857, 191, 1921, 1947, 2017, 2059, 2095, 2106, 2131, 2135–2137, 2140, 2172, 226–230, 301, 320, 327, 333, 335, 342, 344–345, 359, 39, 403–405, 407–409, 411–413, 435–437, 439–441, 462, 502, 511, 535, 547, 555, 567, 581, 601, 606, 619, 639–640, 645–647, 668, 699, 703, 707, 787, 890, 897, 902, 907, 912, 919, 932
crates/provider/src/shared
   types.rs84.47%100%74.29%86.41%123, 140–146, 15–18, 230, 249–256, 79
crates/support/src
   fs.rs75%100%66.67%80%
   net.rs0%100%0%0%10, 4–9
   process.rs100%100%100%100%
crates/support/src/fs
   in_memory.rs95.55%100%96.45%95.37%108, 252, 276, 327, 379, 387, 395, 403, 41–42, 425, 43, 433, 44, 46, 48–51, 53, 548, 570, 58, 598, 615, 633, 640, 659, 686, 703
   local.rs96.23%100%93.98%96.77%63, 8, 89–94
crates/support/src/process
   fake.rs82.47%100%84.62%82.03%126–131, 147, 205, 22, 229–230, 232–249, 302, 319–323, 333, 360, 39–40, 47, 63, 82, 91
   os.rs0%100%0%0%100–102, 16–18, 20–23, 25–27, 29–32, 34–36, 38–40, 43, 47–52, 54–56, 58–60, 62–64, 66–68, 70–71, 76–82, 84–89, 9, 91–95, 97–99
crates/test-runner/src
   lib.rs100%100%100%100%

@pepoviola
Copy link
Collaborator

Sure feel free to close, just wanted to try it out

No, I don't think we should close it. I think is in the right path and worth to explore it and see the feedback from other teams. Then we can rethink some of the abstractions. @wirednkod / @l0r1s .

Just FYI @pgherveou we want to add also support to run embedded pjs scripts like the javascript tab of poladot.js inside the Network instance.

crates/orchestrator/src/spawner.rs Outdated Show resolved Hide resolved
crates/orchestrator/src/spawner.rs Outdated Show resolved Hide resolved
loop {
match connect().await {
Err(_) if retries >= 0 => {
println!("Error connecting, retrying ...");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be added to the crates/configuration/src/shared/constants.rs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you moving all &str into this file? This might make logging a bit more tedious, curious what you gain from this?

crates/orchestrator/src/spawner.rs Outdated Show resolved Hide resolved
@pgherveou
Copy link
Contributor Author

Just FYI @pgherveou we want to add also support to run embedded pjs scripts like the javascript tab of poladot.js inside the Network instance.

Should be nice, but not really useful for our usecase. We mainly want to interact with the node through subxt. That's what we do today, but with a solochain

@pepoviola
Copy link
Collaborator

Just FYI @pgherveou we want to add also support to run embedded pjs scripts like the javascript tab of poladot.js inside the Network instance.

Should be nice, but not really useful for our usecase. We mainly want to interact with the node through subxt. That's what we do today, but with a solochain

Sounds good! and I think this is a great step forward :)

@pgherveou
Copy link
Contributor Author

This is the code I could replace with zsdk.

https://github.com/paritytech/ink/blob/02c4f0d5981f498051a954bd743671310cb34f15/crates/e2e/src/node_proc.rs#L51

So pretty much what's missing are these 2 apis I added here. Other methods like kill are I believe already available.

Then I would also need to specify a custom path for the collator, but I believe it can already be specified as well.

@pepoviola
Copy link
Collaborator

Yes, looks like an awesome use-case. We were thinking on make the client/rpc call to create the client and not auto-connect the nodes at spawn phase. Something like from end-user perspective

let client = network.get_node("alice")?.client().await?;

@pgherveou
Copy link
Contributor Author

Yes, looks like an awesome use-case. We were thinking on make the client/rpc call to create the client and not auto-connect the nodes at spawn phase. Something like from end-user perspective

let client = network.get_node("alice")?.client().await?;

that would work too, as long as the sdk can handle the retry logic

@pgherveou
Copy link
Contributor Author

One thing that would be nice as well is to use log and a custom target instead of println, so that these logs can easily be stripped from our tests.

@pepoviola
Copy link
Collaborator

pepoviola commented Oct 23, 2023

Yes, looks like an awesome use-case. We were thinking on make the client/rpc call to create the client and not auto-connect the nodes at spawn phase. Something like from end-user perspective

let client = network.get_node("alice")?.client().await?;

that would work too, as long as the sdk can handle the retry logic

@pgherveou, I'm not familiarized with the subxt internals, did you know if they handle reconnections? I wonder if make sense to cache the client in the Node as is in your pr (even if we change to connect on-demand).
Thx!

@pgherveou
Copy link
Contributor Author

@pgherveou, I'm not familiarized with the subxt internals, did you know if they handle reconnections? I wonder if make sense to cache the client in the Node as is in your pr (even if we change to connect on-demand). Thx!

under the hood, looks like it's a tokio TcpStream. if the Node is stopped you will have to recreate the client.

You will receive this kind of error if you try to read from it.

RPC error: The background task been terminated because: Networking or low-level protocol error: WebSocket connection error: connection closed; restart required)

Maybe creating the client on demand like you are suggesting and letting the consumer deal with re-connection is good enough.
You can maybe just create a temporary one just to poll until the network is ready. There might be option to also pass a healthy tcpstream to build the client, if you want to keep a cached connection around.

@pgherveou
Copy link
Contributor Author

@pgherveou, I'm not familiarized with the subxt internals, did you know if they handle reconnections? I wonder if make sense to cache the client in the Node as is in your pr (even if we change to connect on-demand). Thx!

updated the PR to do it lazily, this remove the need for the custom retry function as well

RpcClient::from_url(&self.ws_uri).await
}

pub async fn client(&self) -> Result<OnlineClient<PolkadotConfig>, subxt::Error> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does make sense to allow users to also specify the concrete Config type?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm good point. Using moonbeam for example you would need to specify a custom config.
A bit of a shame that Rust does not let you specify a default value for the generic trait here.

I mean you could but then rustc complains with

defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions  this was previously accepted by the compiler but is being phased out;

Copy link
Collaborator

@pepoviola pepoviola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just an small question and the is good to merge 🙌

@pepoviola
Copy link
Collaborator

Looks good @pgherveou! thanks for your contribution 🙌 🙌 I will fix the fmt/clippy and merge this one.
Again, thanks for your contribution!

Copy link
Contributor

@wirednkod wirednkod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the clippy issues this make sense. Thank you @pgherveou

@pgherveou
Copy link
Contributor Author

🙏 looks like there are quite a lot of clippy issues not related to the changes here. Should you ship the fixes in a different PR?

@github-actions
Copy link

Coverage after merging pg/node_client into main

77.47%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
crates/configuration/src
   global_settings.rs98.46%100%93.33%99.13%
   hrmp_channel.rs95.88%100%89.47%97.44%
   network.rs99.22%100%97.78%99.36%117, 122, 130, 175, 80, 88
   parachain.rs97.59%100%95.19%97.85%51–53, 551–560, 67–70
   relaychain.rs96.60%100%92.65%97.09%338–347, 77–79
   utils.rs40%100%40%40%11–13, 15–17, 19–21
crates/configuration/src/shared
   errors.rs50%100%50%50%
   helpers.rs100%100%100%100%
   node.rs98.32%100%92.68%98.93%124, 130
   resources.rs96.09%100%94.52%96.43%102, 114, 126–128, 147–150
   types.rs90.40%100%84.16%92.22%279–281, 350–352, 378–379, 381–383, 60–62
crates/orchestrator/src
   errors.rs0%100%0%0%8
   lib.rs0%100%0%0%100–103, 105–108, 112–115, 117–123, 125, 129, 131–146, 150–173, 177–186, 189, 192–196, 198, 200–204, 207–225, 227–232, 234–255, 259–261, 264, 267–272, 274–277, 280–284, 287, 289–302, 304–306, 309–313, 315, 317–330, 332–335, 337–339, 343–345, 347–371, 379, 383–384, 394, 401–403, 405–414, 416–417, 419–427, 429–436, 438–439, 44, 440–445, 447–449, 45, 450–458, 46, 461, 47–49, 51–56, 58–64, 66–69, 75, 77–92, 98–99
   network.rs0%100%0%0%100–108, 111–117, 119–127, 130–155, 157–168, 171, 173–177, 185–188, 190, 192, 194–196, 199–204, 206–208, 210–212, 214–216, 218–220, 222–224, 226–228, 230–232, 32–40, 43, 56–70, 77–82, 85–94, 96, 98–99
   network_spec.rs93.67%100%83.33%95.52%11, 38
   spawner.rs0%100%0%0%100–106, 108, 111–113, 116–120, 122, 127–147, 149, 151–168, 17, 40–53, 55–56, 58, 60–63, 67–68, 70, 73–93, 95–99
crates/orchestrator/src/generators
   bootnode_addr.rs97.20%100%100%96.84%
   chain_spec.rs3.24%100%5%3.08%100–111, 113–128, 130, 135–148, 151–157, 159–161, 164–192, 194–197, 199–201, 203–216, 218–219, 22, 220, 223–225, 227, 229–241, 243, 246–251, 253–254, 256–269, 271, 274–279, 281–282, 285–298, 300–305, 307–309, 311–313, 316–321, 323–352, 355, 358–361, 364, 366–367, 369–379, 38, 380–384, 386, 388–389, 392–397, 405–443, 454–459, 46, 460–462, 472–480, 482–494, 496–504, 507–509, 513–516, 518–519, 524–535, 539–552, 554, 557–558, 561–567, 569–574, 580–585, 587, 589, 591–598, 600–603, 606–607, 611–612, 614, 616–617, 619–623, 625–628, 630, 632–633, 635–636, 638–640, 642–644, 646–648, 651–653, 656–660, 662, 664–672, 674–675, 680–687, 689–699, 703–706, 708, 710, 712–717, 719–729, 731–746, 748–749, 75, 750–755, 757, 76, 761–769, 77, 770–781, 783, 792–802, 804, 806–823, 825–829, 831, 833, 84–87, 95–99
   command.rs0%100%0%0%100–112, 114–120, 122, 125–130, 132–133, 136–148, 15, 150, 153–155, 157–158, 16, 161–169, 17, 170–179, 18, 180–189, 19, 190–197, 199, 20, 201, 203–209, 21, 210–219, 22, 220–224, 226–229, 23, 231–233, 235–239, 24, 240–243, 246–250, 252–256, 258, 261–269, 271, 274–290, 293–298, 300, 303–305, 307–308, 311–333, 335, 337, 44–62, 64–66, 68–76, 79–97
   errors.rs0%100%0%0%4
   identity.rs82.35%100%60%86.21%13
   key.rs95.05%100%84.62%96.59%31
   keystore.rs0%100%0%0%19–26, 28–31, 34–46, 48–55, 57–64, 66, 68–86
   para_artifact.rs15.94%100%10%16.95%12, 18, 25, 44–46, 48–64, 66–69, 72–81, 83–88, 92–93
   port.rs93.75%100%83.33%96.15%
crates/orchestrator/src/network
   node.rs0%100%0%0%100–103, 106–108, 11, 110, 112–118, 120–122, 124–127, 129–133, 137–145, 25–40, 44–47, 50–52, 55–59, 63–66, 69–72, 79–84, 94–99
   parachain.rs0%100%0%0%100, 102–105, 15, 25–33, 35–47, 49–53, 56–60, 63–70, 72, 74, 77–82, 85–86, 88–93, 97–99
   relaychain.rs0%100%0%0%14–21, 5
crates/orchestrator/src/network_helper
   verifier.rs0%100%0%0%10–11, 16, 18–25, 27–32, 34, 7–9
crates/orchestrator/src/network_spec
   node.rs39.17%100%16.67%40.35%108, 146–150, 152–153, 155, 158, 16, 160–163, 165–168, 173–178, 180, 183, 185–215, 217, 90–91, 93–96
   parachain.rs72.04%100%50%73.03%100, 107, 125, 130–133, 136, 147–150, 153, 17, 71–73, 76, 78–80, 86, 95
   relaychain.rs88.71%100%66.67%91.07%100, 17, 70, 93
crates/orchestrator/src/shared
   types.rs26.09%100%11.76%34.48%15, 30, 36, 45–49, 52, 61, 72
crates/prom-metrics-parser/src
   lib.rs91.94%100%80%92.98%105, 127, 55–57, 7, 81
crates/provider/src
   lib.rs50%100%50%50%
crates/provider/src/native
   helpers.rs89.25%100%100%88.37%30–31, 36–38, 59, 90, 94, 98
   namespace.rs90.80%100%87.18%91.11%108–112, 183, 202, 209, 215, 217, 224, 226–227, 241, 306, 313, 318, 323, 328, 335, 348, 418, 426, 452, 457, 461, 481, 485, 520, 527, 543, 581, 585, 73
   node.rs92.27%100%91.45%92.36%1034, 1060, 1130, 116, 1172, 1207, 1218, 1243, 1247–1249, 1252, 1284, 156, 165, 189, 201, 209, 221, 235, 255, 260, 273, 322, 333, 367, 378, 392, 398, 435, 446, 478, 486, 513, 521, 560, 57, 575, 58, 580, 59, 590, 61, 615, 62, 627, 63, 656, 666, 682, 689, 715, 739, 777, 781–783, 786, 812, 848, 85–87, 872, 89–91, 93, 931, 94–95, 970
   provider.rs97.62%100%96.30%97.87%15, 179, 85
crates/provider/src/shared
   types.rs84.47%100%74.29%86.41%123, 140–146, 15–18, 230, 249–256, 79
crates/support/src
   fs.rs75%100%66.67%80%
   net.rs0%100%0%0%10, 4–9
   process.rs100%100%100%100%
crates/support/src/fs
   in_memory.rs95.55%100%96.45%95.37%108, 252, 276, 327, 379, 387, 395, 403, 41–42, 425, 43, 433, 44, 46, 48–51, 53, 548, 570, 58, 598, 615, 633, 640, 659, 686, 703
   local.rs96.23%100%93.98%96.77%63, 8, 89–94
crates/support/src/process
   fake.rs82.47%100%84.62%82.03%126–131, 147, 205, 22, 229–230, 232–249, 302, 319–323, 333, 360, 39–40, 47, 63, 82, 91
   os.rs0%100%0%0%100–102, 16–18, 20–23, 25–27, 29–32, 34–36, 38–40, 43, 47–52, 54–56, 58–60, 62–64, 66–68, 70–71, 76–82, 84–89, 9, 91–95, 97–99
crates/test-runner/src
   lib.rs100%100%100%100%

@pepoviola pepoviola merged commit cc66f5c into main Oct 24, 2023
4 checks passed
@pepoviola pepoviola deleted the pg/node_client branch October 24, 2023 12:24
@pepoviola
Copy link
Collaborator

merged, thanks @pgherveou!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants