Skip to content

Paseo AssetHub Contract Trapped Error #2759

@nikania

Description

@nikania

I have this contract

#![cfg_attr(not(feature = "std"), no_std, no_main)]

#[ink::contract]
mod stvec {

    use ink::U256;
    use ink::storage::StorageVec;
    #[ink(storage)]
    pub struct Stvec {
        value: StorageVec<U256>,
    }

    impl Stvec {
        #[ink(constructor)]
        pub fn new() -> Self {
            Self {
                value: StorageVec::new(),
            }
        }

        #[ink(message)]
        pub fn push(&mut self, value: U256) {
            self.value.push(&value);
        }

        #[ink(message)]
        pub fn pop(&mut self) -> Option<U256> {
            self.value.pop()
        }

        #[ink(message)]
        pub fn get(&self, index: u32) -> Option<U256> {
            self.value.get(index)
        }

        #[ink(message)]
        pub fn clear(&mut self) {
            self.value.clear();
        }

        #[ink(message)]
        pub fn clear_and_push(&mut self, value: U256) {
            self.value.clear();
            self.value.push(&value);
        }
    }
}

If I deploy that on Paseo Asset Hub(not passet hub) and I perform push() function and clear_and_push() after that - I get an Error Contract trapped during execution

That does not reproduce on local ink! node

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