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

Improve calldata in verification requests #14

Open
dndll opened this issue Feb 20, 2024 · 1 comment
Open

Improve calldata in verification requests #14

dndll opened this issue Feb 20, 2024 · 1 comment

Comments

@dndll
Copy link
Member

dndll commented Feb 20, 2024

Users next highest cost would be the calldata of proof verification/relay for the verification circuit. This issue is due to the static size nature of the circuit, we have to allocate some padded data to allow us to use account_ids. For example:

For requesting proofs, we need an array of:

pub struct TransactionOrReceiptIdVariable {
    pub is_transaction: BoolVariable, // 1 byte
    pub id: CryptoHashVariable, // 32 bytes, this is fine
    pub account: AccountIdVariable, // 64, since MAX_LEN of account is 64, whilst in practice this is never true.
}

Thoughts:

  • do we even need an account for the sender/receiver? << in some cases not, for NearDA where the contract will always be the same, we can omit this if we only prove receipts. There is no real requirement to prove transactions for NearDA since the blob is in the receipt and we can't scale the input size beyond ~4.1mb. If we can do this in an external layer without coupling to the light client this would be a nice way to omit 2/3 of calldata.
  • can we take dynamic inputs? << this might allow us to be clever in the inputs we handle and expand them in-circuit instead.
  • can be optimised with queue draining system

The results are:

pub struct ProofVerificationResultVariable {
    pub id: CryptoHashVariable,
    pub result: BoolVariable,
}
@dndll
Copy link
Member Author

dndll commented Mar 6, 2024

Likely this is a 0% corner case, deprioritise

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

No branches or pull requests

1 participant