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

Standard hash to generate index of contract being snapshotted #65

Open
anomit opened this issue Oct 7, 2024 · 1 comment
Open

Standard hash to generate index of contract being snapshotted #65

anomit opened this issue Oct 7, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@anomit
Copy link
Member

anomit commented Oct 7, 2024

Is your feature request related to a problem?
The current selection of the indexes of the pair contracts to snapshot out of the entire list available to the Uniswap V2 data market uses a non-standard hash function that may be unavailable or differ in its output when porting to other languages, frameworks or runtimes.

def _gen_pair_idx_to_compute(self, msg_obj: SnapshotProcessMessage):
monitored_pairs = module_settings.initial_pairs
current_epoch = msg_obj.epochId
snapshotter_hash = hash(int(settings.instance_id.lower(), 16))
current_day = msg_obj.day
return (current_epoch + snapshotter_hash + settings.slot_id + current_day) % len(monitored_pairs)

Describe the solution you'd like
Use a standard one like keccak256.

Describe alternatives you've considered
NA

Additional context
NA

@anomit anomit added the enhancement New feature or request label Oct 7, 2024
@anomit
Copy link
Member Author

anomit commented Oct 7, 2024

For reference: one of the open PRs on sequencer-dequeuer suggests the implementation of the index selection with keccak256.

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

1 participant