Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

refactor: MultiAbigen rework #852

Merged
merged 8 commits into from
Feb 2, 2022
Merged

Conversation

prestwich
Copy link
Collaborator

@prestwich prestwich commented Feb 1, 2022

Draft status until I update docs and changelog

Motivation

  • allow distinguishing between binding generation and serialization/write failures by introducing an explicit build step
  • allow lib generation
  • allow building bindings in memory to prevent unnecessary disk usage on ensure_consistent

Solution

  • refactor of MultiAbigen.
  • MultiAbigen is now a thin vec wrapper that must be explicitly built into a MultiBindings (rather than implicit while writing)
  • MultiBindings holds a map of contract name -> ContractBinding
  • MultiBindings generates file contents in memory, and makes minimal disk writes
  • MultiBindings no longer writes a tmp dir when running its checks
  • Multibindings::ensure_consistent_crate and ::ensure_consistent_module are now available outside of #[cfg(test)] as they no longer use a tmp dir

PR Checklist

  • Added Tests
  • Added Documentation
  • Updated the changelog

@prestwich prestwich added enhancement New feature or request rust Pull requests that update Rust code labels Feb 1, 2022
@prestwich prestwich self-assigned this Feb 1, 2022
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm,
think this covers all use cases

ethers-contract/ethers-contract-abigen/src/multi.rs Outdated Show resolved Hide resolved
@prestwich prestwich marked this pull request as ready for review February 1, 2022 21:02
@prestwich
Copy link
Collaborator Author

Just added some additional convenience:

  • impl FromIterator for MultiAbigen
  • Abigen::from_file

@gakonst gakonst merged commit 5f68bf5 into master Feb 2, 2022
@gakonst gakonst deleted the prestwich/mult-abi-gen-refactor branch February 2, 2022 13:57
@gakonst
Copy link
Owner

gakonst commented Feb 2, 2022

Amazing work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request rust Pull requests that update Rust code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants