refactor: read function names from contract classes#10753
Conversation
894542d to
cf05dc7
Compare
spalladino
left a comment
There was a problem hiding this comment.
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.
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
Implements the suggestion here #10753 (comment)
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