(
&'s mut self,
parent_submit_config: &SubmitConfig<'a, DockerMaterials>,
subnet_name: &SubnetName,
subnet_config: &SubnetConfig<'a, DockerMaterials>,
)
| 781 | } |
| 782 | |
| 783 | async fn create_subnet<'s, 'a>( |
| 784 | &'s mut self, |
| 785 | parent_submit_config: &SubmitConfig<'a, DockerMaterials>, |
| 786 | subnet_name: &SubnetName, |
| 787 | subnet_config: &SubnetConfig<'a, DockerMaterials>, |
| 788 | ) -> anyhow::Result<DefaultSubnet> |
| 789 | where |
| 790 | 's: 'a, |
| 791 | { |
| 792 | let subnet_dir = self.path(subnet_name); |
| 793 | let subnet_id_file = subnet_dir.join("subnet-id"); |
| 794 | |
| 795 | // Check if we have already created the subnet. |
| 796 | if subnet_id_file.exists() { |
| 797 | let subnet_id = fs::read_to_string(&subnet_id_file) |
| 798 | .context("failed to read subnet ID from file")?; |
| 799 | |
| 800 | let subnet_id = SubnetID::from_str(&subnet_id).with_context(|| { |
| 801 | format!( |
| 802 | "failed to parse subnet ID in {}: {}", |
| 803 | subnet_id_file.to_string_lossy(), |
| 804 | subnet_id |
| 805 | ) |
| 806 | })?; |
| 807 | |
| 808 | let subnet = DefaultSubnet { |
| 809 | subnet_id, |
| 810 | // TODO Karel - save the contracts_owner to file. |
| 811 | contracts_owner: subnet_config.creator.account_id(), |
| 812 | name: subnet_name.clone(), |
| 813 | }; |
| 814 | |
| 815 | return Ok(subnet); |
| 816 | } |
| 817 | |
| 818 | // TODO: Move --permission-mode to the config |
| 819 | // TODO: Move --supply-source-kind to the config |
| 820 | let cmd = format!( |
| 821 | "ipc-cli subnet create \ |
| 822 | --parent {} \ |
| 823 | --from {:?} \ |
| 824 | --min-validators {} \ |
| 825 | --min-validator-stake {} \ |
| 826 | --bottomup-check-period {} \ |
| 827 | --permission-mode collateral \ |
| 828 | --supply-source-kind native \ |
| 829 | --genesis-subnet-ipc-contracts-owner {:?} \ |
| 830 | --chain-id {} |
| 831 | ", |
| 832 | parent_submit_config.subnet.subnet_id, |
| 833 | subnet_config.creator.eth_addr(), |
| 834 | subnet_config.min_validators, |
| 835 | TokenAmount::from_nano(1), // The minimum for native mode that the CLI parses |
| 836 | subnet_config.bottom_up_checkpoint.period, |
| 837 | subnet_config.creator.eth_addr(), |
| 838 | DEFAULT_TEST_CHAIN_ID, |
| 839 | ); |
| 840 |
nothing calls this directly
no test coverage detected