Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Replay RNG + seeding + logging #373

Draft
wants to merge 207 commits into
base: main
Choose a base branch
from
Draft

Replay RNG + seeding + logging #373

wants to merge 207 commits into from

Conversation

goastler
Copy link
Member

This PR comprises of:

  • the seed to provide rng to the contract
  • logging of dapps changes
  • logging of provider changes
  • rewind a dapp to a given block
  • rewind a provider to a given block
  • rewind the seed to a given block
  • replay the choose random active provider mechanism
  • check a provider was chosen during a provider commit

Technical notes:

  • I've switched from BTreeSet/BTreeMap to use Mapping instead. This comes with a very small amount of overhead when nothing happens on the contract for an extended amount of time, as more blocks have to be checked. However, this is trivial by comparison to the BTreeSet/BTreeMap solution as it added 30KB to the contract alone and pushed it above the 128K threshold, leading me to this solution instead. I also think the Mapping solution reduces gas slightly as only the storage we need to read it read, not the entire map/set in the BTree version.

Todo:

  • unit tests

goastler added 30 commits June 6, 2023 11:12
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant