Skip to content

multiindex key definition - footgun #83

@PFC-developer

Description

@PFC-developer

I am having an issue with CW-storage-plus. (thanks to Eris/Phil @0xphilipp for pointing it out)
I have managed to produce an example which demonstrates it here - testcase

I have a key which is a (u64,&str) .. and it works ok, until I put in a u64 > 128, and it then gives a UTF-8 error

how do I remedy this.

is there a way to do this without migrating the index in the existing smart contract
the error returned is as follows

called `Result::unwrap()` on an `Err` value: InvalidUtf8 { msg: "invalid utf-8 sequence of 1 bytes from index 9" }
thread 'testing::tests::test_128' panicked at contracts/hub-tf/src/testing/tests.rs:2100:10:

this was due to a multiindex signature not being defined properly.
the following patch to the test case resolves it.

the issue is here as I think this should have resulted in a compile error (the PK was badly defined in the original case), but it wasn't.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions