Skip to content

Conversation

austinabell
Copy link
Contributor

@austinabell austinabell commented May 16, 2024

More context here #91 (comment)

This is built on #110

Draft until:

  • Update examples and usages to new API
  • Add docs
  • Deprecate ViewCall constructor
  • Update old deprecation warning to point to this API
  • Remove function added in pull 91, as that was between released versions (keep if this comes in after release)

Although I think this API is better for now and to future proof, I don't feel strongly about any names or specific APIs. My goal was to try to match alloy as close as possible, while keeping necessary patterns or naming that existed before (also to minimize breaking changes like re-using ViewCall. Opinions or comments welcome!

This should only give deprecation warnings from 0.10

Details that might be missed:

  • Generic bounds loosened at type level (where it made sense to)
  • new and preflight are the constructors for Contract. They both have the call method at the end of the chain, but the guest one implicitly unwraps the error. I don't love this pattern, but I'm matching the existing one
    • Happy to give argument of why we maybe should have it both return a result
  • Contract and view call types moved into contract.rs
  • SteelEnv trait the internal implementation is based on is kept pseudo-public, to avoid exposing the trait type to the public API. Just used to be able to use CallBuilder in a generic way internally.
    • This doesn't lend the APIs well for people to create their custom implementations outside of our supported ones. Intentionally so that the API surface we have to maintain is smaller, at least until someone asks for this.

nategraf added 30 commits April 25, 2024 16:31
…0-ethereum into victor/use-risc0-main-on-main
…0-ethereum into victor/use-risc0-main-on-main
@austinabell austinabell marked this pull request as ready for review May 16, 2024 22:41
@austinabell austinabell requested review from capossele and Wollac May 16, 2024 22:41
@austinabell austinabell changed the title Implement builder pattern to more closely match alloy APIs Implement call builder pattern to more closely match alloy APIs May 16, 2024
}
}

#[cfg(feature = "host")]
Copy link
Contributor

Choose a reason for hiding this comment

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

So far I have tried to have everything that depends on the host feature in the host module, this also eliminates the need for those ugly configs for imports.
But of course, this approach would reduce code locality, and that is a tradeoff. So let's see how everything looks after the consolidations and see which one makes more sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, I'm right on the fence with this, and just made a judgement call of what seemed most clean. No opinions here, so happy to switch if anyone shares an opinion!

@austinabell austinabell requested a review from Wollac May 24, 2024 00:21
use std::fmt::Debug;
use test_log::test;

macro_rules! provider {
Copy link
Contributor

Choose a reason for hiding this comment

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

This was the only way I could think of to make the golden cache file generation a bit more streamlined. It also fixes the issue where the spec was not always provided (which was already an issue before this PR).
Happy to change it if there are any better suggestions....

Copy link
Contributor

@Wollac Wollac left a comment

Choose a reason for hiding this comment

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

We should also change the name of EthViewCallEnv to EvmEnv and EthViewCallInput to `EvmInput, but we can do that in another PR.

@Wollac
Copy link
Contributor

Wollac commented May 24, 2024

We will probably have to wait until #110 is merged, though.

Base automatically changed from capossele/refactor-zkvm-usage to main May 29, 2024 10:01
@austinabell
Copy link
Contributor Author

should I cherry-pick commits to fix the unrelated commits on this PR or is it fine the way it is? (fine by me since squashed anyway)

@Wollac
Copy link
Contributor

Wollac commented May 29, 2024

Let's just squash and merge

@Wollac Wollac merged commit b0d1cf7 into main May 29, 2024
@Wollac Wollac deleted the austin/builder branch May 29, 2024 20:08
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.

4 participants