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

Silo the first field of public logs #10273

Open
nventuro opened this issue Nov 28, 2024 · 4 comments
Open

Silo the first field of public logs #10273

nventuro opened this issue Nov 28, 2024 · 4 comments
Labels
C-avm Component: AVM related tickets (aka public VM) C-aztec.nr Component: Aztec smart contract framework team-bonobos

Comments

@nventuro
Copy link
Contributor

#10210 introduced siloing of the first field of private logs by having the private kernel hash it with the contract address. This is a very powerful primitive, as it cheaply lets contracts verify that a given log was indeed emitted by a certain contract, and so we can safely process them in order to do note discovery, message processing, etc.

However, this does not currently happen for logs emitted in public. encrypted_logs/payload.nr was modified to make partial note logs computed in private (which are only emitted in public) manually perform said siloing in the app, behaving as if the AVM was doing it. Even though we don't really need for public logs to have said siloing since they're public already and can be verified via alternative means, it'd be better if all logs looked the same, particularly when it comes to message delivery via tags (#9373) as not having this would mean we'd need to deal with multiple tagging schemes.

@nventuro nventuro added C-avm Component: AVM related tickets (aka public VM) C-aztec.nr Component: Aztec smart contract framework team-bonobos labels Nov 28, 2024
@LeilaWang
Copy link
Collaborator

Close as public logs are emitted with their contract addresses and don't need extra siloing.

@nventuro
Copy link
Contributor Author

Don't we want to do siloing regardless though? If we don't then public logs will have an extra field at the beginning, resulting in the tag being the second field, not the first, which is annoying. And when downloading logs by tag, we'd need to check if the log was emitted by the correct contract after downloading the log, because the tag has no siloing. This can result in other contracts spamming the tags we're looking for and resulting in a lot of wasted downloads and processing.

If we also siloed the tag by address, we'd a) save on field in all public logs, and b) avoid all of these issues by making public logs be that more similar to private logs.

@LeilaWang
Copy link
Collaborator

The previous reasoning was we had already emitted the contract address with a public log, and when fetching logs by tag, the result from public logs and private logs were processed separately. So it was easy to have one more check on the contract address of public logs. But you have a good point re spamming. We could maybe include the contract address in addition to the tag when querying public logs.

Re saving a field, there are regular public logs that don't contain a tag, so the siloing will force them to sacrifice the first field. But maybe we can remove the contract address of public log, and the developers will use a constant for the first field of a regular public log. Then they can later use this "tag" to query all public logs emitted from a specific contract. Although this is not standardized, so a dapp will need to keep track of the constants for all the contracts it wants to fetch regular public logs from, which can be a bit annoying.

What do you think? 🤔

@iAmMichaelConnor
Copy link
Contributor

Reopened, just because the conversation is clearly unresolved, and because I don't want to think about this subject just yet 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-avm Component: AVM related tickets (aka public VM) C-aztec.nr Component: Aztec smart contract framework team-bonobos
Projects
None yet
Development

No branches or pull requests

3 participants