Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SDK Gotcha Doc #13171

Open
Tracked by #13085 ...
AdityaSripal opened this issue Sep 7, 2022 · 2 comments
Open
Tracked by #13085 ...

SDK Gotcha Doc #13171

AdityaSripal opened this issue Sep 7, 2022 · 2 comments
Labels
T: Dev UX UX for SDK developers (i.e. how to call our code) T:Docs Changes and features related to documentation.

Comments

@AdityaSripal
Copy link
Member

AdityaSripal commented Sep 7, 2022

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:

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

  2. 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

@tac0turtle tac0turtle added the T:Docs Changes and features related to documentation. label Sep 7, 2022
@alexanderbez
Copy link
Contributor

This smells like a FAQ -- something I wish we had for many years at this point.

@p0mvn
Copy link
Member

p0mvn commented Sep 7, 2022

We recently added something similar to this: https://github.com/osmosis-labs/osmosis/pull/2514/files

It mostly focuses on state-compatibility issues though and might not cover all gotchas

@julienrbrt julienrbrt added the T: Dev UX UX for SDK developers (i.e. how to call our code) label Sep 24, 2022
@julienrbrt julienrbrt mentioned this issue Sep 24, 2022
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: Dev UX UX for SDK developers (i.e. how to call our code) T:Docs Changes and features related to documentation.
Projects
None yet
Development

No branches or pull requests

5 participants