-
Notifications
You must be signed in to change notification settings - Fork 35
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
URI format for event ids #63
Conversation
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.
Typo pass, found a bunch so I ran it through a word processor to find the rest
@benthecarman Ahh Thanks for that. Apparently I don’t have spellchecking on my fresh emacs setup (I am also bad at spelling). |
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 think at the end it's not really in opposition to #55 and seems more like a layer above to me. I think it will be nice to have common standard for event types, but I also feel like it is too restrictive to assume that for an oracle to publish an event it first has to make it standard. IIUC, it means clients need to be aware of all the event types out there, so if a new event type comes out, the client needs to be updated. I'm not sure I see why that would be better than having the client receive information on how to handle the event.
oracle-uri-proposal.md
Outdated
1. Copy pasteable: A user can easily copy paste the event id into a chat app/DLC software/browser address bar. | ||
2. Trivially serializable: It is easy to byte encode the event id for signing purposes. | ||
3. Human readable: A user who is sufficiently familiar with event namespace does not need software to understand the event. | ||
4. Portable: If two oracles support the same event id then you can use either of the oracles without having to query the oracles to determine if they are attesting to the same event, and just as importantly, in the same way. |
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 not sure I understand this. How do you know they are attesting to the same event if you don't query them?
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.
Err woops this is wrong. I wanted to say you don't have to inspect query response bodies to check this (rather just if it's 200 OK rather than 404).
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 ended up removing this claim for now. I think portability is a concern but I wouldn't say the event id uri is the only way to achieve it.
oracle-uri-proposal.md
Outdated
|
||
### Source Identifiers | ||
|
||
If the first segment of a path contains an `@` symbol then the text that precedes it is a _source identifier_. |
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.
@
is already a reserved character in URI syntax, it would probably be better not to reuse it otherwise it would make it difficult to use existing parsing libraries.
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 is a good point. I think it's only reserved in the authority section strictly speaking? I'll have to experiment to see if it confuses parsers.
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.
Yeah it might depend on implementations, but from my understanding of the rfc if you want to use "@" it needs to be percentage encoded.
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.
It also might be annoying on twitter. Perhaps the url can just have a fragment and after the #
we just serialize metadata like this that doesn't affect the outcomes in some way. So it doesn't appear in the URL but is signed in the announcement message.
Normally, users will have to arrange a transactions to cover each outcome even if they only care about a small subset of outcomes. | ||
It is possible to optimize this by splitting up the quantity into some function of multiple sub-outcomes. | ||
|
||
For example, a price between \$0 and \$99,999 could be expressed as `10000×e + 1000×d + 100×c + b×10 + a` whereas a..e are in the range 0..10. |
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 considered this as well, but I think the mantissa exponent as described in the original paper is actually better because you only need 2 R-values for any case and you don't have issues of going out of bounds.
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 made an issue to discuss further: #65
4. `binance/BTC_USDT/bid-price/2021-05-16T08:00:00?digits(5).3=0` | ||
5. `binance/BTC_USDT/bid-price/2021-05-16T08:00:00?digits(5).4=2` | ||
|
||
If `digits(5)` turns out to be insufficient later on because the bitcoin price appreciates too much the oracle can always announce a new `digits(6)` event on the same path. |
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.
How can a client make use of this?
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.
Clients wanting to make a bet after digits(6)
has been announced can use it. Clients who have already made bets on digits(5)
have to just carry on with that and its possibly truncated outcome.
@Tibo-lg Thanks for your review
I think our ideas are less opposed than I originally thought.
Note that this restriction isn't really to do with the event id URI idea per se. You could easily have an event type I tried to allow oracles to create their own even types without go through some public process. They just have to say in a (to be specified) machine readable way that "event types under this namespace may be from either the standard spec or my custom spec". Then they can define a new |
Personally I don't really see a big issue there. For me the purpose of the specification is to facilitate the development of client applications that can make use of the information provided by oracles to let users set up contracts. In that respect, there is not really any difference between both, and if the end user is not happy with the result values that they're proposed they can just chose a different oracle. I can also imagine that some oracles might want to sign even outcomes in different languages, in that case, does it mean we should standardize for every language?
I'm not sure I understand what you mean here. I guess the user (or client app) would have to get hold of the event type definition somehow, so wouldn't that end up being the same at the end? |
oracle-uri-proposal.md
Outdated
The query string is interpreted as an _measurement_ and describes a certain fact that will be observed by an oracle on the object described by the path. | ||
|
||
If applicable, the path should start with the human organization responsible for the event. | ||
If it is a price then the name of the exchange where the price is being measured e.g. `binance` or if it's a sporting competition then the name of the competition e.g. `NBA`. |
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 a little worried about capitalization
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 think that proper nouns should be in capitals. So Binance
and NBA
. What do you think?
Each event type defines its parameters and together they determine the outcomes for the event. | ||
|
||
The event type will usually define how to interpret the preceding path segments. | ||
For example, for a `vs` event type may require that the final path segment be in the form `<team1>_<team2>` or a `weather` event type may require the last two segments to be in the form `<location>/<date>`. |
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 think it may be beneficial to add a version to the URI to make things more extensible
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.
Sorry I missed this comment.
In my experience, versions in general make things less extensible because as soon as a client sees a version it does not understand it fails to parse whatever comes next. What kind of extensibility do you have in mind?
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.
Related to #88
For example, a price between \$0 and \$99,999 could be expressed as `10000×e + 1000×d + 100×c + b×10 + a` whereas a..e are in the range 0..10. | ||
This means that two users who want to make a BTC/USDT trade with boundaries of \$4,000 and \$20,000 and with increments of \$100 would only have to compute contracts for 7 + 5 + 3×5×9 = 147 possible relevant outcomes instead of the usual 100,000 outcomes. | ||
|
||
The oracle will have to declare cryptographically its intention to release signature for each of the decimal decomposed values a..e. |
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.
Any reason we shouldn't have the oracle specify its base (e.g. 10) to allow for binary or hex in the future should there be events where this makes sense to do?
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.
No the digits event type could indeed take a base
parameter.
in favor of just putting this kind of metadata after the `#`
It was annoying to parse them without this.
I pushed some changes. The biggest one was that the event ids now start with
[edit] I read this wrong and responded to what I imagined I read. Sorry. I don't think that oracles will want to sign things in different languages for the same event. That would be redundant in a bad way. Easy localization in general seems like an argument in favor of this proposal. If the oracle is allowed to specify an array of arbitrary strings with unspecified semantics then there's no easy way to create a localized client. If you have a Although the event types are formally specified in English oracles are free to use paths how they like. For example a Nippon Professional Baseball game could have an event id I don't think you have an English version of a NPB game or a Japanese versions of NBA events. Localization is the job of clients.
The difference is the clients can get the (immutable) event definition they which resolves the ambiguity of having |
You've got a point, and my example was poorly chosen. But to summarize my opinion, I like (most of) your proposal, and I can definitely see standardization of events as useful and even necessary when it comes to using multiple oracles for a single event. The point I disagree or maybe don't fully understand, is considering that all the information can be provided with just the URI.
I don't really get what you are saying here. Where do they get the event definition from? How do they know it is the proper one? |
So far it seems like it will work since it is should not be that hard to describe a set of strings in a single human readable compact form. To motivate this further I wanted to add "Trump vs Biden" event which is here: http://h00.ooo/Earth/USA/presidential-election/2020/Trump_Biden?vs
Sorry! that should read.
"ambiguity" is not what I really wanted there. I think "brittleness" is more what I meant. This is just an intuition and it may be wrong. My hope is that oracles will never need to do this and we can avoid even specifying anything like this. I have a feeling this is a bridge that can be crossed later. Perhaps allowing oracles to specify their own event types is the solution or maybe just an |
Correct me if I'm wrong, but the reason you are able to do that is because you hard coded the event type and how to handle it right? If that's the case, I don't think it can scale to a large number of event types, and it means having to upgrade your code every type you want to add a new event, which is very inflexible IMHO. |
Outcomes are always determined implicitly from the event type. | ||
This is done to avoid oracles independently creating events with similar but not precisely the same semantics and structure. | ||
For example, one oracle might have a weather event that has outcomes `sunny`, `cloudy`, `rainy` while another may have `light-rain` in addition. | ||
The hope is that this restriction will encourage the public collaboration on new event types and rich client support for them. |
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 think that there should be a built-in (so as to encourage use) versioning of event types in the URI.
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 would hope explicit versions will not be necessary. If we screw up specifying weather
, you can always make weather2
or perhaps weather.2
if we want to make visually clear it's a version.
(as side not weather is a bad example since I think it is not the type of thing people will actually use this for)
|
||
`<event_id>.<i>=<fragment_outcome_i>` | ||
|
||
## Example Event Types |
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.
It might be nice to have test vectors for parsing these examples, and in the future when encoding is specified it might also be nice to have serialization and de-serialization test vectors along with signature point computation ones.
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.
Yes. I think there could be some basic ones in the URI format. Each document that specifies new event types should have have some more e.g. a vs
parser should extract the team names.
I would like to do this soon but I want to avoid doing this inside this not very well focused document. I think each event type should be in its own document with test etc.
So I think on a high-level I agree with Tibo that there is an issue of determining the outcomes should multiple oracles accidentally (or maliciously) decide to spec things slightly (or entirely) differently for the same event. As such, I think it should be important for the oracle to provide an endpoint where you can either query it directly for all possible outcomes (perhaps serialized in some descriptor fashion) or else at the very least you should be able to demand a signature of a hash of the specification they are following in some sense otherwise it may be very hard to generate a fraud proof for the oracle that is reliable. |
|
||
The `vs` event type requires that the path segment preceding it be in the form `<team1>_<team2>` where `<team1>_<team2>` are the competing teams. | ||
For example, `/NBA/s2019/2020-08-11/PHI_PHX?vs` describes a team named `PHI` is playing against another team named `PHX`. | ||
Additionally the client can infer the date of the match. |
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.
@Tibo-lg made a point last meeting that you can have competitions with multiple entities. e.g. Top scorer in a competition. For this you could do /FIFA-world-cup/2021/top-scoring-player/Messi_Mbappe_Ronaldo?vs(3)
.
I don't think making another descriptor is a solution to misalignment between the oracle and client. If the client is misaligned to the oracle then they can be misaligned in the implementation of this second descriptor as well.
Signing a digest of the specification they are following for the event type is a good idea. However, signing an entire spec is a bit much since if you change a typo then you're in trouble. Perhaps each event type can have a formal specification attached and that can be signed. I really like that idea and I think how sensitive the protocol is to correctness in this respect warrants it. It remains to choose a language. |
I'll close this now. The things that were concluded in the last meeting were:
|
Here's an initial proposal for event ids that are URIs.
In many respects it can seen as a counter proposal to: #55 although I have moved closer to some of the ideas there is some respects (not adding
price
event types but just having more generic event types).It doesn't include anything about HTTP APIs yet. It probably will eventually because it obviously lends itself to making easy HTTP APIs.
This is just for discussion of the idea and if this were to become a specification it would have to be re-structured and more consistently formatted. Hopefully it's readable!