-
-
Notifications
You must be signed in to change notification settings - Fork 669
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
All: add Stellar operation manageBuyOffer #627
All: add Stellar operation manageBuyOffer #627
Conversation
Please run Yes, you are right that some tests for Stellar operations are missing (see #2). These device tests however are a great start to test your implementation. Have a look on the first test for example and try to write a test for manageBuyOffer, it should be very similar. There is a comment on the top of the file explaining how to get a fixture from Stellar's labrotory. |
@tsusanka Can you take it from here? I feel like I'm wasting huge amount of time trying to figure out something that you could solve in a dozen of minutes. Meanwhile, nobody is busy writing tests & updates for my own softwares. |
What is the difference between StellarManageBuyOfferOp and the StellarManageOfferOp we already had? Is it completely unrelated op? Or do we use StellarManageOfferOp for "sell"? |
Correct, "manage offer" is old name for "manage sell offer". We might want to rename "manage offer" to avoid confusion, however, it would break existing Connect users. Another thing i notice is that the messages are identical in terms of fields. The same code could handle them, and we could even fold them into a single message with a I mean |
stellaport.io is one of the major DEX front-end and has integrated Trezor since nearly one year. Naturally, they use the manage(Sell)Offer operation - so I'd assume there are people using it. |
Note: the latest HEAD passed the checks locally, but when I build T firmware & try to sign createPassiveOffer/manageSellOffer/manageBuyOffer ops I get |
6f14b8e
to
59b07c8
Compare
Pull request rebased Example of transactions leading to firmware error: manageSellOffer. |
Anybody here??? |
I spent time to play your game: learn how to use your development environment & write some missing code in Trezor support for Stellar. I had to figure out by myself how to make it fits your system. Yet that PR is being ignored since a month. This is totally unrespectful. 😠 |
hello, you still haven't addressed this comment #627 (comment):
I am sorry that i don't have more time to spend on 3rd party contributions in order to provide more detailed guidance. However, this is a low-priority issue for us. |
That issue was already present in your code. As you noted, there was already a duplicate for I think there's a difference between me writing an update for your firmware & me refactoring your code base to fix a weakness in it. I'm not proficient at C & I never proposed to go that far. I agree that this would be better but I fear that if you really want it then you'll have to write it by yourself. |
common/protob/messages-stellar.proto
Outdated
optional string source_account = 1; // (optional) source account address | ||
optional StellarAssetType selling_asset = 2; | ||
optional StellarAssetType buying_asset = 3; | ||
optional sint64 buy_amount = 4; |
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.
please rename to amount
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.
You already asked for it the last time then closed it after I replied:
The reason I used buyAmount is because it's what Stellar use (I guess it should be buy_amount by the way?). I know it's not consistent.
Do you want to switch to amount anyway?
I think it's better to stay consistent with the underlying implementation regardless of our opinion about it. (I asked them to change it into amount
at a lower level when that operation got merged but they didn't)
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.
Right, sorry about that. Yes, please switch to amount
anyway.
@@ -68,6 +69,15 @@ def write_manage_offer_op(w, msg: StellarManageOfferOp): | |||
writers.write_uint64(w, msg.offer_id) | |||
|
|||
|
|||
def write_manage_buy_offer_op(w, msg: StellarManageBuyOfferOp): |
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.
please reuse write_manage_offer_op
instead
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 waiting for your response about amount
so I can decide how to rewrite that one.
I pointed out some places where reuse should happen. You're unfortunately right about the legacy code, where we can't use duck typing to save on copy-pasting. |
@matejcik I'm waiting for your answer. |
i'm just now noticing that your code in core serializes selling then buying asset, but the legacy code does the opposite, i.e. buying then selling. which is correct? i assumed that the code in core is correct, and the serialization for buy-offer and sell-offer is identical. if it isn't, then please fix what is a bug in If it is identical, then please fix the order in legacy code. The code in This is the final decision and I'm ready to merge once this is clarified. If the serialization is different, please fix the bugs in core/ and python/, and keep the serialization function separate. |
also leaving a note for myself to rename "manage offer op" to "manage sell offer op" later |
Good catch, thanks! Indeed, both ops are serialized the same way. |
Just re-read the code... Where did I serialize the wrong way? Couldn't find it. |
@matejcik Thanks, I'm fixing it. I'm struggling on something: what's the right way to handle typecheck here?
|
|
that |
@matejcik Is there a command that builds and run all tests at once? |
Let me know if tests pass, I'll merge commits together to prepare for merging. |
tests are still failing, now both core and legacy produces the same signature I seem to be unable to regenerate the transaction in the Stellar TX builder (the signature I get is also completely different), so I'm afraid this is up to you. Let me know if you encounter problems when running the test; the simplest way to run it without the whole test suite is |
I've tried it, but it stays stuck on:
I fear I already allocated more time than reasonable on that PR & I have no idea what's wrong. There are other matters that need my attention so I'll have to leave it that way for now. I think your tool suite is great & has a lot of potential, but contributors efficiency would be greatly improved if it where possible run all the important tasks within a few commands. It was frustrating to have to deal with dozens of commands & to regularly bump into cryptic error messages that required significant amount of time to get solved. I think I spent more time struggling with the dev environment than working on the code itself. |
That's unfortunate. Thanks for your work anyway, hopefully someone can pick this up in the future. We have #769 about running everything with a single command, so that is something that might happen. |
That would be immensely helpful. |
Hello @matejcik, can I try to promote this PR? |
@overcat feel free to go ahead although with the code drift, it might be better to start from scratch. regarding protobuf design: i'm not sure if it's worth it to introduce a separate Also to be clear, we would currently accept the added |
Hi @matejcik, The following comments do not consider compatibility issues. At least for now, the names of the operations in the protobuf file are the same as those in XDR, I don't think we need to break this rule for this special case. If necessary, we can also share code in a lower level of code. The above are my opinions, but I am willing to follow your guidelines. |
Very well, you're right that keeping it a separate type is better for understandability of outside contributors. The cost of doing it that way is not significant enough to introduce confusion. |
Hi @matejcik, So I will submit a new PR, rename Also, P.S.
|
i think you mean
Yes please. Also feel free to implement |
@MisterTicot thanks again for your work. this PR is now superseded by #1838 |
I think I covered everything but tests: tests for similar operations manageOffer/createPassiveOffer were missing too.
I did not test the implementation as I don't know about how to proceed. Please let me know if anything is missing or wrong.