Skip to content
Snippets Groups Projects
Commit 2ae089e1 authored by inertia's avatar inertia
Browse files

Merge branch 'develop' into 'master'

HF27

See merge request !5
parents 006ea02e badc8cac
No related branches found
No related tags found
1 merge request!5HF27
Pipeline #56438 failed
......@@ -22,13 +22,13 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'minitest', '~> 5.14', '>= 5.10.3'
spec.add_development_dependency 'minitest-line', '~> 0.6', '>= 0.6.4'
spec.add_development_dependency 'minitest-proveit', '~> 1.0', '>= 1.0.0'
spec.add_development_dependency 'webmock', '~> 3.3', '>= 3.3.0'
spec.add_development_dependency 'webmock', '~> 3.16', '>= 3.16.0'
spec.add_development_dependency 'simplecov', '~> 0.15', '>= 0.15.1'
spec.add_development_dependency 'vcr', '~> 6.0', '>= 4.0.0'
spec.add_development_dependency 'yard', '~> 0.9', '>= 0.9.12'
spec.add_development_dependency 'pry', '~> 0.11', '>= 0.11.3'
spec.add_development_dependency 'awesome_print', '~> 1.8', '>= 1.8.0'
spec.add_development_dependency 'irb', '~> 1.2', '>= 1.2.3'
spec.add_development_dependency 'irb', '~> 1.4', '>= 1.4.2'
spec.add_dependency 'json', '~> 2.1', '>= 2.1.0'
spec.add_dependency 'logging', '~> 2.2', '>= 2.2.0'
......
......@@ -142,7 +142,7 @@ module Hive
raise Hive::TransactionIndexDisabledError, "#{context}: #{error.message}", build_backtrace(error)
end
if error.message.include? 'is_valid_account_name'
if error.message.include?('Assert Exception:false: Account name ') && error.message.include?(' is not valid. Please follow the RFC 1035 rules.')
raise Hive::InvalidAccountError, "#{context}: #{error.message}", build_backtrace(error)
end
......
......@@ -8,7 +8,6 @@ module Hive::Fallback
:get_block_header
],
condenser_api: [
:broadcast_block,
:broadcast_transaction,
:broadcast_transaction_synchronous,
:get_account_count,
......@@ -172,7 +171,6 @@ module Hive::Fallback
:get_volume
],
network_broadcast_api: [
:broadcast_block,
:broadcast_transaction
],
rc_api: [
......
......@@ -10,30 +10,30 @@ module Hive
IDS = [
:vote_operation,
:comment_operation,
:transfer_operation,
:transfer_to_vesting_operation,
:withdraw_vesting_operation,
:limit_order_create_operation,
:limit_order_cancel_operation,
:feed_publish_operation,
:convert_operation,
:account_create_operation,
:account_update_operation,
:witness_update_operation,
:account_witness_vote_operation,
:account_witness_proxy_operation,
:pow_operation,
:custom_operation,
:report_over_production_operation,
:witness_block_approve_operation,
:delete_comment_operation,
:custom_json_operation,
:comment_options_operation,
......@@ -65,16 +65,18 @@ module Hive
:update_proposal_votes_operation,
:remove_proposal_operation,
:update_proposal_operation,
:collateralized_convert_operation,
:recurrent_transfer_operation,
# SMT operations
:claim_reward_balance2_operation,
:smt_setup_operation,
:smt_setup_emissions_operation,
:smt_set_setup_parameters_operation,
:smt_set_runtime_parameters_operation,
:smt_create_operation,
:smt_contribute_operation
:smt_contribute_operation,
] + VIRTUAL_OP_IDS = [
# virtual operations below this point
:fill_convert_request_operation,
......@@ -94,14 +96,30 @@ module Hive
:producer_reward_operation,
:clear_null_account_balance_operation,
:proposal_pay_operation,
:sps_fund_operation,
:dhf_funding_operation,
:hardfork_hive_operation,
:hardfork_hive_restore_operation,
:delayed_voting_operation,
:consolidate_treasury_balance_operation,
:effective_comment_vote_operation,
:ineffective_delete_comment_operation,
:sps_convert_operation
:dhf_conversion_operation,
:expired_account_notification_operation,
:changed_recovery_account_operation,
:transfer_to_vesting_completed_operation,
:pow_reward_operation,
:vesting_shares_split_operation,
:account_created_operation,
:fill_collateralized_convert_request_operation,
:system_warning_operation,
:fill_recurrent_transfer_operation,
:failed_recurrent_transfer_operation,
:limit_order_cancelled_operation,
:producer_missed_operation,
:proposal_fee_operation,
:collateralized_convert_immediate_conversion_operation,
:escrow_approved_operation,
:escrow_rejected_operation
]
def self.op_id(op)
......
module Hive
VERSION = '1.0.4'
VERSION = '1.0.5'
AGENT_ID = "hive-ruby/#{VERSION}"
end
......@@ -80,13 +80,13 @@ module Hive
end
def test_inspect
assert_equal "#<CondenserApi [@chain=hive, @methods=<90 elements>]>", @api.inspect
assert_equal "#<CondenserApi [@chain=hive, @methods=<92 elements>]>", @api.inspect
end
def test_inspect_testnet
vcr_cassette("#{@api.class.api_name}_testnet") do
api = Api.new(chain: :test) rescue skip('testnet currently unavilable')
assert_equal "#<CondenserApi [@chain=test, @methods=<87 elements>]>", api.inspect
assert_equal "#<CondenserApi [@chain=test, @methods=<86 elements>]>", api.inspect
end
end
......@@ -114,12 +114,8 @@ module Hive
vcr_cassette("#{@api.class.api_name}_all_methods") do
@methods.each do |key|
case key
when :broadcast_block then
assert_raises BlockTooOldError, "expect void arguments to raise BlockTooOldError for: #{key}" do
assert @api.send key, {}
end
when :broadcast_transaction then
assert_raises EmptyTransactionError, "expect void arguments to raise EmptyTransactionError for: #{key}" do
assert_raises TransactionExpiredError, "expect void arguments to raise TransactionExpiredError for: #{key}" do
assert @api.send key, {
ref_block_num: 0,
ref_block_prefix: 0,
......@@ -130,7 +126,7 @@ module Hive
}
end
when :broadcast_transaction_synchronous then
assert_raises EmptyTransactionError, "expect void arguments to raise EmptyTransactionError for: #{key}" do
assert_raises TransactionExpiredError, "expect void arguments to raise TransactionExpiredError for: #{key}" do
assert @api.send key, {
ref_block_num: 0,
ref_block_prefix: 0,
......
......@@ -627,7 +627,7 @@ module Hive
assert_raises NoMethodError do
@api.get_version
end
when '0.20.0', '0.23.0', '1.24.0', '1.25.0'
when '0.20.0', '0.23.0', '1.24.0', '1.25.0', '1.27.0'
@api.get_version do |version|
assert version.chain_id
end
......
......@@ -33,7 +33,6 @@ module Hive
"get_block_header"
],
condenser_api: [
"broadcast_block",
"broadcast_transaction",
"broadcast_transaction_synchronous",
"get_account_count",
......@@ -122,7 +121,10 @@ module Hive
"list_proposals",
"find_recurrent_transfers",
"get_collateralized_conversion_requests",
"is_known_transaction"
"is_known_transaction",
"find_rc_accounts",
"list_rc_accounts",
"list_rc_direct_delegations"
],
database_api: [
"find_account_recovery_requests",
......@@ -207,13 +209,14 @@ module Hive
"get_volume"
],
network_broadcast_api: [
"broadcast_block",
"broadcast_transaction"
],
rc_api: [
"find_rc_accounts",
"get_resource_params",
"get_resource_pool"
"get_resource_pool",
"list_rc_accounts",
"list_rc_direct_delegations"
],
# tags_api: [
# "get_active_votes",
......@@ -242,6 +245,43 @@ module Hive
],
reputation_api: [
"get_account_reputations"
],
wallet_bridge_api: [
"broadcast_transaction",
"broadcast_transaction_synchronous",
"find_proposals",
"find_rc_accounts",
"find_recurrent_transfers",
"get_account",
"get_account_history",
"get_accounts",
"get_active_witnesses",
"get_block",
"get_chain_properties",
"get_collateralized_conversion_requests",
"get_conversion_requests",
"get_current_median_history_price",
"get_dynamic_global_properties",
"get_feed_history",
"get_hardfork_version",
"get_open_orders",
"get_ops_in_block",
"get_order_book",
"get_owner_history",
"get_reward_fund",
"get_transaction",
"get_version",
"get_withdraw_routes",
"get_witness",
"get_witness_schedule",
"is_known_transaction",
"list_accounts",
"list_my_accounts",
"list_proposal_votes",
"list_proposals",
"list_rc_accounts",
"list_rc_direct_delegations",
"list_witnesses"
]
}
......@@ -293,6 +333,7 @@ module Hive
assert_equal Symbol, method.class, "did not expect: #{method.inspect}"
next if api == :bridge
next if api == :wallet_bridge_api
# TODO Remove this skip once all nodes have this signature. Seems like
# there's a node running a different version of hived atn the moment.
......
......@@ -12,7 +12,7 @@ module Hive
end
def test_inspect
assert_equal "#<NetworkBroadcastApi [@chain=hive, @methods=<2 elements>]>", @api.inspect
assert_equal "#<NetworkBroadcastApi [@chain=hive, @methods=<1 element>]>", @api.inspect
end
def test_method_missing
......@@ -27,26 +27,6 @@ module Hive
end
end
def test_broadcast_block
vcr_cassette('broadcast_block') do
options = {
block: {
previous: "0000000000000000000000000000000000000000",
timestamp: "1970-01-01T00:00:00",
witness: "",
transaction_merkle_root: "0000000000000000000000000000000000000000",
extensions: [],
witness_signature: "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
transactions: []
}
}
assert_raises BlockTooOldError do
@api.broadcast_block(options)
end
end
end
def test_broadcast_transaction
vcr_cassette('broadcast_transaction') do
options = {
......@@ -61,7 +41,7 @@ module Hive
max_block_age: -1
}
assert_raises EmptyTransactionError do
assert_raises TransactionExpiredError do
@api.broadcast_transaction(options)
end
end
......
......@@ -13,7 +13,7 @@ module Hive
end
def test_inspect
assert_equal "#<RcApi [@chain=hive, @methods=<3 elements>]>", @api.inspect
assert_equal "#<RcApi [@chain=hive, @methods=<5 elements>]>", @api.inspect
end
def test_method_missing
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment