MCPcopy Create free account
hub / github.com/consensus-shipyard/ipc / create_root_genesis

Method create_root_genesis

fendermint/testing/materializer/src/testnet.rs:229–256  ·  view source on GitHub ↗

Create a genesis for the rootnet nodes. On the rootnet the validator power comes out of thin air, ie. the balances don't have to cover it. On subnets this will be different, the collateral has to be funded.

(
        &mut self,
        m: &mut R,
        subnet_name: &SubnetName,
        validators: CollateralMap,
        balances: BalanceMap,
        ipc_contracts_owner: &ResourceId,
    )

Source from the content-addressed store, hash-verified

227 /// ie. the balances don't have to cover it. On subnets this
228 /// will be different, the collateral has to be funded.
229 fn create_root_genesis(
230 &mut self,
231 m: &mut R,
232 subnet_name: &SubnetName,
233 validators: CollateralMap,
234 balances: BalanceMap,
235 ipc_contracts_owner: &ResourceId,
236 ) -> anyhow::Result<()> {
237 let validators = self
238 .account_map(validators)
239 .context("invalid root collaterals")?;
240
241 let balances = self
242 .account_map(balances)
243 .context("invalid root balances")?;
244
245 let ipc_contracts_owner = self
246 .account(ipc_contracts_owner)
247 .context("invalid ipc contract owner")?;
248
249 // Remember the genesis so we can potentially create more nodes later.
250 let genesis =
251 m.create_root_genesis(subnet_name, validators, balances, ipc_contracts_owner)?;
252
253 self.genesis.insert(subnet_name.clone(), genesis);
254
255 Ok(())
256 }
257
258 /// Configure and start the nodes of a subnet.
259 ///

Callers 1

Calls 4

contextMethod · 0.80
account_mapMethod · 0.80
accountMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected