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

utils.ts: dont match parameters in constructor name check #351

Merged
merged 1 commit into from
May 3, 2023

Conversation

cfal
Copy link
Contributor

@cfal cfal commented May 2, 2023

when a function name is contained in any part of the constructor parameter name, it is incorrectly selected as the constructor, eg:

#[constructor]
fn constructor(first_owner: ContractAddress) {
...
}

#[view]
fn owner() -> ContractAddress {
  _owner::read()
}

there is then an ABI map entry with key owner that ends up getting matched to the owner substring of first_owner, which causes it to get selected as the constructorAbi in the StarknetContractFactory constructor if it is encountered before the real constructor.

this replaces the includes() check with a regexp that should only match function names.

@FabijanC FabijanC self-requested a review May 2, 2023 15:37
@FabijanC FabijanC merged commit 31b1c1b into 0xSpaceShard:master May 3, 2023
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.

2 participants