NethermindEth / starknet-remix-plugin

A plugin that brings Starknet to Remix! 🐺 ⭐
https://remix.ethereum.org/?#activate=Starknet
Apache License 2.0
42 stars 29 forks source link

Error when deploying simple Constructor example #274

Open stranger80 opened 1 month ago

stranger80 commented 1 month ago

Compile and declare following contract. Then deploy with any parameters - transaction gets REVERTED.

#[starknet::contract]
pub mod ExampleConstructor {
    use starknet::ContractAddress;
    use starknet::storage::Map;

    #[storage]
    struct Storage {
        names: Map::<ContractAddress, felt252>,
    }

    // The constructor is decorated with a `#[constructor]` attribute.
    // It is not inside an `impl` block.
    #[constructor]
    fn constructor(ref self: ContractState, name: felt252, address: ContractAddress) {
        self.names.write(address, name);
    }
}
ShantelPeters commented 1 month ago

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi @stranger80 please can I be assigned to this issue ?

How I plan on tackling this issue

I will approach this issue by: Modifying my starknet contract by wrapping the constructor within an impl ExampleConstructor block,updating ref self:ContractStateto &mut self,and adding . unwrap() to handle potential write errors.Then depoly the contract using the Skarknet CLI command

stranger80 commented 1 month ago

I will approach this issue by: Modifying my starknet contract by wrapping the constructor within an impl ExampleConstructor block,updating ref self:ContractStateto &mut self,and adding . unwrap() to handle potential write errors.Then depoly the contract using the Skarknet > CLI command

No, the issue most likely is within the plugin itself, not with the Cairo code. The code copied above is correct, and the contract should deploy correctly. You may try to deploy it via starkli to verify.

Do you still want to try and tackle this, @ShantelPeters ?

ShantelPeters commented 1 month ago

I will approach this issue by: Modifying my starknet contract by wrapping the constructor within an impl ExampleConstructor block,updating ref self:ContractStateto &mut self,and adding . unwrap() to handle potential write errors.Then depoly the contract using the Skarknet > CLI command

No, the issue most likely is within the plugin itself, not with the Cairo code. The code copied above is correct, and the contract should deploy correctly. You may try to deploy it via starkli to verify.

Do you still want to try and tackle this, @ShantelPeters ?

Yes I would want to give it a try.

stranger80 commented 1 month ago

OK, pls hold short until next week, we're running with investigation which may turn this into a non-issue

stranger80 commented 1 week ago

Fixed by https://github.com/NethermindEth/starknet-remix-plugin/pull/275