Skip to content
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

Deploy to testnet #1470

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app/models/statistic_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ def self.hash_rate(block_number)
end

define_logic :blockchain_info do
message_need_to_be_fitlered_out = "CKB v0.105.* have bugs. Please upgrade to the latest version."
message_need_to_be_filtered_out = "CKB v0.105.* have bugs. Please upgrade to the latest version."
result = CkbSync::Api.instance.get_blockchain_info
result.alerts.delete_if { |alert| alert.message == message_need_to_be_fitlered_out }
result
result.alerts.delete_if { |alert| alert.message == message_need_to_be_filtered_out }
JSON.generate(result.as_json)
end

define_logic :transaction_fee_rates do
Expand Down
4 changes: 3 additions & 1 deletion app/serializers/statistic_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class StatisticSerializer

attribute :blockchain_info, if: Proc.new { |_record, params|
params && params[:info_name] == "blockchain_info"
}
} do |object|
JSON.parse(object.blockchain_info)
end

attribute :flush_cache_info, if: Proc.new { |_record, params|
params && params[:info_name] == "flush_cache_info"
Expand Down
3 changes: 2 additions & 1 deletion test/controllers/api/v1/statistics_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -204,13 +204,14 @@ class StatisticsControllerTest < ActionDispatch::IntegrationTest
chain: "ckb_testnet",
alerts: []
)
StatisticInfo.any_instance.stubs(:blockchain_info).returns(blockchain_info)
CkbSync::Api.any_instance.stubs(:get_blockchain_info).returns(blockchain_info)
statistic_info = StatisticInfo.default
statistic_info.reset! :blockchain_info
valid_get api_v1_statistic_url("blockchain_info")

assert_equal StatisticSerializer.new(statistic_info, { params: { info_name: "blockchain_info" } }).serialized_json,
response.body
assert_equal blockchain_info.as_json, json.dig("data", "attributes", "blockchain_info")
end

test "should return top 50 addresses balance list when param is address balance ranking" do
Expand Down
Loading