Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions develop-docs/ingestion/relay/relay-best-practices.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ Make sure changes to the event protocol and APIs are forward-compatible. Relay s
or truncate data it does not understand. It is a supported use-case to have customers running
outdated Relays but up-to-date SDKs.

For example, `enum`s in the event protocol (or any other data type received from the SDK) need to have a catchall variant
such that customer relays running an older version can still forward the data:

```rust
enum EventColor {
Red,
Green,
Blue,
/// Unknown color, for forward compatibility.
Unknown(String),
Comment on lines +27 to +28
Copy link
Member

Choose a reason for hiding this comment

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

Sometimes we use #[serde(other)] Unknown, sometimes Unknown(String) and other times our derives have something builtin #[metastructure(fallback_variant)].

Seems to be quite use-case specific and hard to phrase :/.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I looked at fallback_variant and it seems we only use it with Object. I guess the important part is that we have some sort of fallback such that parsing does not fail and the data is forwarded.

}
```

## Feature Gate new Functionality

Expand Down
Loading