Fix node ID mismatch in consignment #131
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a proposed fix for an issue that I have bumped into when testing the
fungible validate
command, and that had been reported at #130.It turns out that the way the Consignment structure was being generated, it ended up with state transition node IDs referenced by different fields of the structure that did not match. More specifically, the state transition node IDs in the
endpoints
field did not match the state transition node IDs in thestate_transitions
field.This happened because the state transition (in my test case there was a single state transition) had some of its assignments concealed before it was added to the
state_transitions
field but was used as it was in theendpoints
field. The modification of the state transition (via the concealment of its assignments) caused its node ID to change, leading to the mismatch.The proposed fix makes sure that the state transitions are modified as needed (have some of its assignments concealed) before they are assigned to any of the Consignment fields. That way the whole Consignment structure will reference the modified state transitions, avoiding the mismatch. That same scheme is also applied to state extensions.