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

Added check for number of arguments and nested objects' members #36

Merged
merged 3 commits into from
Dec 29, 2021

Conversation

dribeiro-ShardLabs
Copy link
Contributor

@dribeiro-ShardLabs dribeiro-ShardLabs commented Dec 27, 2021

Considering the cairo function:
func foo(a: felt) -> (res: felt): end

The following testing code samples with incorrect number of arguments should fail

contract.call("foo", { a: 1, b: 2 });
contract.call("foo"); 

In functions that take arrays as arguments, the array length is not considered as an argument.

Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra arguments (object keys) can appear in nested objects; that should be handled as well.

src/adapt.ts Outdated Show resolved Hide resolved
src/adapt.ts Outdated Show resolved Hide resolved
src/adapt.ts Outdated Show resolved Hide resolved
@dribeiro-ShardLabs dribeiro-ShardLabs changed the title Added check for number of arguments in invoke and calls, and new test… Added check for number of arguments and nested objects' members Dec 29, 2021
@dribeiro-ShardLabs dribeiro-ShardLabs merged commit df5a446 into master Dec 29, 2021
@FabijanC FabijanC deleted the report-extra-func-args branch February 7, 2022 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants