Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: error handling in factory contracts #6

Open
machuwey opened this issue Nov 3, 2024 · 27 comments · May be fixed by #17
Open

feat: error handling in factory contracts #6

machuwey opened this issue Nov 3, 2024 · 27 comments · May be fixed by #17
Assignees

Comments

@machuwey
Copy link
Collaborator

machuwey commented Nov 3, 2024

Improve error handling in factory contract

Consider something like:

mod Errors {
    #[error_code]
    enum FactoryError {
        AddressZeroOwner = 0,
        UnAuthorizedCaller = 1,
        DeploymentFailed = 2,
        // Add more as needed
    }
}

Instructions to apply

  1. Introduce yourself, tell about your background, etc.
  2. Describe shortly how you plan to tackle the issue
@machuwey machuwey changed the title Cairo errors feat: error handling in factory contracts Nov 3, 2024
@machuwey machuwey added good first issue Good for newcomers cairo labels Nov 3, 2024
@sandragcarrillo
Copy link

Hi, I would like to contribute to solve this issue. I have been learning Cairo and I think I have the knowledge to solve it

@martinvibes
Copy link

hey @machuwey i would love to work on this issue when the ODhack starts
i have worked on error handling/custom errors before

@Krishn1412
Copy link

Is this issue still available?

@wheval
Copy link

wheval commented Nov 19, 2024

Hello @machuwey, May I handle this issue? I'm a Cairo developer

@petersdt
Copy link

@machuwey can i handle this task

@Akshola00
Copy link

I'd be happy to do this.

@Akshola00
Copy link

im a blockchian dev and i would like to work on this issue. can I be assigned to this

@SoarinSkySagar
Copy link
Contributor

May I work on this issue @machuwey ?

My background: I am a web3 developer with 2 years of experience and a regular contributor at @keep-starknet-strange. I have been solving issues related to cairo for the past 2 months and I'm pretty confident that I can resolve this issue too.

My approach: I would create a new struct as you showed the example of, review the entire codebase to handle all types of errors.

eta: 3 days

@Joe-joe25
Copy link

Could I be assigned to this?

@ryzen-xp
Copy link

Hi, I am proficient Blockchain developer expert in Cairo , Rust ,Solidity and web development.
Implement an Errors module with enumerated error codes, integrate them into the contract functions, and test thoroughly.
please /assign this issue .
Thank You

@mexes20
Copy link

mexes20 commented Nov 21, 2024

@mexes20
Copy link

mexes20 commented Nov 21, 2024

Can I tackle this one? I'm a Software developer with over three years experience.

I plan to properly go through the code and improve the error handling in factory contracts.

@Mystic-Nayy
Copy link

I'd be happy to do this.
I am web3 developer with alot of exprience in cairo
I will improve error handling in factory contract, considering the example above

@Benjtalkshow
Copy link

Can I be assigned to this?

@omsant02
Copy link

omsant02 commented Nov 21, 2024

I am Om Santoshwar,
Final year btech UG at IIT Dhanbad,
i have a strong background in web development and blockchain development particularly in Ethereum and Starknet with 3 years of software development experience.

My Technical Skills-
Languages: Typescript, Javascript, Solidity, Rust, Cairo, C++
Frameworks and tools: Scaffold-eth/Stark, Nextjs, MERN, Ethersjs, Hardhat, Foundry, Openzeppelin contracts, Defi, AWS

Experience-
Participated in EthGlobal and other blockchain hackathons
Internships as Blockchain and Fullstack web developer

would solve this issue by using custom error that returns specific error messages for each enum case

@ShantelPeters
Copy link

ShantelPeters commented Nov 21, 2024

May I handle this issue?
I am a web3 developer with strong experience in Cairo
I would tackle this issue by doing the following:

I will enhance error handling in the factory contract, define a custom error enum 'FactoryError' with specific error codes using the '#[error_code]' attribute, and replace generic errors with 'FactoryError' variants, such as AddressZeroOwner, UnAuthorizedCaller, DeploymentFailed, InvalidContractAddress, and others, to provide clearer error messages, standardized error handling, and improved contract security and reliability."

@Ekene001
Copy link

Hi, I'm Ekene, a frontend and blockchain developer, and I’m new to the OnlyDust platform. This is my first time contributing to this repository, and I’m excited about the opportunity to collaborate and bring my skills to the table.

To tackle this issue: I will implement a more structured approach using custom error codes. I will create an Errors module with an enum, such as FactoryError, where each error type will have its own code. For instance, I will define errors like AddressZeroOwner if the owner address is zero, UnAuthorizedCaller for unauthorized access, and DeploymentFailed if the contract deployment fails.

By using custom error codes, I will make it easier to identify and track issues. These error codes will be tagged with #[error_code], ensuring they are clear and manageable. I will then go through the contract’s functions and replace generic error handling with these specific codes.
I will also ensure that these error codes are logged in events, which will make debugging easier. After implementing these changes, I will thoroughly test the contract to ensure all errors are handled correctly.

@MrRoudyk
Copy link

I'd be happy to do this.

@Michaelkingsdev
Copy link

Could I take on this issue?

@Aditya-040
Copy link

Is this issue still available?
I am a full stack developer and have experience in solidity dapp development and currently learning cairo.
To improve error handling in the factory contract I will expand the Errors module to include all possible error scenarios, ensuring each error has a unique and descriptive code.

@Amarjeet325
Copy link

Let me handle this issue!

@bruhhgnik
Copy link

Im agnik, a pytho dev, i also have experience with linux development and CI/CD, im learning cairo too, would love to take on this issue!

@vestor-dev
Copy link

hey sir I'd like to handle this task.
i'm a frontend developer and a blockchain dev
i would really love to contribute to your project
please kindly assign :)

@Supa-mega
Copy link

Is it okay if I take this?

@od-hunter
Copy link

Hello, can I be assigned this issue? My experience includes html, css, react, javaScript, typescript, solidity & Cairo.

To solve this issue, I'll take the following the steps:

  1. I'll create a module Errors containing an enum FactoryError for all error cases. I'll use unique codes for errors (e.g., AddressZeroOwner = 0)
  2. I'll return Result<T, FactoryError> for functions and use Err(FactoryError::) in failure scenarios.
  3. I'll implement a helper method (e.g., to_message()) to map errors to human-readable strings for debugging or UI integration.
  4. I'll test for error scenarios to ensure the correct FactoryError is returned for invalid cases.
  5. Lastly, I'll ensure all contract functions use the FactoryError enum for consistent error handling and then replace existing error logic with the new structure.

Kindly assign me please, I'm ready to work.

@aniruddhaaps
Copy link

Hey @machuwey, Aniruddha here. So I'm a typescript dev and also contributed in last odHack. Want to take up the issue and solve right away.

Improve the factory contract error handling: Develop a centralized module entitled Errors, holding all possible failure scenarios with descriptive and unique error codes. Develop good checks against a general failure case, like zero-address owners, incorrect callers, and failures of deployment. Return meaningful error messages that will be useful for debugging and user feedback in case of errors.

@Ekene001
Copy link

@machuwey Thank you for this opportunity, I will make a PR soon

@Ekene001 Ekene001 linked a pull request Nov 30, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.