Cadence non-derministic errors common question Q&A (part 1)
If I change code logic inside an Cadence activity (for example, my activity is calling database A but now I want it to call database B), will it trigger an non-deterministic error?
NO. This change will not trigger non-deterministic error.
An Activity is the smallest unit of execution for Cadence and what happens inside activities are not recorded as historical events and therefore will not be replayed. In short, this change is deterministic and it is fine to modify logic inside activities.
Does changing the workflow definition trigger non-determinstic errors?
YES. This is a very typical non-deterministic error.
When a new workflow code change is deployed, Cadence will find if it is compatible with Cadence history. Changes to workflow definition will fail the replay process of Cadence as it finds the new workflow definition imcompatible with previous historical events.
Here is a list of common workflow definition changes.
- Changing workflow parameter counts
- Changing workflow parameter types
- Changing workflow return types
The following changes are not categorized as definition changes and therefore will not trigger non-deterministic errors.
- Changes of workflow return values
- Changing workflow parameter names as they are just positional