starknet-foundry icon indicating copy to clipboard operation
starknet-foundry copied to clipboard

Always use data transformer unless `--calldata` is passed

Open cptartur opened this issue 1 year ago • 24 comments

Currently, in the calldata serialization logic in sncast we only try to use data transformer if --arguments flag is prezent. If not, and no --calldata was provided, an empty vec is used as calldata and the transaction fails after execution attempt.

The logic should be changed, so if no --arguments flag is provided, data transformer is called but with an empty vec. This way instead of provider (starknet) error, the user will be shown a nice, data transformer error.

In https://github.com/foundry-rs/starknet-foundry/blob/8ce451e58b1305f7e6769451a18412970157dc1a/crates/sncast/src/main.rs#L168 update the logic, so Ok(vec![]) fallback is removed. If calldata is some, use it, otherwise always call Calldata::new(arguments).serialized(contract_class, selector) and, if not arguments were provided by the user, provide empty vec![] as arguments.

Additionaly, introduce an e2e test verifying that even if no --arguments or --calldata is provided and a called contract expects calldata, relevant error from data transformer (Calldata::new(arguments).serialized(contract_class, selector)) is displayed and/or update any relevant existing tests.

cptartur avatar Dec 06 '24 16:12 cptartur

@cptartur hey I would like to work on this .

Avinash-kumar-82 avatar Dec 23 '24 13:12 Avinash-kumar-82

Hey, this issue will be available for taking during the ODBoost https://app.onlydust.com/hackathons/odboost-1. If you are still interested in tacking on this one, please apply after the ODBoost start tomorrow after 3 PM CET.

cptartur avatar Jan 21 '25 11:01 cptartur

Can I contribute to this one?

olisaagbafor avatar Jan 21 '25 17:01 olisaagbafor

Can I contribute to this one?

danielrobotz avatar Jan 22 '25 14:01 danielrobotz

Would love do this.

emarc99 avatar Jan 22 '25 15:01 emarc99

Is it okay if I take this?

ussyalfaks avatar Jan 22 '25 15:01 ussyalfaks

I’d like to help with this.

Dhanraj30 avatar Jan 22 '25 16:01 Dhanraj30

Application for Contribution

I am excited about the opportunity to contribute to this issue and am confident that my expertise aligns well with the requirements. With a strong background in Cairo programming and decentralized application development on StarkNet, I bring a well-rounded skill set to deliver an effective solution.

Relevant Expertise

  • Blockchain & Smart Contracts: Extensive experience with StarkNet, Stellar, and Rust, specializing in developing secure and optimized smart contracts, blockchain integrations, and high-performance backend infrastructure.
  • Backend Development: Well-versed in API design, server-side logic, and scalable system architecture, ensuring efficient and seamless backend performance.
  • Frontend Engineering: Skilled in crafting interactive and responsive UI components using React and Next.js, enhancing the user experience for blockchain-based platforms.

Why Consider My Application?

My proven track record of delivering high-quality, optimized solutions in blockchain and full-stack development sets me apart. I have a deep understanding of smart contract security, decentralized architectures, and the synergy between frontend, backend, and blockchain layers—ensuring a seamless and efficient implementation.

ETA

I expect to have a working solution ready within 48 hours. Please let me know if I can proceed with the implementation.

1nonlypiece avatar Jan 23 '25 03:01 1nonlypiece

Is it okay if I take this?

ekumamatthew avatar Jan 27 '25 14:01 ekumamatthew

Hey @emarc99 assigning to you. If you are no longer interesed in taking on this one, please let me know.

cptartur avatar Jan 28 '25 11:01 cptartur

Thanks for the opportunity to do this. I am definitely taking this, sir!

emarc99 avatar Jan 28 '25 12:01 emarc99

@emarc99 okay, please open a draft PR soon.

cptartur avatar Jan 29 '25 16:01 cptartur

@emarc99 please open a (draft) PR today or we'll have to remove the assignment due to inactivity.

cptartur avatar Jan 31 '25 09:01 cptartur

@emarc99 removing assignment due to inactivity.

cptartur avatar Jan 31 '25 15:01 cptartur

I'm still working, sir. Thouht you meant EoD today?

emarc99 avatar Jan 31 '25 15:01 emarc99

Currently running tests.

emarc99 avatar Jan 31 '25 15:01 emarc99

Mind if I take this issue?

wengDavo avatar Jan 31 '25 21:01 wengDavo

Can I have this issue? I plan to implement a implement calldata is some check before passing an empty vec as args

RichoKD avatar Feb 01 '25 13:02 RichoKD

Can I try solving this issue?

Kingsuite avatar Feb 01 '25 16:02 Kingsuite

Could I try solving this?

tasneemtoolba avatar Feb 02 '25 12:02 tasneemtoolba

@cptartur , apologies for not showing activities, running the e2e tests under sncast directory alone takes 2 hours on my PC (WSL linux). 25 tests unrelated to calldata or argument in the sncast kept failing. While debugging, I have almost maxed out my February allocated github codespace usage (>75%). So, I am treading carefully on my PC. I will appreciate you reviewing my new PR that will be opened when I successfully achieved the feature, in the case you have not reassigned the issue.

Kindly signify if I should not bother handling this issue anymore, thanks. 👍

emarc99 avatar Feb 05 '25 17:02 emarc99

Can I take this issue? first time contributor

Supa-mega avatar Feb 06 '25 14:02 Supa-mega

@cptartur , apologies for not showing activities, running the e2e tests under sncast directory alone takes 2 hours on my PC (WSL linux). 25 tests unrelated to calldata or argument in the sncast kept failing. While debugging, I have almost maxed out my February allocated github codespace usage (>75%). So, I am treading carefully on my PC. I will appreciate you reviewing my new PR that will be opened when I successfully achieved the feature, in the case you have not reassigned the issue.

Kindly signify if I should not bother handling this issue anymore, thanks. 👍

@emarc99 we will gladly accept a contribution that is working (i.e. all tests are passing and relevant changes were introduced). Please note, this would not count as an ODBoost contribution.

cptartur avatar Feb 06 '25 15:02 cptartur

Alright. Duly noted.

emarc99 avatar Feb 06 '25 18:02 emarc99