Skip to content

Commit

Permalink
bump prost to 0.13, prep release 0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
sduchesneau committed Oct 16, 2024
1 parent a68ee3a commit 4e02c69
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 41 deletions.
66 changes: 64 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,72 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased
## 0.6.0

- Enable the 'skip_empty_output' instruction in all maps and stores by default, unless the macro is called with the keep_empty_output parameter, like this:
### List of changes
- Enabled the 'skip_empty_output' instruction in all maps and stores by default, unless the macro is called with the keep_empty_output parameter, like this:
`#[substreams::handlers::map(keep_empty_output)]`
- Bumped the `prost` dependencies from 0.11 to 0.13.3

### Upgrading your substreams project

Because of code generated by "buf neoeinstein-prost" plugin and since Rust allows multiple versions of a dependency to be loaded, but we export public functions to the wasm interface, it is very important to align all the dependencies that may depend on this substreams library.

Here are the changes that you must perform in your substreams project to upgrade to v0.6.0:

1. in `buf.gen.yaml`
* bump `buf.build/community/neoeinstein-prost:v0.4.0`
* bump `buf.build/community/neoeinstein-prost-crate:v0.4.1`

2. in `Cargo.toml`, update the dependencies/build_deps only for the modules that you already have:
* bump `substreams = "0.6"`
* bump `prost = "0.13"`
* bump `prost-types = "0.13"`
* bump `prost-build = "0.13"`
* bump `substreams-ethereum = "0.10"`
* bump `substreams-antelope = "0.6"`
* bump `substreams-database-change = "2"`
* bump `substreams-entity-change = "2"`

3. Run `substreams build` again

### Debugging errors after the upgrade

#### Unimplemented prost::message::Message

```
10 | #[substreams::handlers::map]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `prost::message::Message` is not implemented for `MyData`
```

This means that you have a mismatch between the generated protobuf bindings (usually generated by the buf `neoinstein-prost` and `neoinstein-prost-crate` plugins) and the `prost`/`prost-types`/`prost-build` version in one of your Cargo.toml. Make sure that your buf.gen.yaml file exists and points to the versions specified above, as well as the versions for prost libraries in every Cargo.toml.

#### Two different versions of crate being used

```
error[E0308]: mismatched types
--> src/lib.rs:17:36
|
17 | my_data.block_timestamp = Some(blk.timestamp().to_owned());
| ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Timestamp`, found `prost_types::protobuf::Timestamp`
| |
| arguments to this enum variant are incorrect
|
= note: `prost_types::protobuf::Timestamp` and `Timestamp` have similar names, but are actually distinct types
note: `prost_types::protobuf::Timestamp` is defined in crate `prost_types`
--> /Users/you/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prost-types-0.11.9/src/protobuf.rs:2296:1
|
2296 | pub struct Timestamp {
| ^^^^^^^^^^^^^^^^^^^^
note: `Timestamp` is defined in crate `prost_types`
--> /Users/you/.cargo/registry/src/index.crates.io-6f17d22bba15001f/prost-types-0.13.3/src/protobuf.rs:2253:1
|
2253 | pub struct Timestamp {
| ^^^^^^^^^^^^^^^^^^^^
= note: perhaps two different versions of crate `prost_types` are being used?
```

This means that one of your dependencies uses the wrong version of prost-types (0.11.9 in this example). You probably forgot to bump a dependency in one of your Cargo.toml, for example substreams-ethereum or substreams-antelope.

## 0.5.22

Expand Down
61 changes: 27 additions & 34 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ members = [
]

[workspace.package]
version = "0.5.22"
version = "0.6.0"
description = "Substreams SDK - A streaming data engine for The Graph - by StreamingFast"
edition = "2018"
homepage = "https://substreams.streamingfast.io/"
Expand All @@ -17,7 +17,7 @@ categories = ["api-bindings", "external-ffi-bindings", "wasm"]
rust-version = "1.60"

[workspace.dependencies]
substreams-macro = { version = "0.5.22", path = "./substreams-macro" }
substreams-macro = { version = "0.6.0", path = "./substreams-macro" }

[profile.release]
lto = true
Expand Down
6 changes: 3 additions & 3 deletions substreams/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ num-bigint = "0.4"
num-traits = "0.2"
num-integer = "0.1.45"
pad = "0.1"
prost = "0.11"
prost-types = "0.11"
prost = "0.13.3"
prost-types = "0.13.3"
substreams-macro = { workspace = true }
thiserror = "1"
pest= "2.7.10"
Expand All @@ -31,4 +31,4 @@ pest_derive = "2.7.10"
rstest = "0.19.0"

[build-dependencies]
prost-build = "0.11"
prost-build = "0.13.3"

0 comments on commit 4e02c69

Please sign in to comment.