Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

[needs review] 946 feature HeaderWithItsEntry #2006

Open
wants to merge 111 commits into
base: develop
Choose a base branch
from

Conversation

jameschrray
Copy link

@jameschrray jameschrray commented Dec 21, 2019

PR summary

Fetches #1860 as CI build is failing there due to overuse of CI resources on my normal account. Has additional fixes.

Aims to close #946.

By changing EntryWithHeader to an HeaderWithItsEntry tuple struct (with getters etc.), and using a try_from_header_and_entry() as a constructor and not a new() constructor, this introduces a lot of changes, and not only with renaming. The rename to HeaderWithItsEntry, to me, indicates intent more clearly: this is a header that must be with its corresponding entry, and not just with any entry. Thus the rename as well as the actual structure should fix #946.

testing/benchmarking notes

The change also broke a couple of tests, since the header and entry in them didn't match, and these tests have been fixed. Convenience functions have been set up, and some additions and changes have been made that could pave the way for more refactoring of repetition.

followups

( any new tickets/concerns that were discovered or created during this work but aren't in scope for review here )

changelog

  • if this is a code change that effects some consumer (e.g. zome developers) of holochain core, then it has been added to our between-release changelog with the format
- summary of change [PR#1234](https://github.com/holochain/holochain-rust/pull/1234)

documentation

…ndent code to use chain_pair and ChainPair, add custom error variant HeaderEntryMismatch, fixing some format errors
…ors introduced due to unimplemented traits Ord and Display for contained types
Add fixes.
Use a convenience function, try_validate_from_entry_and_header
…nually from develop, but I should pull upstream develop
@jameschrray jameschrray changed the title [needs review] 946 feature chain pair [needs review] 946 feature entry header pair Dec 21, 2019
@jameschrray jameschrray changed the title [needs review] 946 feature entry header pair [needs review] 946 feature HeaderWithItsEntry Dec 21, 2019
@jameschrray
Copy link
Author

jameschrray commented Dec 23, 2019

This is quite baffling with errors for the cli-tests:

+ bats crates/cli/test/hc.bats
1..2
# in the nix store by default
# shadowed after an installation
not ok 1 install and uninstall
# (in test file crates/cli/test/hc.bats, line 19)
#   `hc-cli-install' failed with status 101
# dropping hc binary from cargo home directory

It's hard to debug with a backtrace

error[E0407]: method `augment_clap` is not a member of trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:140:33
    |
140 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not a member of trait `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0407]: method `is_subcommand` is not a member of trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:140:33
    |
140 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not a member of trait `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0407]: method `augment_clap` is not a member of trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:155:33
    |
155 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not a member of trait `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0407]: method `is_subcommand` is not a member of trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:155:33
    |
155 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not a member of trait `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0576]: cannot find method or associated constant `augment_clap` in trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:140:33
    |
140 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not found in `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0576]: cannot find method or associated constant `augment_clap` in trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:155:33
    |
155 | #[derive(Clone, Debug, Default, StructOpt)]
    |                                 ^^^^^^^^^
    |                                 |
    |                                 not found in `structopt::StructOpt`
    |                                 in this macro invocation
    | 
   ::: /holochain-rust/build/.cargo/registry/src/github.com-1ecc6299db9ec823/structopt-derive-0.3.6/src/lib.rs:52:1
    |
52  | #[proc_macro_error]
    | ------------------- in this expansion of `#[derive(StructOpt)]`

error[E0576]: cannot find method or associated constant `augment_clap` in trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:175:17
    |
175 |     #[structopt(flatten)]
    |                 ^^^^^^^ not found in `structopt::StructOpt`

error[E0576]: cannot find method or associated constant `is_subcommand` in trait `structopt::StructOpt`
   --> crates/metrics/src/cloudwatch.rs:175:17
    |
175 |     #[structopt(flatten)]
    |                 ^^^^^^^ not found in `structopt::StructOpt`

@jameschrray
Copy link
Author

Well, it works now.

@jameschrray
Copy link
Author

Ah, I saw #2014.

@jameschrray
Copy link
Author

@thedavidmeister, @maackle and anyone else, may you please review this?

@jameschrray
Copy link
Author

jameschrray commented Dec 29, 2019

I can merge changes from the develop branch but I don't want to needlessly consume Circle CI resources, and I don't know when this will be reviewed, so perhaps whoever wants to review it can merge the changes, and if there are any conflicts I can then fix them up before review.

@jamesray1
Copy link
Contributor

jamesray1 commented Jan 16, 2020

If I fix the current checks will this be reviewed? Or is there anything else that I can do to help it to be reviewed?

@jamesray1
Copy link
Contributor

Is there any general idea of when there might be capacity to review this?

@jamesray1
Copy link
Contributor

jamesray1 commented Jan 28, 2020

Do you want me to fix up holochain/holonix#127 before also fixing this up, and for this to then be reviewed? I'm keen to demonstrate value, but I also want to make sure that my contributions are valued.

@maackle
Copy link
Collaborator

maackle commented Jan 28, 2020

I'm OK with this! Let's get at least one other dev to chime in too. @thedavidmeister?

"{}, entry:\n{:?}\nheader from test_chain_header():\n{:?}\n",
err_msg, entry, header
);
panic!(err_msg);
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is a try_* then i think we want to return a result rather than panic

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll fix this up when I've got time alongside with a job and startup.

@thedavidmeister
Copy link
Contributor

@maackle sure

@jamesray1
Copy link
Contributor

I didn't run the tests locally before pushing, so no need to run the CI builds yet.

@jamesray1
Copy link
Contributor

 17:10:14  ✘  jr@fm  ~/hcr  ⬡ v8.16.0  🦀 1.33.0-nightly   946-feature-chain-pair ✔ ⬆ 
$ nt
nix-shell: error while loading shared libraries: libboost_context.so.1.69.0: cannot open shared object file: No such file or directory

 17:10:22  ✘  jr@fm  ~/hcr  ⬡ v8.16.0  🦀 1.33.0-nightly   946-feature-chain-pair ✔ ⬆ 
$ alias nt
nt='nix-shell --run hc-rust-test'

@jamesray1
Copy link
Contributor

jamesray1 commented Mar 17, 2020

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

impossible states: EntryWithHeader to ChainItem
4 participants