-
Notifications
You must be signed in to change notification settings - Fork 1
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
St0x spec #23
base: main
Are you sure you want to change the base?
St0x spec #23
Conversation
meta/st0x-spec.md
Outdated
``` | ||
[ | ||
uint256 ioRatio, // Price ratio for the trading pair | ||
uint256 pairHash, // keccak256 hash of the pair name (e.g. "TSLAUSD") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would only be expressable in rainlang if the string is a compatible Intorastring
that is being hashed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does rainlang need to hash it though? it could be hashed and inserted by the order writer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm expecting yes, otherwise the rainlang author can't use the input tokens from context to lookup pairs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the other way that we could do it is add more words to rainlang like utf8-hash()
or something, that first convert the rain string to a utf8 string and then hash that instead
meta/st0x-spec.md
Outdated
## Magic Numbers | ||
|
||
- Web data metadata magic number: `0xff5dcce9b571ba42` | ||
- st0x API magic number: `0x7374307870616972` ("st0xpair" in hex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the point of a magic number is for it to have a negligible chance of colliding with any file that isn't what we're expecting, so that we don't misinterpret data
so at the least it should start with 0xff
but it also shouldn't be a valid ascii string that could easily be found in the wild in other contexts
safer would be to use the initial bytes of the hash of st0xpair
rather than literally the string, which would likely result in at least a few invalid ascii/utf8 chars and prevent it matching random strings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah ok - i'll make another one
meta/st0x-spec.md
Outdated
``` | ||
[ | ||
uint256 ioRatio, // Price ratio for the trading pair | ||
uint256 pairHash, // keccak256 hash of the pair name (e.g. "TSLAUSD") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm expecting yes, otherwise the rainlang author can't use the input tokens from context to lookup pairs
Motivation
Solution
Checks
By submitting this for review, I'm confirming I've done the following: