Skip to content

v0.6.0

Latest
Compare
Choose a tag to compare
@sduchesneau sduchesneau released this 16 Oct 19:06

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
  1. 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"
  1. 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.

Symbol multiply defined

warning: Linking globals named 'alloc': symbol multiply defined!

error: failed to load bitcode of module "substreams-cc542fa47b990c4e.substreams.f89693ec9899ca95-cgu.05.rcgu.o": 

warning: `my_project` (lib) generated 1 warning
error: could not compile `my_project` (lib) due to 1 previous error; 1 warning emitted

This means that the this module (substreams) is linked many times with different versions. This is invalid because of the global exports, make sure that only the version 0.6.0 of substreams-rs is used by any of your dependencies.