-
Notifications
You must be signed in to change notification settings - Fork 106
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
Adding new v2-byzcoin requests #2331
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.
- does it make sense to put these in
byzcoin/v2
?
do you want to keep supporting the "v1" version? otherwise, you can merge the two
- what about the differentiation between
Darc
,DarcBS
,DarcInst
? Same forCoin*
?
maybe a namespace
would make it more readable:
Darc.Contract
which allow for Darc creationDarc.BehaviorSubject
which listen to new valuesDarc.Instance
which are elements generated by theBehaviorSubject
, and each can generate new transactions
- does it make sense to have the contraact-commands twice - once as general commands and once instance-specific?
not really, to quote the Zen of Python "There should be one-- and preferably only one --obvious way to do it."
Also please have a look at how multiple instructions are put into a single transaction in
coinbs.spec.ts::"transfer coins"
.
one would need a monad language to make it even nicer :)
|
I also prefer not to use the following:
Because of the collision of the names
Again, Another set I see is:
But I don't like the |
So you expect that people mixes v1 & v2? Then, is it really a new version or more of an extension (so in something like
That's weird that a stream of data is an instance;
|
Well it all is in the
That's the ByzCoin terminology: an instance points to data, and the contract defines how this data can be changed.
OK, mixing it all well:
So the |
Right, that makes it confusing for some people..
That looks more consistent, more readable; good for you? |
086d3a1
to
1855108
Compare
yes, starts to look OK for me. However, now it complains about the following:
with
Perhaps I'll make it a class with only |
Hum, it seems that when using |
Seems to be one of those eternal PRs... |
84cabb3
to
b0ad039
Compare
acb217d
to
2322d14
Compare
2322d14
to
fe7add3
Compare
f175be6
to
520ce65
Compare
520ce65
to
9f1e374
Compare
9f1e374
to
a747633
Compare
472cbdd
to
434c421
Compare
a2de364
to
d23a295
Compare
The previous requests and instances were difficult to use for multi-instruction transactions. Also, they didn't use the new Observable interface given by ByzCoin. This PR adds a v2/ directory with some soon-to-be stable version of Darc and Coin instances. Every instance can now be created as a BehaviorSubject that updates automatically whenever a new block is available. This allows to program a much more reactive programming of the user-interface: instead of polling for new values, the UI can subscribe to the BehaviorSubjects and be updated whenever something changes. In the long run, other contracts should also find their way into byzcoin/v2.
d23a295
to
a38d357
Compare
if (BCTest.bct === undefined) { | ||
BCTest.bct = await BCTest.init(); | ||
} else { | ||
await new Promise((resolve) => setTimeout(resolve, 1000)); |
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.
Why sleep for a second?
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.
Added a comment.
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.
Hum, as the test are stopping at the first failed assert, dropping this line would show a test not cleaning correctly or even missing some relevant check. Maybe it was added during developpement and isn't needed now?
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.
OK, ran it 78 times until travis-timeout without the sleep...
5c462f1
to
ee20411
Compare
The previous requests and instances were difficult to use for multi-instruction transactions.
Also, they didn't use the new Observable interface given by ByzCoin.
This PR adds a v2/ directory with some soon-to-be stable version of Darc and Coin instances.
Every instance can now be created as a BehaviorSubject that updates automatically whenever
a new block is available.
This allows to program a much more reactive programming of the user-interface: instead of
polling for new values, the UI can subscribe to the BehaviorSubjects and be updated
whenever something changes.
In the long run, other contracts should also find their way into byzcoin/v2.
Depends on #2392