From 5ab98c59e2e8220d45ecf13d85fe2950b7e38d36 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Tue, 10 Nov 2020 09:23:12 +0800 Subject: [PATCH 1/5] chore: Bump version to v0.12.0 --- CHANGELOG.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42f2853a6..8afd51a89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ -# [v0.11.2](https://github.com/shaojunda/ckb-explorer/compare/v0.11.1...v0.11.2) (2020-08-30) +# [v0.12.0](https://github.com/nervosnetwork/ckb-explorer/compare/v0.11.2...v0.12.0) (2020-11-10) + + +### Features + +* [#739](https://github.com/nervosnetwork/ckb-explorer/pull/739): support querying transactions in the transaction pool + +# [v0.11.2](https://github.com/nervosnetwork/ckb-explorer/compare/v0.11.1...v0.11.2) (2020-08-30) ### Features @@ -9,7 +16,7 @@ * [#721](https://github.com/nervosnetwork/ckb-explorer/pull/721): fix normal transactions counter -# [v0.11.1](https://github.com/shaojunda/ckb-explorer/compare/v0.11.0...v0.11.1) (2020-08-12) +# [v0.11.1](https://github.com/nervosnetwork/ckb-explorer/compare/v0.11.0...v0.11.1) (2020-08-12) ### Performance Improvements From 3c32005fff6ee7e9bacd28ea0178cd3e5e553e02 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Tue, 10 Nov 2020 09:23:12 +0800 Subject: [PATCH 2/5] chore: Bump version to v0.12.0 --- RELEASENOTES.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 3e1769120..47a732daa 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -1,9 +1,8 @@ -# [v0.11.2](https://github.com/shaojunda/ckb-explorer/compare/v0.11.1...v0.11.2) (2020-08-30) +### Adapted CKB Version +[ckb 0.25.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.25.1) and above -### Features - -* [#723](https://github.com/nervosnetwork/ckb-explorer/pull/723): support sUDT on mainnet +# [v0.12.0](https://github.com/nervosnetwork/ckb-explorer/compare/v0.11.2...v0.12.0) (2020-11-10) -### Bug Fixes +### Features -* [#721](https://github.com/nervosnetwork/ckb-explorer/pull/721): fix normal transactions counter +* [#739](https://github.com/nervosnetwork/ckb-explorer/pull/739): support querying transactions in the transaction pool \ No newline at end of file From a68abfcc326c094709580fca2a63b89fff6fdf9c Mon Sep 17 00:00:00 2001 From: shaojunda Date: Sun, 29 Nov 2020 15:51:31 +0800 Subject: [PATCH 3/5] test: dao contract cache update --- test/controllers/api/v1/contracts_controller_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/controllers/api/v1/contracts_controller_test.rb b/test/controllers/api/v1/contracts_controller_test.rb index 6cc3146ca..c3ab8a4d7 100644 --- a/test/controllers/api/v1/contracts_controller_test.rb +++ b/test/controllers/api/v1/contracts_controller_test.rb @@ -77,6 +77,14 @@ class ContractsControllerTest < ActionDispatch::IntegrationTest assert_equal response_json, response.body end + + + test "should update dao contract cache when dao related data changed" do + dao_contract = DaoContract.default_contract + cache_version = dao_contract.cache_version + dao_contract.touch + assert_not_equal cache_version, dao_contract.reload.cache_version + end end end end From 677554fd6c04f37ea680478b7346fb21924df0a4 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Sun, 29 Nov 2020 15:54:11 +0800 Subject: [PATCH 4/5] fix: update dao contract cache key --- app/controllers/api/v1/contracts_controller.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/api/v1/contracts_controller.rb b/app/controllers/api/v1/contracts_controller.rb index 5abd715c7..9d0b2a750 100644 --- a/app/controllers/api/v1/contracts_controller.rb +++ b/app/controllers/api/v1/contracts_controller.rb @@ -4,10 +4,10 @@ class ContractsController < ApplicationController def show raise Api::V1::Exceptions::ContractNotFoundError if params[:id] != DaoContract::CONTRACT_NAME - dao_contract = DaoContract.where(id: 1) + dao_contract = DaoContract.default_contract json = Rails.cache.realize(dao_contract.cache_key, version: dao_contract.cache_version, race_condition_ttl: 3.seconds) do - DaoContractSerializer.new(dao_contract.first).serialized_json + DaoContractSerializer.new(dao_contract).serialized_json end render json: json From 620274b2f3cb5a47e72047896e169900b409e8a7 Mon Sep 17 00:00:00 2001 From: shaojunda Date: Sun, 29 Nov 2020 16:04:35 +0800 Subject: [PATCH 5/5] chore: update test --- .../api/v1/address_udt_transactions_controller_test.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/controllers/api/v1/address_udt_transactions_controller_test.rb b/test/controllers/api/v1/address_udt_transactions_controller_test.rb index b1e28c4b4..b7682dc5e 100644 --- a/test/controllers/api/v1/address_udt_transactions_controller_test.rb +++ b/test/controllers/api/v1/address_udt_transactions_controller_test.rb @@ -200,7 +200,7 @@ class AddressUdtTransactionsControllerTest < ActionDispatch::IntegrationTest page_size = 5 udt = create(:udt, published: true) address = create(:address, :with_udt_transactions, transactions_count: 30, udt: udt) - address_udt_transactions = address.ckb_udt_transactions(udt.id).order(block_timestamp: :desc).page(page).per(page_size) + address_udt_transactions = address.ckb_udt_transactions(udt.id).order("block_timestamp desc nulls last, id desc").page(page).per(page_size) valid_get api_v1_address_udt_transaction_url(address.address_hash, type_hash: udt.type_hash), params: { page: page, page_size: page_size } options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: address_udt_transactions, page: page, page_size: page_size).call