fix(signing): require `chainId` for staking signs

pull/35/head
MaxMustermann2 2 years ago
parent 7959415bb4
commit 2f0d840f6e
No known key found for this signature in database
GPG Key ID: 4F4AB9DB6FF24C94
  1. 2
      pyhmy/staking_signing.py

@ -405,6 +405,8 @@ def sign_staking_transaction(transaction_dict, private_key):
https://github.com/harmony-one/sdk/blob/99a827782fabcd5f91f025af0d8de228956d42b4/packages/harmony-staking/src/stakingTransaction.ts https://github.com/harmony-one/sdk/blob/99a827782fabcd5f91f025af0d8de228956d42b4/packages/harmony-staking/src/stakingTransaction.ts
""" """
assert isinstance(transaction_dict, dict), 'Only dictionaries are supported' # OrderedDict is a subclass assert isinstance(transaction_dict, dict), 'Only dictionaries are supported' # OrderedDict is a subclass
# chain_id missing => 'rlp: input string too long for uint64, decoding into (types.StakingTransaction)(types.txdata).GasLimit'
assert 'chainId' in transaction_dict, 'chainId missing'
assert 'directive' in transaction_dict, 'Staking transaction type not specified' assert 'directive' in transaction_dict, 'Staking transaction type not specified'
assert isinstance(transaction_dict['directive'], Directive), 'Unknown staking transaction type' assert isinstance(transaction_dict['directive'], Directive), 'Unknown staking transaction type'
if transaction_dict['directive'] == Directive.CollectRewards: if transaction_dict['directive'] == Directive.CollectRewards:

Loading…
Cancel
Save