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

Method ensure_unique

fendermint/testing/materializer/src/validation.rs:85–97  ·  view source on GitHub ↗

Ensure we aren't reusing references.

(
        &mut self,
        subnet: &SubnetName,
        reference: Option<ResourceHash>,
    )

Source from the content-addressed store, hash-verified

83
84 /// Ensure we aren't reusing references.
85 fn ensure_unique(
86 &mut self,
87 subnet: &SubnetName,
88 reference: Option<ResourceHash>,
89 ) -> anyhow::Result<()> {
90 if let Some(r) = reference {
91 let rs = self.references.entry(subnet.clone()).or_default();
92 if !rs.insert(r) {
93 bail!("a reference is reused in {subnet:?}");
94 }
95 }
96 Ok(())
97 }
98
99 /// Check that an account has a positive balance on a subnet
100 fn ensure_balance(&self, subnet: &SubnetName, account: &AccountName) -> anyhow::Result<()> {

Callers 3

fund_from_faucetMethod · 0.80
fund_subnetMethod · 0.80
join_subnetMethod · 0.80

Calls 1

insertMethod · 0.45

Tested by

no test coverage detected