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

(contracts): suite of contracts that attesters can inherit for functionality #287

Open
vimwitch opened this issue Jan 15, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vimwitch
Copy link
Member

We should build contracts that attesters can inherit to easily get certain functionality. Some things I think would be useful:

1. Contract that re-imburses the cost of executing attestations from a budget

An attester could inherit this contract to allow callers to be reimbursed. This would make publicly funding the operation of attesters more modular and transparent. e.g. an attester could directly get operation funding from a gitcoin round.

2. Contract that establishes an ether bridge

An attester could inherit this contract to allow epoch keys to receive ether. This would require 2 user data fields to be reserved for balance tracking (could potentially be 1 field with two 128 bit subfields). The contract could expose the following:

  • transferTo(uint epochKey) payable
  • transferFrom(uint[] memory publicSignals, uint[8] proof)

e.g. ethereum addresses can send funds to epoch keys and epoch keys can send funds to ethereum addresses and other epoch keys.

3. Epoch key safety

An attester could inherit this contract to track which epoch keys have been proven to exist in which epoch. This would allow epoch key proofs to be re-used more safely/easily.

e.g. when an epoch key is proved to exist in an epoch, a mapping is updated

mapping (uint => uint) epochKeyEpoch

function proveEpochKey(uint[] memory publicSignals, uint[8] memory proof) {
  verifyProof(publicSignals, proof);

  uint epochKey = publicSignals[2];
  uint epoch = publicSignals[3];
  epochKeyEpoch[epochKey] = epoch;
}

Epoch keys are globally unique so each epoch key has 1 epoch. If/when this is revealed we cache it. When an attestation is made to an epoch key we check the cache to make sure it has been proven to exist in the target epoch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants