andromedaprotocol/andromeda-core

[RC] ADO Type Storage Inconsistency

Closed this issue · 0 comments

Describe the bug

Currently there is an inconsistency in how u64 values are stored in a cw-storage-plus::Map, meaning that when we use a direct query to access these values they do not return consistent results per chain.

Error Code

The erroneous code is in the AOSQuerier here:

    pub fn ado_type_getter(
        querier: &QuerierWrapper,
        adodb_addr: &Addr,
        code_id: u64,
    ) -> Result<Option<String>, ContractError> {
        let key = AOSQuerier::get_map_storage_key("ado_type", &[&code_id.to_be_bytes()])?;
        let ado_type: Option<ADOVersion> = AOSQuerier::query_storage(querier, adodb_addr, &key)?;
        Ok(ado_type.map(|v| v.get_type()))
    }

When replacing this method with the similar ado_type_getter_smart the issue is resolved, however this is far less efficient and less reliable.

To Reproduce

Steps to reproduce the behavior:

  1. Deploy the current RC OS contracts on Stargaze
  2. Attempt to create an App

Expected behavior

Consistency in the mapping between code ID and ADO type across all chains and ability to deploy an app appropriately.

Environment (please complete the following information)

  • Stargaze

Additional context

It may be a case of simply swapping u64 for String in the mapping.

This will not happen in integration tests as the storage mechanism is consistent in cw-multi-test.