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

Make order of types in shared_types deterministic #2169

Merged
merged 2 commits into from Feb 21, 2023

Conversation

sveitser
Copy link
Contributor

@sveitser sveitser commented Feb 20, 2023

Motivation

The order in which the types in shared_types.rs appear is not deterministic. This is can be frustrating if the bindings are committed to version control.

Unfortunately I don't have a simple repro or a test case right now.

The PR also includes some additions (gcc, anvil, geth) necessary to run the tests in the dev shell on NixOS. cc @onsails

Unfortunately I still can't run clippy, which fails with

/nix/store/ir58ws685pawbh0q3ys66aixy7hnv2vx-devenv-profile/bin/cargo-clippy: error while loading shared libraries: libstd-62c4894b82797b30.so: cannot open shared object file: No such file or directory

Solution

Instead of using HashMap/HashSet use BTree so that items are iterated over in order.

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog
  • Breaking changes

Fixes an issue where the order of types in the generated shared_types is
not always deterministic.
Copy link
Owner

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yes of course. good catch. the flake lock file seems fine, should make using easier

@gakonst gakonst merged commit c21362b into gakonst:master Feb 21, 2023
@sveitser sveitser deleted the shared-types-deterministic branch February 21, 2023 15:49
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

Successfully merging this pull request may close these issues.

None yet

2 participants