You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have a single place to collate all gotchas on the SDK/blockchain development in general. There are plenty of hard-learned lessons that every SDK veteran goes through and learns, but afaik we don't have a single place for beginners to look through them and quickly avoid common mistakes.
I think it would be nice to have a running document where we can add any common mistakes and how to avoid them so new people don't have to make the same ones over and over again.
I think there should be the general rule/guidelines and an explanation of why the rule exists.
Examples:
Do not use randomness within the state machine
Rationale: Any randomness will cause different nodes on the same network to arrive at different results leading to network divergence. The state machine output must be completely deterministic given the same list of state transitions (transactions).
Do not use time.Now(), use ctx.BlockTime() instead
Rationale: time.Now() will be different on each node which will again lead to divergence. The context has a time that has been agreed upon by the validator set that you can use within the state machine safely: ctx.BlockTime()
Perhaps, such a thing already exists! Please point me to it and close this issue if so
The text was updated successfully, but these errors were encountered:
It would be nice to have a single place to collate all gotchas on the SDK/blockchain development in general. There are plenty of hard-learned lessons that every SDK veteran goes through and learns, but afaik we don't have a single place for beginners to look through them and quickly avoid common mistakes.
I think it would be nice to have a running document where we can add any common mistakes and how to avoid them so new people don't have to make the same ones over and over again.
I think there should be the general rule/guidelines and an explanation of why the rule exists.
Examples:
Do not use randomness within the state machine
Rationale: Any randomness will cause different nodes on the same network to arrive at different results leading to network divergence. The state machine output must be completely deterministic given the same list of state transitions (transactions).
Do not use time.Now(), use ctx.BlockTime() instead
Rationale: time.Now() will be different on each node which will again lead to divergence. The context has a time that has been agreed upon by the validator set that you can use within the state machine safely: ctx.BlockTime()
Perhaps, such a thing already exists! Please point me to it and close this issue if so
The text was updated successfully, but these errors were encountered: