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 mainnet #1769

Merged
merged 48 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
075b373
Merge released refs/heads/master into develop (#1711)
github-actions[bot] Apr 4, 2024
94cb26d
feat: save issuer address in node processor (#1753)
zmcNotafraid Apr 7, 2024
39d176e
Feat/rgb (#1754)
rabbitz Apr 8, 2024
3d3d2ce
chore: fix typo (#1755)
rabbitz Apr 8, 2024
c18bbb4
chore: update rgb transactions pagination (#1756)
rabbitz Apr 8, 2024
01c776d
chore: fix typo (#1757)
rabbitz Apr 8, 2024
2de7801
refactor: rgb transaction check (#1758)
rabbitz Apr 8, 2024
abbc931
chore: update statistics timestamp to milliseconds (#1760)
rabbitz Apr 8, 2024
20ee1ea
chore: remove unused tables (#1759)
zmcNotafraid Apr 8, 2024
3211c6b
chore: debug build workflow (#1762)
zmcNotafraid Apr 9, 2024
0568529
chore: debug runner space problem (#1763)
zmcNotafraid Apr 9, 2024
aa25446
chore: adjust tests (#1761)
rabbitz Apr 9, 2024
c3ff4d2
feat: retrieve unique udt transactions by bitcoin address (#1764)
rabbitz Apr 9, 2024
1fae45e
chore: clean docker image in github runner (#1765)
zmcNotafraid Apr 9, 2024
9fd28b7
chore: comment cleanImages flow (#1766)
zmcNotafraid Apr 9, 2024
6e1b5fa
chore: remove fast_page from udt_transactions (#1767)
rabbitz Apr 9, 2024
a362c6d
chore: upgrade codecov github workflow (#1768)
zmcNotafraid Apr 10, 2024
4c466a5
Merge pull request #1751 from nervosnetwork/develop
rabbitz Apr 10, 2024
cea537b
feat: calc rgb cell changes without op_return (#1770)
rabbitz Apr 10, 2024
d96b68b
refactor: use block_timestamp index is very slow, query ids first the…
zmcNotafraid Apr 10, 2024
0e4ba07
fix: rgb transaction leap direction (#1774)
rabbitz Apr 10, 2024
41696de
chore: update bitcoin statistic time zone (#1775)
rabbitz Apr 11, 2024
a34cc03
feat: remove raw bitcoin transaction cache (#1776)
rabbitz Apr 11, 2024
8180421
Merge pull request #1771 from nervosnetwork/develop
rabbitz Apr 11, 2024
97b8d59
chore: add bitcoin_statistics log (#1777)
rabbitz Apr 11, 2024
e7f4ec2
chore: fix bitcoin statistic start_time (#1779)
rabbitz Apr 11, 2024
394500d
chore: upsert bitcoin_statistics (#1780)
rabbitz Apr 11, 2024
c9c77a8
fix: bitcoin statistic datetime range (#1781)
rabbitz Apr 12, 2024
01dc6ab
chore: update workflow build file (#1782)
rabbitz Apr 12, 2024
de685d5
chore: update workflow build file (#1783)
rabbitz Apr 12, 2024
16f9454
chore: fix bitcoin transaction confirmations (#1784)
rabbitz Apr 12, 2024
066c98e
Merge pull request #1778 from nervosnetwork/develop
rabbitz Apr 12, 2024
9fac41a
feat: token items list without burnt status (#1785)
zmcNotafraid Apr 12, 2024
7d8262f
chore: add testnet 0.2.2-beta.2 spore contract info (#1788)
zmcNotafraid Apr 15, 2024
fdb16bf
test: reset ENV CKB_NET_MODE to mainnet (#1789)
zmcNotafraid Apr 15, 2024
1cba925
Merge pull request #1786 from nervosnetwork/develop
zmcNotafraid Apr 15, 2024
5d0922f
feat: support aggregate query (#1790)
rabbitz Apr 16, 2024
09819e5
chore: fix suggest query param (#1792)
rabbitz Apr 16, 2024
e772cf2
chore: adjust test (#1793)
rabbitz Apr 16, 2024
dd90d69
Issue 620 (#1794)
zmcNotafraid Apr 16, 2024
0482671
feat: parse params tags (#1795)
zmcNotafraid Apr 17, 2024
da8a686
fix: missing valid xudt tags (#1796)
zmcNotafraid Apr 17, 2024
b731bd8
fix: same xudt exist in same tx but issuer is different (#1797)
zmcNotafraid Apr 17, 2024
f7b3722
Merge pull request #1791 from nervosnetwork/develop
zmcNotafraid Apr 17, 2024
c0e4ef1
fix: xudt issuer_address logic (#1798)
zmcNotafraid Apr 17, 2024
0668af7
Merge pull request #1799 from nervosnetwork/develop
zmcNotafraid Apr 17, 2024
f2c1086
fix: remove omiga_inscription_info's issuer_address logic (#1800)
zmcNotafraid Apr 17, 2024
1efaf72
Merge pull request #1801 from nervosnetwork/develop
zmcNotafraid Apr 17, 2024
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
27 changes: 6 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,9 @@ jobs:
build:
runs-on: ubuntu-latest
outputs:
image-name: '${{ steps.docker_build.outputs.imageFullName }}'
image-tag: '${{ steps.docker_build.outputs.tags }}'
image-name: "${{ steps.docker_build.outputs.imageFullName }}"
image-tag: "${{ steps.docker_build.outputs.tags }}"
steps:
- name: Update Package List and Remove Dotnet
run: |
sudo apt-get update
sudo apt-get remove -y '^dotnet-.*'
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false

# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@v3
with:
fetch-depth: 0
Expand All @@ -56,3 +37,7 @@ jobs:
githubOrg: magickbase # optional
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}
- name: DeleteUselessImages
run: docker images && docker images| grep "ckb-explorer-api" | grep -v "IMAGE ID" | awk 'NR>1 {print $3}' | xargs -I {} docker rmi {}
- name: CheckImage
run: docker images && df -hT && df -ih
8 changes: 7 additions & 1 deletion .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- 5432:5432
redis:
image: redis
ports: ['6379:6379']
ports: ["6379:6379"]
options: --entrypoint redis-server
steps:
- uses: actions/checkout@v3
Expand All @@ -32,3 +32,9 @@ jobs:
bundle exec rails db:setup RAILS_ENV=test
cp .env.test.local.travis .env.test.local
bundle exec rails test RAILS_ENV=test
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: coverage/coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,14 @@ group :development, :test do
end

group :test do
gem "codecov", require: false
gem "database_cleaner"
gem "database_cleaner-active_record"
gem "minitest-reporters"
gem "mocha"
gem "shoulda-context"
gem "shoulda-matchers"
gem "simplecov", require: false
gem "simplecov-cobertura"
gem "vcr"
gem "webmock"
end
Expand Down
7 changes: 4 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ GEM
msgpack (~> 1.2)
builder (3.2.4)
byebug (11.1.3)
codecov (0.6.0)
simplecov (>= 0.15, < 0.22)
coderay (1.1.3)
concurrent-ruby (1.2.2)
config (4.1.0)
Expand Down Expand Up @@ -455,6 +453,9 @@ GEM
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-cobertura (2.1.0)
rexml
simplecov (~> 0.19)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
siphash (0.0.1)
Expand Down Expand Up @@ -518,7 +519,6 @@ DEPENDENCIES
bitcoinrb
bootsnap
ckb-sdk-ruby!
codecov
config
dalli
database_cleaner
Expand Down Expand Up @@ -569,6 +569,7 @@ DEPENDENCIES
shoulda-matchers
sidekiq
simplecov
simplecov-cobertura
solargraph
spring
spring-watcher-listen
Expand Down
9 changes: 5 additions & 4 deletions app/controllers/api/v1/address_dao_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ def show
address = Address.find_address!(params[:id])
raise Api::V1::Exceptions::AddressNotFoundError if address.is_a?(NullAddress)

ckb_dao_transactions = address.ckb_dao_transactions.select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at).recent.page(@page).per(@page_size).fast_page
ckb_dao_transactions = address.ckb_dao_transactions.select(:id, :tx_hash, :block_id, :block_number, :tags, :block_timestamp, :is_cellbase, :updated_at, :created_at).
recent.page(@page).per(@page_size).fast_page
json =
Rails.cache.realize(ckb_dao_transactions.cache_key, version: ckb_dao_transactions.cache_version) do
records_counter = RecordCounters::AddressDaoTransactions.new(address)
options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: ckb_dao_transactions, page: @page, page_size: @page_size, records_counter: records_counter).call
options = FastJsonapi::PaginationMetaGenerator.new(request:, records: ckb_dao_transactions, page: @page, page_size: @page_size, records_counter:).call
CkbTransactionsSerializer.new(ckb_dao_transactions, options.merge(params: { previews: true })).serialized_json
end

render json: json
render json:
end

private
Expand All @@ -28,7 +29,7 @@ def validate_query_params
errors = validator.error_object[:errors]
status = validator.error_object[:status]

render json: errors, status: status
render json: errors, status:
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def show
raise Api::V1::Exceptions::UdtNotFoundError if udt.blank?

ckb_dao_transactions = address.ckb_udt_transactions(udt.id).
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at).
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at, :tags).
recent.page(@page).per(@page_size).fast_page
json =
Rails.cache.realize(ckb_dao_transactions.cache_key, version: ckb_dao_transactions.cache_version) do
Expand Down
10 changes: 5 additions & 5 deletions app/controllers/api/v1/block_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class BlockTransactionsController < ApplicationController
def show
block = Block.find_by!(block_hash: params[:id])
ckb_transactions = block.ckb_transactions.
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at).
select(:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at, :tags).
order(is_cellbase: :desc, id: :asc)

if params[:tx_hash].present?
Expand All @@ -24,16 +24,16 @@ def show
records_counter = RecordCounters::BlockTransactions.new(ckb_transactions)
ckb_transactions = ckb_transactions.page(@page).per(@page_size).fast_page
options = FastJsonapi::PaginationMetaGenerator.new(
request: request,
request:,
records: ckb_transactions,
page: @page,
page_size: @page_size,
records_counter: records_counter
records_counter:,
).call
json = CkbTransactionsSerializer.new(ckb_transactions,
options.merge(params: { previews: true })).serialized_json

render json: json
render json:
end
rescue ActiveRecord::RecordNotFound
raise Api::V1::Exceptions::BlockTransactionsNotFoundError
Expand All @@ -48,7 +48,7 @@ def validate_query_params
errors = validator.error_object[:errors]
status = validator.error_object[:status]

render json: errors, status: status
render json: errors, status:
end
end

Expand Down
12 changes: 6 additions & 6 deletions app/controllers/api/v1/ckb_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ module Api
module V1
class CkbTransactionsController < ApplicationController
before_action :validate_query_params, only: %i[show]
before_action :find_transaction,only: %i[show]
before_action :find_transaction, only: %i[show]
before_action :validate_pagination_params, :pagination_params, only: %i[index]

def index
if from_home_page?
ckb_transactions = CkbTransaction.tx_committed.recent.normal.select(
:id, :tx_hash, :block_number, :block_timestamp, :live_cell_changes, :capacity_involved, :updated_at, :created_at
:id, :tx_hash, :block_number, :block_timestamp, :live_cell_changes, :capacity_involved, :updated_at, :created_at, :tags
).limit((Settings.homepage_transactions_records_count || 15).to_i)
json =
Rails.cache.realize(ckb_transactions.cache_key,
Expand All @@ -18,7 +18,7 @@ def index
render json:
else
ckb_transactions = CkbTransaction.tx_committed.normal.select(
:id, :tx_hash, :block_number, :block_timestamp, :live_cell_changes, :capacity_involved, :updated_at, :created_at
:id, :tx_hash, :block_number, :block_timestamp, :live_cell_changes, :capacity_involved, :updated_at, :created_at, :tags
)

params[:sort] ||= "id.desc"
Expand Down Expand Up @@ -83,7 +83,7 @@ def query
records_counter = RecordCounters::Transactions.new
CkbTransaction.recent.normal.page(@page).per(@page_size).fast_page
end
ckb_transactions = ckb_transactions.select(:id, :tx_hash, :block_id,
ckb_transactions = ckb_transactions.select(:id, :tx_hash, :block_id, :tags,
:block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at)
json =
Rails.cache.realize(ckb_transactions.cache_key,
Expand All @@ -107,8 +107,8 @@ def show
expires_in 10.seconds, public: true, must_revalidate: true

render json: CkbTransactionSerializer.new(@ckb_transaction, {
params: { display_cells: params.fetch(:display_cells, true)
}})
params: { display_cells: params.fetch(:display_cells, true) },
})
end

private
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/v1/contract_transactions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def show
expires_in 10.seconds, public: true, must_revalidate: true, stale_while_revalidate: 5.seconds

ckb_transactions = dao_contract.ckb_transactions.includes(:cell_inputs, :cell_outputs).tx_committed.select(
:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at
:id, :tx_hash, :block_id, :block_number, :block_timestamp, :is_cellbase, :updated_at, :created_at, :tags
).order("ckb_transactions.block_timestamp desc nulls last, ckb_transactions.id desc")

if params[:tx_hash].present?
Expand All @@ -28,12 +28,12 @@ def show
end

ckb_transactions = ckb_transactions.page(@page).per(@page_size).fast_page
options = FastJsonapi::PaginationMetaGenerator.new(request: request, records: ckb_transactions,
options = FastJsonapi::PaginationMetaGenerator.new(request:, records: ckb_transactions,
page: @page, page_size: @page_size).call
json = CkbTransactionsSerializer.new(ckb_transactions,
options.merge(params: { previews: true })).serialized_json

render json: json
render json:
end
end

Expand Down
17 changes: 1 addition & 16 deletions app/controllers/api/v1/suggest_queries_controller.rb
Original file line number Diff line number Diff line change
@@ -1,28 +1,13 @@
module Api
module V1
class SuggestQueriesController < ApplicationController
before_action :validate_query_params

def index
json_response = SuggestQuery.new(params[:q]).find!
json_response = SuggestQuery.new(params[:q], params[:filter_by]).find!

render json: json_response
rescue ActiveRecord::RecordNotFound
raise Api::V1::Exceptions::SuggestQueryResultNotFoundError
end

private

def validate_query_params
validator = Validations::SuggestQuery.new(params)

if validator.invalid?
errors = validator.error_object[:errors]
status = validator.error_object[:status]

render json: errors, status:
end
end
end
end
end
20 changes: 17 additions & 3 deletions app/controllers/api/v1/xudts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@ class XudtsController < ApplicationController
before_action :validate_pagination_params, :pagination_params, only: :index

def index
udts = Udt.xudt
scope = Udt.xudt.includes(:xudt_tag)

if stale?(udts)
if params[:symbol].present?
scope = scope.where("LOWER(symbol) = ?", params[:symbol].downcase)
end

if params[:tags].present?
tags = parse_tags
scope = scope.joins(:xudt_tag).where("xudt_tags.tags @> array[?]::varchar[]", tags).select("udts.*") unless tags.empty?
end

if stale?(scope)
expires_in 30.minutes, public: true, stale_while_revalidate: 10.minutes, stale_if_error: 10.minutes

udts = sort_udts(udts).page(@page).per(@page_size).fast_page
udts = sort_udts(scope).page(@page).per(@page_size).fast_page
options = FastJsonapi::PaginationMetaGenerator.new(
request:,
records: udts,
Expand Down Expand Up @@ -73,6 +82,11 @@ def sort_udts(records)

records.order("#{sort} #{order}")
end

def parse_tags
tags = params[:tags].split(",")
tags & XudtTag::VALID_TAGS
end
end
end
end
11 changes: 11 additions & 0 deletions app/controllers/api/v2/bitcoin_statistics_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module Api
module V2
class BitcoinStatisticsController < BaseController
def index
expires_in 15.minutes, public: true, stale_while_revalidate: 5.minutes, stale_if_error: 5.minutes

Check warning on line 5 in app/controllers/api/v2/bitcoin_statistics_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v2/bitcoin_statistics_controller.rb#L1-L5

Added lines #L1 - L5 were not covered by tests

render json: { data: BitcoinStatistic.all }
end
end
end
end

Check warning on line 11 in app/controllers/api/v2/bitcoin_statistics_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v2/bitcoin_statistics_controller.rb#L7-L11

Added lines #L7 - L11 were not covered by tests
2 changes: 1 addition & 1 deletion app/controllers/api/v2/nft/holders_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module V2
module NFT
class HoldersController < BaseController
def index
token_items = find_collection.items.joins(:owner)
token_items = find_collection.items.normal.joins(:owner)

if params[:address_hash].present?
owner = Address.find_address!(params[:address_hash])
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v2/nft/items_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module V2
class NFT::ItemsController < BaseController
before_action :find_collection
def index
scope = TokenItem.includes(:collection)
scope = TokenItem.normal.includes(:collection)
if params[:owner]
@owner = Address.find_address!(params[:owner])
scope = scope.where(owner_id: @owner.id)
Expand Down
15 changes: 15 additions & 0 deletions app/controllers/api/v2/rgb_transactions_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Api
module V2
class RgbTransactionsController < BaseController
def index
@ckb_transactions = RgbTransactions::Index.run!(transaction_params)
end

Check warning on line 6 in app/controllers/api/v2/rgb_transactions_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v2/rgb_transactions_controller.rb#L1-L6

Added lines #L1 - L6 were not covered by tests

private

Check warning on line 8 in app/controllers/api/v2/rgb_transactions_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v2/rgb_transactions_controller.rb#L8

Added line #L8 was not covered by tests

def transaction_params
params.permit(:sort, :leap_direction, :page, :page_size)
end
end
end
end

Check warning on line 15 in app/controllers/api/v2/rgb_transactions_controller.rb

View check run for this annotation

Codecov / codecov/patch

app/controllers/api/v2/rgb_transactions_controller.rb#L10-L15

Added lines #L10 - L15 were not covered by tests
12 changes: 9 additions & 3 deletions app/interactions/addresses/live_cells.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
raise AddressNotFoundError if address.is_a?(NullAddress)

order_by, asc_or_desc = live_cells_ordering
records = CellOutput.live.where(address_id: address.map(&:id)).
order(order_by => asc_or_desc).
page(page).per(page_size).fast_page
records =
if order_by == "block_timestamp"
ids = CellOutput.live.where(address_id: address.map(&:id)).pluck(:id)
CellOutput.where(id: ids).order(order_by => asc_or_desc).page(page).per(page_size).fast_page
else
CellOutput.live.where(address_id: address.map(&:id)).

Check warning on line 21 in app/interactions/addresses/live_cells.rb

View check run for this annotation

Codecov / codecov/patch

app/interactions/addresses/live_cells.rb#L21

Added line #L21 was not covered by tests
order(order_by => asc_or_desc).
page(page).per(page_size).fast_page
end
options = FastJsonapi::PaginationMetaGenerator.new(
request:, records:, page:, page_size:,
).call
Expand Down
2 changes: 1 addition & 1 deletion app/interactions/addresses/pending_transactions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def transactions_ordering
end

def select_fields
%i[id tx_hash block_id block_number block_timestamp
%i[id tx_hash block_id block_number block_timestamp tags
is_cellbase updated_at capacity_involved created_at]
end

Expand Down
Loading
Loading