-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Light miner: Diagnostics page should NOT display blockchain details #142
Conversation
LOGGER = get_logger(__name__) | ||
|
||
|
||
def decode_pub_key(encoded_key: bytes) -> str: |
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 functions is as is copy from jsonrpc
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.
Shouldn't the old files be deleted as they will no longer be usable?
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 was hoping that we will be able to merge this into master and not change all requirements.txt to point to a git branch
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.
removed json_rpc files.
return json.loads(response.decode()) | ||
|
||
|
||
def get_address_from_add_gateway_txn(add_gateway_txn: |
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 functions is also as is copy from jsonrpc client
c766c97
to
368ecba
Compare
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.
code smells are in grpc generated code. Will have to ignore.
requirements.txt
Outdated
protobuf==3.19.3 | ||
grpcio==1.44.0 | ||
grpcio-tools==1.44.0 |
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 don't think grpcio-tools is required for runtime but needed for generating the code, we don't have a dev requirements.txt
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.
Feel free to make dev-requirements
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. Assuming only additional ones have to go in there just like test-requirements
368ecba
to
97c4c46
Compare
return self.get_validator_info().height | ||
|
||
def get_region_enum(self) -> int: | ||
''' |
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.
Letting possible grpc exceptions pass through for all grpc invocations. Caller might be in a better position.
Catching them here and raising MinerFetchException might be good abstraction but I didn't see any value in that.
97c4c46
to
add87e3
Compare
@@ -0,0 +1,26 @@ | |||
#!/bin/bash |
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 file should be mentioned in the README
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.
done
LOGGER = get_logger(__name__) | ||
|
||
|
||
def decode_pub_key(encoded_key: bytes) -> str: |
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.
Shouldn't the old files be deleted as they will no longer be usable?
hm_pyhelper/gateway_grpc/client.py
Outdated
for line in output.decode().splitlines(): | ||
if line.strip().startswith('Version'): | ||
return line.split(':')[1].strip() | ||
return 'unknown' |
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.
Can we return None or raise an exception 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.
returned None
protos/update_protos.sh
Outdated
update_proto https://raw.githubusercontent.com/helium/proto/master/src/service/local.proto local.proto | ||
update_proto https://raw.githubusercontent.com/helium/proto/master/src/region.proto region.proto | ||
|
||
# python -m grpc_tools.protoc -I=$SRC_DIR --python_out=$DST_DIR $SRC_DIR/blockchain_txn.proto |
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.
Avoid committing unused code
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.
removed.
protos/update_protos.sh
Outdated
@@ -0,0 +1,26 @@ | |||
#!/bin/bash | |||
|
|||
# NOTE:: It would be better if we just pull in the helium proto repo as a submodule. |
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 weird place to make a comment like this. I also don't agree with the statement.
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.
removed.
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.
our protos are out of sync because nothing keeps them updated. A submodule will show such variance with simple git commands. If I download the latest blockchain_txn.proto all these files will be missing:
import "blockchain_txn_coinbase_v1.proto";
import "blockchain_txn_security_coinbase_v1.proto";
import "blockchain_txn_oui_v1.proto";
import "blockchain_txn_gen_gateway_v1.proto";
import "blockchain_txn_routing_v1.proto";
import "blockchain_txn_payment_v1.proto";
import "blockchain_txn_security_exchange_v1.proto";
import "blockchain_txn_consensus_group_v1.proto";
import "blockchain_txn_consensus_group_failure_v1.proto";
import "blockchain_txn_add_gateway_v1.proto";
import "blockchain_txn_assert_location_v1.proto";
import "blockchain_txn_create_htlc_v1.proto";
import "blockchain_txn_redeem_htlc_v1.proto";
import "blockchain_txn_poc_request_v1.proto";
import "blockchain_txn_poc_receipts_v1.proto";
import "blockchain_txn_vars_v1.proto";
import "blockchain_txn_rewards_v1.proto";
import "blockchain_txn_token_burn_v1.proto";
import "blockchain_txn_dc_coinbase_v1.proto";
import "blockchain_txn_token_burn_exchange_rate_v1.proto";
import "blockchain_txn_state_channel_open_v1.proto";
import "blockchain_txn_update_gateway_oui_v1.proto";
import "blockchain_txn_state_channel_close_v1.proto";
import "blockchain_txn_payment_v2.proto";
import "blockchain_txn_price_oracle_v1.proto";
import "blockchain_txn_gen_price_oracle_v1.proto";
import "blockchain_txn_transfer_hotspot_v1.proto";
import "blockchain_txn_rewards_v2.proto";
import "blockchain_txn_gen_validator_v1.proto";
import "blockchain_txn_stake_validator_v1.proto";
import "blockchain_txn_transfer_validator_stake_v1.proto";
import "blockchain_txn_unstake_validator_v1.proto";
import "blockchain_txn_validator_heartbeat_v1.proto";
import "blockchain_txn_assert_location_v2.proto";
import "blockchain_txn_transfer_hotspot_v2.proto";
The other options is to evaluated whether we even need this proto.
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.
resolved during daily standup. Manual copying continues.
|
||
def test_client(self): | ||
with GatewayClient(f'localhost:{TestData.server_port}') as client: | ||
self.assertEqual(client.get_pubkey(), TestData.pubkey_decoded) |
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.
Better to make each of these different tests
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.
Done. Lot of repetition though
43c8b04
to
f578d90
Compare
…ails (#321) grpc client for communication with gatewayrs
f578d90
to
4a492c2
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
@@ -182,13 +180,10 @@ def get_ethernet_addresses(diagnostics): | |||
for (path, key) in zip(path_to_files, keys): | |||
try: | |||
diagnostics[key] = get_mac_address(path) | |||
except MinerFailedToFetchMacAddress as 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.
seemed like dead useless code.
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.
Agreed
@@ -206,8 +201,6 @@ def get_mac_address(path): | |||
The path must be a string value") | |||
try: | |||
file = open(path) | |||
except MinerFailedToFetchMacAddress as 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.
same here. why would open throw one of our exceptions.
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.
Agreed.
@@ -182,13 +180,10 @@ def get_ethernet_addresses(diagnostics): | |||
for (path, key) in zip(path_to_files, keys): | |||
try: | |||
diagnostics[key] = get_mac_address(path) | |||
except MinerFailedToFetchMacAddress as 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.
Agreed
@@ -206,8 +201,6 @@ def get_mac_address(path): | |||
The path must be a string value") | |||
try: | |||
file = open(path) | |||
except MinerFailedToFetchMacAddress as 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.
Agreed.
grpc client for communication with gatewayrs
Issue
How
Write a small client for local.proto grpc service.
Try and maintain compatibility with old interface.
Keep it separate from jsonrpc code even if this means a little bit of copied code.
Screenshots
References
Checklist