-
Notifications
You must be signed in to change notification settings - Fork 282
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
refactor: read function names from contract classes #10753
Conversation
894542d
to
cf05dc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good, but note that the function name never makes it to the node. I'm fine removing the artifact to reduce memory usage, but note that this will mean we won't have function names available.
What we need to do to support that is convert the function selectors into function names on the client, where we do have the artifact.
yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts
Outdated
Show resolved
Hide resolved
yarn-project/archiver/src/archiver/kv_archiver_store/kv_archiver_store.ts
Outdated
Show resolved
Hide resolved
yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts
Outdated
Show resolved
Hide resolved
yarn-project/archiver/src/archiver/memory_archiver_store/memory_archiver_store.ts
Outdated
Show resolved
Hide resolved
d202708
to
72a9a67
Compare
Refactored it so the archiver keeps a mapping from selector->function name rather than using the class registration event |
// TODO: Node should validate the artifact before accepting it | ||
return this.contractDataSource.addContractArtifact(address, artifact); | ||
public registerContractFunctionNames(_address: AztecAddress, names: Record<string, string>): Promise<void> { | ||
return this.contractDataSource.registerContractFunctionNames(names); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of having the caller pass the selector and name, I think it'd be best if they pass the full function signature, so the server computes the selector from it and extracts the name. This way we don't risk a malicious user overwriting valid selectors with trash.
And I'm fine pushing this for later, so feel free to create an issue instead of addressing now.
Co-authored-by: Santiago Palladino <santiago@aztecprotocol.com>
ede179d
to
32246b3
Compare
This PR removes contract artifacts from the archiver as they were only used for dubugging purposes. Function names are now (optionally) emitted when registereing contract classes.
I have created #10752 to remove function names from the contract class once we don't need this debug information