Proxy contract not in inputs error, but it IS in the inputs?

I’m beginning to make all my contracts proxy upgradeable. I’m starting with the borrow_operations contract wrapping the Contract in a ContractInstance struct. Here you can see that the contract not in inputs is actually in the inputs so not sure what’s going on here.

pub struct ContractInstance<C> {
    pub contract: C,
    pub implementation_id: ContractId,
}

impl<C> ContractInstance<C> {
    pub fn new(contract: C, implementation_id: ContractId) -> Self {
        Self {
            contract,
            implementation_id,
        }
    }
}
 pub async fn register_asset<T: Account>(
        protocol_manager: &ProtocolManager<T>,
        asset: AssetId,
        trove_manager: ContractId,
        oracle: ContractId,
        borrow_operations: &ContractInstance<BorrowOperations<T>>,
        stability_pool: &StabilityPool<T>,
        usdf: &USDFToken<T>,
        fpt_staking: &FPTStaking<T>,
        coll_surplus_pool: &CollSurplusPool<T>,
        default_pool: &DefaultPool<T>,
        active_pool: &ActivePool<T>,
        sorted_troves: &SortedTroves<T>,
    ) -> Result<CallResponse<()>, Error> {
        let tx_params = TxPolicies::default().with_tip(1);
        println!("impl: {:?}", borrow_operations.implementation_id);
        println!("contract: {:?}", borrow_operations.contract.contract_id());
        protocol_manager
            .methods()
            .register_asset(asset.into(), trove_manager, oracle)
            .with_tx_policies(tx_params)
            .with_contracts(&[
                &borrow_operations.contract,
                stability_pool,
                usdf,
                fpt_staking,
                coll_surplus_pool,
                default_pool,
                active_pool,
                sorted_troves,
            ])
            .with_contract_ids(&[borrow_operations.implementation_id.into()])
            .call()
            .await
    }

I get this error here:

impl: a2f9663fb4de16415ac5a3441e2e660250756605bec210e5ca57b134cc305f99
contract: Bech32ContractId { hrp: "fuel", hash: 848b4a42d552a48e0248f47415448e25b91b8e140c398caceefd87fc735f1fb3 }

thread 'proper_creating_trove' panicked at test-utils/src/setup.rs:983:10:
called `Result::unwrap()` on an `Err` value: Transaction(Reverted { reason: "ContractNotInInputs", revert_id: 0, receipts: [Call { id: 0000000000000000000000000000000000000000000000000000000000000000, to: df80b432b851f8558a949e75a755919329b403febab5328f80b8147085e5edde, amount: 0, asset_id: 0000000000000000000000000000000000000000000000000000000000000000, gas: 10133, param1: 10480, param2: 10502, pc: 12024, is: 12024 }, Panic { id: df80b432b851f8558a949e75a755919329b403febab5328f80b8147085e5edde, reason: 

PanicInstruction { reason: ContractNotInInputs, instruction: CALL { target_struct: 0x10, fwd_coins: 0x0, asset_id_addr: 0x11, fwd_gas: 0x12 } (bytes: 2d 40 04 52) }, pc: 73892, is: 12024, 

contract_id: Some(848b4a42d552a48e0248f47415448e25b91b8e140c398caceefd87fc735f1fb3) }, ScriptResult { result: Panic, gas_used: 10104 }] })
stack backtrace:

Topic discussion checklist

  • Run $ fuelup show and add the output below
  • Detailed steps to recreate issue
  • Link full scope of the codebase pertaining to your issue
  • Any other relevant information

Fix was adding the proxy to the with_contract_ids as well

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.