Skip to content

Random oracle contracts#307

Merged
GabrielMartinezRodriguez merged 19 commits into
masterfrom
gabriel/drand-contract
Feb 4, 2025
Merged

Random oracle contracts#307
GabrielMartinezRodriguez merged 19 commits into
masterfrom
gabriel/drand-contract

Conversation

@GabrielMartinezRodriguez

@GabrielMartinezRodriguez GabrielMartinezRodriguez commented Dec 13, 2024

Copy link
Copy Markdown
Contributor

Linked Issues

Description

This PR aims to add the remaining logic to make the Random oracle contracts fully functional. The pending logic includes the submission of DRAND randomness and the implementation of a mechanism to combine our commitment/reveal contract with DRAND randomness.

More context:

Key changes:

  • Implemented the Drand verification contract.
  • Implemented Random contract to combine Drand and RandomCommitment functionalities.
  • Added two new environment variables.
  • Renamed the Random contract to RandomCommitment.
  • RandomCommitment now uses blocks instead of timestamps
  • Created a folder to house the three random-related contracts.
  • RandomCommitment and Drand are abstract contracts, which are extended by the Random contract.
Toggle Checklist

Checklist

Basics

  • B1. I have applied the proper label & proper branch name (e.g. norswap/build-system-caching).
  • B2. This PR is not so big that it should be split & addresses only one concern.
  • B3. The PR targets the lowest branch it can (ideally master).

Correctness

  • C1. Builds and passes tests.

  • C2. The code is properly parameterized & compatible with different environments (e.g. local,
    testnet, mainnet, standalone wallet, ...).

  • C3. I have manually tested my changes & connected features.

  • C4. I have performed a thorough self-review of my code after submitting the PR,
    and updated the code & comments accordingly.

Architecture & Documentation

  • D1. I made it easy to reason locally about the code, by (1) using proper abstraction boundaries,
    (2) commenting these boundaries correctly, (3) adding inline comments for context when needed.
  • D2. All public-facing APIs & meaningful (non-local) internal APIs are properly documented in code
    comments.
  • D3. If appropriate, the general architecture of the code is documented in a code comment or
    in a Markdown document.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Dec 13, 2024

Copy link
Copy Markdown

Deploying happychain with  Cloudflare Pages  Cloudflare Pages

Latest commit: d6eaecb
Status: ✅  Deploy successful!
Preview URL: https://37bc8364.happychain.pages.dev
Branch Preview URL: https://gabriel-drand-contract.happychain.pages.dev

View logs

@GabrielMartinezRodriguez GabrielMartinezRodriguez changed the title Add drand-based randomness implementation Add drand contract Dec 13, 2024
@GabrielMartinezRodriguez GabrielMartinezRodriguez marked this pull request as ready for review December 13, 2024 15:30
@linear

linear Bot commented Dec 13, 2024

Copy link
Copy Markdown
HAPPY-243 Drand Contract

Currently, we have only created the Random contract, which is used to submit random commitments. Now, we need to create the Drand contract, which is designed to submit randomness generated by https://drand.love. This randomness will then be combined with the submitted random commitments to produce a random number every two seconds

@GabrielMartinezRodriguez GabrielMartinezRodriguez changed the title Add drand contract Random contract with drand Dec 16, 2024
@GabrielMartinezRodriguez GabrielMartinezRodriguez added the reviewing-1 Ready for, or undergoing first-line review label Dec 16, 2024
@GabrielMartinezRodriguez GabrielMartinezRodriguez changed the title Random contract with drand Random Oracle contracts Dec 16, 2024
@GabrielMartinezRodriguez GabrielMartinezRodriguez changed the title Random Oracle contracts Random oracle contracts Dec 16, 2024
Comment thread packages/contracts/.env.example Outdated
Comment thread packages/contracts/src/Randomness/Random.sol Outdated
Comment thread packages/contracts/src/Randomness/Drand.sol
Comment thread packages/contracts/src/Randomness/Drand.sol Outdated
Comment thread packages/contracts/src/Randomness/Drand.sol Outdated
Comment thread packages/contracts/src/Randomness/Drand.sol
Comment thread packages/contracts/src/Randomness/Drand.sol Outdated
Comment thread packages/contracts/src/Randomness/Drand.sol
Comment thread packages/contracts/src/Randomness/Random.sol Outdated
Comment thread packages/contracts/src/Randomness/Random.sol Outdated
Comment thread packages/contracts/src/deploy/DeployRandom.s.sol Outdated
Comment thread packages/contracts/src/Randomness/RandomCommitment.sol
Comment thread packages/contracts/src/deploy/DeployRandom.s.sol
Comment thread packages/contracts/src/deploy/DeployRandom.s.sol
Comment thread packages/contracts/src/deploy/DeployRandom.s.sol Outdated
Comment thread packages/contracts/.env.example Outdated
Base automatically changed from gabriel/purge-only-finalized to master February 4, 2025 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-blocked Ready to merge, waiting for downstack

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants