-
Notifications
You must be signed in to change notification settings - Fork 82
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
feat: clean zksync_error integration #583
base: main
Are you sure you want to change the base?
Conversation
e5a6dcd
to
fb6f92f
Compare
######################### | ||
# Build dependencies # | ||
######################### | ||
zksync-error-codegen = { git = "https://github.com/matter-labs/zksync-error", branch = "main" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should reference a commit hash here instead unless we want to make an initial release of zksync-error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe rather a tag?
There are two locations in where it is important: here and in build.rs.
Something like stable
.
This is a build dependency to rebuild the zksync-error
crate, which is included. It is not triggered on build unless anvil.json
is changed, therefore even if repository zksync-error
breaks compatibility, anvil-zksync
is still built without issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to start publishing it on crates.io
(thankfully we have an automation for that now), but until then I'd prefer to depend on commit hash. Everything else can be a PITA to manage due to Cargo.lock
(you can update the dep in Cargo.toml
, but it won't be updated in Cargo.lock
until you do cargo update
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to commit hash
There is a point to discuss here -- how do we depend on
I propose to depend on |
######################### | ||
# Build dependencies # | ||
######################### | ||
zksync-error-codegen = { git = "https://github.com/matter-labs/zksync-error", branch = "main" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to start publishing it on crates.io
(thankfully we have an automation for that now), but until then I'd prefer to depend on commit hash. Everything else can be a PITA to manage due to Cargo.lock
(you can update the dep in Cargo.toml
, but it won't be updated in Cargo.lock
until you do cargo update
).
@@ -0,0 +1,377 @@ | |||
# What is zksync-error? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting in this file is odd. Could you please make sure that it's properly formatted, e.g.:
- aligned to 120 line length
- no blocks of many empty lines
- only one H1 header
@@ -0,0 +1,377 @@ | |||
# What is zksync-error? | |||
|
|||
A generated crate describing all errors that are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels like this document tries to cover two things:
- What is
zksync-error
- How to use it in
anvil-zksync
specifically.
IMHO, the first part should be a part of zksync-error
repository, and here we would do something like "Please read this document first (link), and below we will cover how to use it for this codebase".
Otherwise, it will be a copypasta to be added to every repo and it will be a PITA to manage.
We can do it later if you prefer, however, I don't intend to block merging over this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally, zksync-error must have a book published similarly to core/prover/compiler docs covering the architecture/usage/etc, but this can wait until we integrate it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dutterbutter if I recall correctly you suggested including project-agnostic documentation for zksync-error in this repository. If that was the case, could you remind the rationale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for the initial integration having it in this repo is fine given most of the early usage / work with it will be within anvil-zksync. I know for myself I will be referencing it and having it within the repo is certainly convenient.
That being said, definitely once we've defined some standards / best practices it should be hosted and published separately. That will be done outside of this PR.
"types": [], | ||
"domains": [ | ||
{ | ||
"domain_name": "AnvilZKS", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't it be AnvilZksync
/ anvil_zksync
? ZKS feels super odd.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
@@ -61,8 +61,9 @@ jobs: | |||
|
|||
- name: Pack anvil-zksync | |||
run: | | |||
tar -czf anvil-zksync-${{ inputs.tag || inputs.prerelease_name }}-${{ matrix.arch }}.tar.gz \ | |||
./target/${{ matrix.arch }}/release/anvil-zksync | |||
tar -C ./target/${{ matrix.arch }}/release -czf \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merge artifacts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea this comes from a merge commit. Would you prefer me to rebase instead? I remember weird behavior on Github when I rebased branches and then conversations tied to the old commits are impossible to resolve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like you made #584 a part of your PR by accident
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be etc/errors/anvil-zksync.json
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet to read through the howto doc but reviewed everything else. The new approach looks a lot more idiomatic!
@@ -61,8 +61,9 @@ jobs: | |||
|
|||
- name: Pack anvil-zksync | |||
run: | | |||
tar -czf anvil-zksync-${{ inputs.tag || inputs.prerelease_name }}-${{ matrix.arch }}.tar.gz \ | |||
./target/${{ matrix.arch }}/release/anvil-zksync | |||
tar -C ./target/${{ matrix.arch }}/release -czf \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like you made #584 a part of your PR by accident
@@ -70,9 +70,9 @@ dependencies = [ | |||
|
|||
[[package]] | |||
name = "alloy-core" | |||
version = "0.8.15" | |||
version = "0.8.20" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to run cargo update
? I'd avoid bumping deps in this PR if there is no strong reason for it
######################### | ||
# Build dependencies # | ||
######################### | ||
zksync-error-codegen = { git = "https://github.com/matter-labs/zksync-error", branch = "main" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to commit hash
fn main() { | ||
// If we have modified anvil errors, forces rerunning the build script and | ||
// regenerating the crate `zksync-error`. | ||
println!("cargo:rerun-if-changed=../../etc/resources/anvil.json"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: AFAIR cargo::KEY=VALUE
is the preferred syntax now (starting from Rust 1.77):
println!("cargo:rerun-if-changed=../../etc/resources/anvil.json"); | |
println!("cargo::rerun-if-changed=../../etc/resources/anvil.json"); |
@@ -0,0 +1,15 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: random empty line
name = "zksync_error" | ||
version = "0.1.0" | ||
edition = "2021" | ||
[lib] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: unnecessary
strum = "0.26.3" | ||
strum_macros = "0.26.4" | ||
zksync-error-description = { git = "https://github.com/matter-labs/zksync-error", branch = "main"} | ||
anyhow = "1.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, is this file auto-generated too? If so at the very least we need a header making this clear but I also think I would prefer if it was left for the user to write
|
||
#![allow(unused)] | ||
pub mod documentation; | ||
pub(crate) mod error; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub(crate) mod error; | |
pub mod error; |
Access to types CustomErrorMessage
and NamedError
.
What π»
zksync_error
to this project and wire CLI launcher to it.Why β
Evidence π·
Intended to be transparent.