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

Build failure when elasticsearch feature is enabled #6695

Closed
oxarbitrage opened this issue May 16, 2023 · 9 comments · Fixed by #6709
Closed

Build failure when elasticsearch feature is enabled #6695

oxarbitrage opened this issue May 16, 2023 · 9 comments · Fixed by #6709
Labels
C-feature Category: New features I-build-fail Zebra fails to build

Comments

@oxarbitrage
Copy link
Contributor

Reported by John in slack. When i execute this command to install zebra:

cargo install --features="elasticsearch" --locked --git https://github.com/ZcashFoundation/zebra --tag v1.0.0-rc.8 zebrad

I get the following build error:

...
   Compiling zebra-state v1.0.0-beta.24 (/home/oxarbitrage/.cargo/git/checkouts/zebra-d0d93d7ded255019/0190882/zebra-state)
error[E0277]: the trait bound `zebra_chain::block::Block: Serialize` is not satisfied
   --> zebra-state/src/service/finalized_state.rs:388:23
    |
388 |                 .push(serde_json::json!(block).to_string());
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^
    |                       |
    |                       the trait `Serialize` is not implemented for `zebra_chain::block::Block`
    |                       required by a bound introduced by this call
    |
    = help: the following other types implement trait `Serialize`:
              &'a T
              &'a mut T
              ()
              (T0, T1)
              (T0, T1, T2)
              (T0, T1, T2, T3)
              (T0, T1, T2, T3, T4)
              (T0, T1, T2, T3, T4, T5)
            and 276 others
    = note: required for `Arc<zebra_chain::block::Block>` to implement `Serialize`
    = note: 2 redundant requirements hidden
    = note: required for `&&Arc<zebra_chain::block::Block>` to implement `Serialize`
note: required by a bound in `to_value`
   --> /home/oxarbitrage/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_json-1.0.96/src/value/mod.rs:942:8
    |
942 |     T: Serialize,
    |        ^^^^^^^^^ required by this bound in `to_value`
    = note: this error originates in the macro `json_internal` which comes from the expansion of the macro `serde_json::json` (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try `rustc --explain E0277`.
error: could not compile `zebra-state` due to previous error
error: failed to compile `zebrad v1.0.0-rc.8 (https://github.com/ZcashFoundation/zebra?tag=v1.0.0-rc.8#01908822)`, intermediate artifacts can be found at `/tmp/cargo-install27LFAQ`
$

This is also happening without --locked argument.

@mpguerra mpguerra added this to Zebra May 16, 2023
@github-project-automation github-project-automation bot moved this to 🆕 New in Zebra May 16, 2023
@oxarbitrage oxarbitrage added I-build-fail Zebra fails to build C-feature Category: New features labels May 16, 2023
@oxarbitrage
Copy link
Contributor Author

Also happening with the last main:

cargo install --features="elasticsearch" --git https://github.com/ZcashFoundation/zebra zebrad

@oxarbitrage
Copy link
Contributor Author

This builds fine:

$ cargo build --release --features="elasticsearch"

@teor2345
Copy link
Contributor

teor2345 commented May 16, 2023

The elasticsearch feature needs to be added to the list of features that activate Serialize on Block and every type that it contains:

#[cfg_attr(any(test, feature = "proptest-impl"), derive(Serialize))]
pub struct Block {

This build issue happens because some build commands activate the proptest-impl feature, and some don't.

@oxarbitrage
Copy link
Contributor Author

I tried the above fix and i am now getting the same error as https://github.com/ZcashFoundation/zebra/actions/runs/5005342607/jobs/8969163581?pr=6706 which is a bump of bitflags. It is possible that a fix in that PR (#6706) might help here too.

@teor2345
Copy link
Contributor

I tried the above fix and i am now getting the same error as ZcashFoundation/zebra/actions/runs/5005342607/jobs/8969163581?pr=6706 which is a bump of bitflags. It is possible that a fix in that PR (#6706) might help here too.

This is a bug in the bitflags release version, see #6711 (comment)

Use --locked to work around this issue, it will stop cargo finding the latest version. (Which is wrongly marked as compatible.)

@oxarbitrage
Copy link
Contributor Author

You are right, --locked will do it. #6709 (comment)

@KodrAus
Copy link

KodrAus commented May 17, 2023

Sorry for the confusion all. This should be all sorted by bitflags-serde-legacy 0.1.1 now.

@teor2345
Copy link
Contributor

The elasticsearch feature needs to be added to the list of features that activate Serialize on Block and every type that it contains

@oxarbitrage I'm happy to help you through setting up these feature dependencies, but I'm focused on other work right now.

So let's wait until this ticket gets scheduled?

@oxarbitrage
Copy link
Contributor Author

So let's wait until this ticket gets scheduled?

Yes, agree with that, I thought it was going to be easier.

@teor2345 teor2345 changed the title Build issue in last tag when elasticsearch feature is enabled Build failure when elasticsearch feature is enabled May 18, 2023
@mergify mergify bot closed this as completed in #6709 Jun 14, 2023
@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Zebra Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature Category: New features I-build-fail Zebra fails to build
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants