Comments (6)
Thank you very much for the opportunity @glihm . I will consider your suggestions and will reach out if I have any questions.
from dojo.
I am applying to this issue via OnlyDust platform.
My background and how it can be leveraged
Hello, I’m Jose Mario from Costa Rica. With over 15 years of experience in development, I am passionate about contributing to open-source projects and currently expanding my skill set with Rust, Cairo, and Solidity as part of my involvement with Dojo Coding. My recent role as a Senior Backend Developer allowed me to specialize in a range of technologies including Node.js, JavaScript, TypeScript, Docker, among many others. I am eager to apply my extensive experience and newly acquired skills to new challenges and innovative projects.
How I plan on tackling this issue
- Enhance error handling by defining specific error types that provide detailed context about issues. Instead of using a generic ContractError, create custom error types adapted to different failure scenarios
- Incorporate functionality similar to Scarb to issue warnings during the compilation process when unsupported functions, such as print, are detected. Implement pre-compilation checks or extend the compiler to identify and alert developers about the use of unsupported features, ensuring that these issues are addressed before deploying to the network.
from dojo.
I am applying to this issue via OnlyDust platform.
My background and how it can be leveraged
With 3 years of solid experience in JavaScript, TypeScript, and React, I have developed a strong proficiency in creating intuitive and visually appealing user interfaces. My work on various projects, including browser extensions, has provided me with valuable insights into enhancing user experience and ensuring responsiveness across different devices. I am currently expanding my skill set by learning Rust, which is broadening my understanding of systems programming and performance optimization. Here is my github profile https://github.com/devcollinss
https://app.onlydust.com/u/devcollinss
How I plan on tackling this issue
Note: The code provided above might not be the exact code I will be using. Adjustments may be made based on further review and testing.
I will address the issue by modifying the code to handle contract errors and network compatibility more effectively. Here’s the detailed approach:
For the Error Handling
I will modify the error handling in account.rs to provide clearer and more actionable error messages for unsupported contract functions. The updated code will check for specific error messages and provide guidance on network compatibility issues:
StarknetError::ContractError(err) => {
let error_message = err.revert_error.trim();
if error_message.contains("print") || error_message.contains("syscall") {
anyhow::anyhow!(
"ContractError: This contract may contain functions not supported on the current network. \
Please ensure your code is compatible with the target network. \
Error: {}",
error_message
)
} else {
anyhow::anyhow!("ContractError: {}", error_message)
}
}
For Network Compatibility
I will implement an asynchronous function to check network compatibility when deploying. This function will log relevant information about the target network and provide warnings if the network is unknown or if certain functions may not be supported:
async fn check_network_compatibility(provider: &JsonRpcClient<HttpTransport>) -> Result<()> {
let chain_id = provider.chain_id().await?;
match NETWORK_INFO.get(&chain_id) {
Some(network_name) => {
eprintln!("Deploying to {} (chain ID: {})", network_name, chain_id);
}
None => {
eprintln!(
"Warning: Deploying to an unknown network (chain ID: {}). \
Please ensure your code is compatible with this network.",
chain_id
);
}
}
eprintln!("Note: Some functions (e.g., 'print') may not be supported on public networks.");
Ok(())
}
from dojo.
@jsanchez556 all yours, let's know if you have any question before starting.
I didn't look yet exactly how Scarb emits this warning, you may want to check Scarb repo before starting something. :)
from dojo.
How are you doing on this @jsanchez556? Any update?
from dojo.
Hi @glihm, I'm still working on the ticket. However, I have a few questions. I'm not sure if you prefer to DM on the Dojo's Discord, tg or if you would rather communicate here?
- Is it possible to test my local changes using the spawn-and-move example?
- Can I reproduce the error by modifying the Cairo files within the spawn-and-move example to include prints? I tried adding some print in the actions.cairo file, but it didn’t work
from dojo.
Related Issues (20)
- Sozo init should clone the correct version of starter template HOT 2
- ci: Github Action for `cargo-udeps` failed
- Torii client compile error when importing v1.0.0-alpha.3 release HOT 2
- feat(world): make fields as keys in events where possible HOT 2
- katana: expose db metrics
- Update sozo with latest account_sdk
- Sozo controller deployment flow
- Events annotated by `#[dojo::event]` are not annotated as event in ABI HOT 1
- Expose `resources` map in world API HOT 5
- feat(sozo): require manual confirmation from user before sending transaction if any anomaly is detected HOT 8
- [torii] Benchmarks HOT 1
- [torii-core] `pending_block_tx_cursor` logic doesn't work as expected HOT 1
- ci: Github Action for `cargo-udeps` failed HOT 1
- testing: dump state and initialize katana from dumped state for test runner HOT 2
- [BUG] `sozo init` command no longer works as documented HOT 4
- katana: separate node services (ie block production, messaging) into their own tasks
- ci: Github Action for `cargo-udeps` failed
- feat: add a systems list in the contract manifest entry
- katana: put `katana` api under dev mode
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dojo.