-
Notifications
You must be signed in to change notification settings - Fork 16
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
(try to) fix the protobuf file conflict voodoo #1
Conversation
The diff looks awful becuse of the recompiled protobuf files, I'm sorry. With this change, however, the issue with the colliding message names and type names should be gone for good (given that Valve doesn't change it again). Yet, this needs some testing although it seems to me that everything still works perfectly fine. |
I don't disagree that my solution sucked. The original version had compiled protobuf files that were in the auth group, but they've since been removed, so i don't have the proto source files. It's definitely smarter to not merge the stuff into a resolved proto. Renaming the invoke commands is definitely a good idea. Iirc i didn't just hack swap the includes because one of the service protos had a conflict where it required something in I don't actually know if the proto2 header is required. The code for parsing the proto files was taken from ValvePython, but they still support python 2. Afaik protobufs version 3 don't officially support python 2, so the devs there forced it to work by treating the files as protobuf version 2. It might still be required because we're using a really old protoc, i'm not sure. I've avoided protobuf 3.19 because it was compiling the python with a ValvePython is in the middle of updating their code to do the new auth flow (we beat them to it lol), so they may remove or alter that proto. Might not be a good idea to reference it long term. You'll need to update requirements/dev.txt to include |
realistically, we should use |
removing the temp file is probably good. i couldn't figure out how to get protos to properly compile unless they were all in the same directory.
|
# Note: Possible values: | ||
# k_EAuthSessionGuardType_Unknown, k_EAuthSessionGuardType_None, k_EAuthSessionGuardType_EmailCode = 2, k_EAuthSessionGuardType_DeviceCode = 3, | ||
# k_EAuthSessionGuardType_DeviceConfirmation = 4, k_EAuthSessionGuardType_EmailConfirmation = 5, k_EAuthSessionGuardType_MachineToken = 6, | ||
# For the sake of copypasta, we're only supporting EmailCode, DeviceCode, and None. Unknown is expected, somewhat, but it's an error. | ||
# For the sake of copypasta, we're only supporting EmailCode, DeviceCode, and None. Unknown is expected, somewhat, but it's an error. |
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.
that needs to be changed since we're allowing mobile confirm now. I really need to code review this entire project, lol
from .messages import steammessages_base_pb2, steammessages_clientserver_login_pb2, steammessages_auth_pb2, \ | ||
steammessages_player_pb2, steammessages_clientserver_friends_pb2, steammessages_clientserver_pb2, \ | ||
steammessages_chat_pb2, steammessages_clientserver_2_pb2, steammessages_clientserver_userstats_pb2, \ | ||
steammessages_clientserver_appinfo_pb2, resolved_service_messages_pb2, \ | ||
enums_pb2 | ||
from .messages.steammessages_base_pb2 import ( | ||
CMsgMulti, | ||
CMsgProtoBufHeader, | ||
) | ||
from .messages.steammessages_clientserver_login_pb2 import ( | ||
CMsgClientAccountInfo, | ||
CMsgClientHeartBeat, | ||
CMsgClientHello, | ||
CMsgClientLoggedOff, | ||
CMsgClientLogOff, | ||
CMsgClientLogon, | ||
CMsgClientLogonResponse, | ||
) | ||
from .messages.steammessages_auth_pb2 import ( | ||
CAuthentication_BeginAuthSessionViaCredentials_Request, | ||
CAuthentication_BeginAuthSessionViaCredentials_Response, |
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.
importing the class made it easier to get the messages for whatever new call we were making or adding type hints to the existing code, but this is definitely more python-3 friendly. If we're done with development and adding type hints, this is probably a good idea.
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 mostly did this to make the rest of the file more readable by removing the extremely long module prefix from type hints etc. Also, this way one can see at a glance which messages we need in case there is a change in the proto files again.
I'm inclined to merge this, a little more cautious since last time i had to go find and revert a minor bug. the only thing holding me back atm is that valve python proto. i don't think they'll keep the file. If i'm being honest, all the protos scare me a bit, because they can be changed at any time, and calls may be moved to files we don't retrieve. That's what happened with that Maybe we need to document what protobuf messages we use so if the protos do change in the future the new devs can search for them and update the include list based on what's there. Imo the "best" solution might be to bring common and common base along, and hack include them in each of the |
From what I saw both in my compiler errors logs and the commits in the steamdatabase repo, it seems that
It is required, I looked it up. The extensions used by the proto files are only supported when using proto2 syntax. Both versions are current, though, but support different features so you must specify which one you'd like to use. See here for a comparison
The generated protobufs worked for me, I did all my yesterday testing using those. I'm unsure why it didn't work for you earlier.
After I committed everything I thought of pinning the commit hash in the download URLs so that we don't just download the ones from the master branch. That way we can ensure that we get proto files we want and would also solve the long-term issue (or postpone, to be precise; but in case an update of the protos is planned one must explicitly do that then by changing the commit hash to a more recent commit).
For some reason, |
I do not know how RPC interfaces in protobuf work. But I suspect that switching over to them requires a quite substantial amount of work on top of the other refactorings you are planning to do. |
Since I commented on all of these before, I just give bullet points here outlining what I suggested above.
using commit hashes instead of
explicitly importing all the messages we need makes it clear to see what one needs to look for in case of changes
|
yeah, fair. The only reason i'm considering it is the type hinting is atrocious and if the messages tell me what types i'm expecting, so much the better.
Finding that commit is impressive. is there anything that's exclusive to steammessages_unified_base that we use? because we could just switch to common+common_base and hack include thos in place of unified base and that'd be (hopefully) future-proof |
The only reason I chose to use |
iirc the one you pull from ValvePython was replaced by EDIT: I could be wrong, let me check. |
service community conflicts with unified base, it redefines a few things. that was the issue. let me see if we can get away with common+common base everywhere else. Edit: If not, pin that commit from valve python, update the requirement list accordingly. We can just kick it down the line to someone else when steam finally breaks it. If we can get away with common+ common base, swap the hack to the steammessages. I'll merge after whichever fix we go with is implemented. |
There are way too many conflicts. just pin it. |
What protoc were you using? because i think i was trying protoc 3.19.4 and that introduced |
Use |
I have protoc in my environmental variables, but iirc windows looks in local directory first. If you specified a path to it, that's definitely the case. Looks fine to me. Do you have a static url for https://raw.githubusercontent.com/ValvePython/steam/master/protobufs/steammessages_webui_friends.proto ? better question - is there a specific commit in steam database that has that file so we can pull from there? |
I use an absolute path to run protoc so it doesn't matter which version you have installed locally or where it is. You can get the commit link by navigating the source tree on Github and then pressing |
makes the reference here static since it's not going to change anyway.
No description provided.