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 #1699

Merged
merged 50 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
35a2f88
Merge pull request #1597 from nervosnetwork/testnet
zmcNotafraid Jan 18, 2024
4ea9c0d
Merge pull request #1601 from nervosnetwork/testnet
rabbitz Jan 23, 2024
c021797
Merge pull request #1608 from nervosnetwork/testnet
zmcNotafraid Jan 27, 2024
d4268ae
Merge pull request #1614 from nervosnetwork/testnet
rabbitz Feb 4, 2024
cc40034
Merge pull request #1617 from nervosnetwork/testnet
rabbitz Feb 6, 2024
8b50d25
Merge pull request #1632 from nervosnetwork/testnet
rabbitz Feb 21, 2024
06471dc
Merge pull request #1637 from nervosnetwork/testnet
rabbitz Feb 22, 2024
3f8ae04
Merge pull request #1640 from nervosnetwork/testnet
zmcNotafraid Feb 26, 2024
c2ffdbe
Merge pull request #1652 from nervosnetwork/testnet
zmcNotafraid Feb 29, 2024
74d7706
Merge pull request #1662 from nervosnetwork/testnet
zmcNotafraid Mar 1, 2024
c58eb40
Merge pull request #1668 from nervosnetwork/testnet
zmcNotafraid Mar 5, 2024
e543c76
Feat/rgb (#1664)
rabbitz Mar 11, 2024
5c56865
chore: rename bitcoin transaciton column name (#1670)
rabbitz Mar 11, 2024
76bc5fe
chore: fix suggest query param validation (#1671)
rabbitz Mar 12, 2024
bbe9455
chore: fix typo (#1672)
rabbitz Mar 12, 2024
0c0c7b8
Issue 500 (#1673)
zmcNotafraid Mar 12, 2024
bc79d09
chore: update bitcoin txids cache key (#1674)
rabbitz Mar 13, 2024
675a342
Issue 527 3 (#1675)
zmcNotafraid Mar 13, 2024
d88f0c1
feat: filter by bitcoin address (#1677)
rabbitz Mar 14, 2024
3dfdb12
refactor: remove sync txids worker (#1678)
rabbitz Mar 14, 2024
05fb19b
fix: add cache to address live cells api (#1676)
zmcNotafraid Mar 15, 2024
b8a03b0
feat: add hash_type to contract_resource_distributed api (#1680)
zmcNotafraid Mar 15, 2024
3b1c941
fix: filter contract data (#1681)
zmcNotafraid Mar 16, 2024
993a28b
feat: add bitcoin address mapping (#1679)
rabbitz Mar 18, 2024
c066018
Feat/rgb (#1682)
rabbitz Mar 18, 2024
3b3cacf
fix: bitcoin address mapping query (#1683)
rabbitz Mar 18, 2024
0e93a40
chore: address query wrap result (#1684)
rabbitz Mar 18, 2024
bced8c5
chore: update address_hash attribute in the address serializer (#1685)
rabbitz Mar 18, 2024
b3c7109
chore: update bitcoin txid query (#1687)
rabbitz Mar 19, 2024
86f3473
chore: rename rgb_transaction (#1688)
rabbitz Mar 19, 2024
d66a517
feat: query script by code_hash (#1689)
zmcNotafraid Mar 19, 2024
d6c1752
chore: update rgb_info (#1690)
rabbitz Mar 19, 2024
53db71e
chore: adjust tests (#1691)
rabbitz Mar 20, 2024
b55ca42
chore: filter transfers from the rgb digest (#1692)
rabbitz Mar 21, 2024
13af18b
fix: contract with data1 hash_type needs to handle
zmcNotafraid Mar 21, 2024
b363288
Merge pull request #1693 from zmcNotafraid/issue-578
zmcNotafraid Mar 21, 2024
5a31219
Feat/rgb (#1694)
rabbitz Mar 21, 2024
1cebf8a
fix: ckb transaction txid (#1695)
rabbitz Mar 21, 2024
e196e45
chore: update permission of auto-merge action
zmcNotafraid Mar 21, 2024
34cdd09
Merge pull request #1696 from zmcNotafraid/update-ci
zmcNotafraid Mar 21, 2024
51c6a70
refactor: query bitcoin raw transactions with multiple txids (#1698)
rabbitz Mar 21, 2024
5ef91de
Merge pull request #1697 from nervosnetwork/master
Keith-CY Mar 22, 2024
b4f7fa8
refactor: bitcoin transaction detect worker (#1701)
rabbitz Mar 26, 2024
9580a9d
Feat/rgb (#1702)
rabbitz Mar 26, 2024
8106fef
chore: update bitcoin chanin_params (#1703)
rabbitz Mar 26, 2024
d4fe790
chore: update cell data comparator (#1704)
rabbitz Mar 27, 2024
22fa20b
fix: contract transaction sort order field (#1705)
rabbitz Mar 27, 2024
b7217a5
Feat/rgb (#1706)
rabbitz Mar 28, 2024
7ea1ed4
fix: remove address transactions fast page (#1707)
rabbitz Mar 28, 2024
0a18a9f
chore: update tip block height cache (#1708)
rabbitz Mar 28, 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
6 changes: 5 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

# -------------------------------- CKB segment --------------------------------
# very important, ckb config items
# mainnet | testnet
Expand Down Expand Up @@ -116,4 +117,7 @@ CI="false"

# -------------------------------- portfolio segment --------------------------------
AUTH_ACCESS_EXPIRE=1296000
SECRET_KEY_BASE=""
SECRET_KEY_BASE=""

# -------------------------------- Bitcoin segment --------------------------------
BITCOIN_NODE_URL=""
7 changes: 5 additions & 2 deletions .github/workflows/merge-master-to-develop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Merge master to develop

permissions:
pull-requests: write

on:
push:
branches:
Expand All @@ -16,8 +19,8 @@ jobs:
with:
source_branch: master
destination_branch: develop
pr_title: 'Merge released ${{ github.ref }} into develop'
pr_title: "Merge released ${{ github.ref }} into develop"
pr_reviewer: keith-cy
pr_label: auto-pr
pr_body: ':crown: *Anautomated PR*'
pr_body: ":crown: *Anautomated PR*"
github_token: ${{ secrets.GITHUB_TOKEN }}
13 changes: 8 additions & 5 deletions .github/workflows/request-to-deploy-mainnet.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Request to deploy mainnet

permissions:
pull-requests: write

on:
push:
branches: [testnet]
Expand All @@ -13,9 +16,9 @@ jobs:
- name: Request PR
uses: repo-sync/pull-request@v2
with:
source_branch: 'testnet'
destination_branch: 'master'
pr_title: 'Deploy to mainnet'
pr_reviewer: 'rabbitz,zmcNotafraid,keith-cy'
pr_label: 'auto-pr'
source_branch: "testnet"
destination_branch: "master"
pr_title: "Deploy to mainnet"
pr_reviewer: "rabbitz,zmcNotafraid,keith-cy"
pr_label: "auto-pr"
github_token: ${{ secrets.GITHUB_TOKEN }}
13 changes: 8 additions & 5 deletions .github/workflows/request-to-deploy-testnet.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Request to deploy testnet

permissions:
pull-requests: write

on:
push:
branches: [develop]
Expand All @@ -13,9 +16,9 @@ jobs:
- name: Request PR
uses: repo-sync/pull-request@v2
with:
source_branch: 'develop'
destination_branch: 'testnet'
pr_title: 'Deploy to testnet'
pr_reviewer: 'rabbitz,zmcNotafraid,keith-cy'
pr_label: 'auto-pr'
source_branch: "develop"
destination_branch: "testnet"
pr_title: "Deploy to testnet"
pr_reviewer: "rabbitz,zmcNotafraid,keith-cy"
pr_label: "auto-pr"
github_token: ${{ secrets.GITHUB_TOKEN }}
51 changes: 26 additions & 25 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.1.2"

gem "net-smtp"
gem "net-imap"
gem "net-pop"
gem "net-smtp"
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.0.4"
# Use postgresql as the database for Active Record
Expand Down Expand Up @@ -41,14 +41,14 @@ gem "config"
gem "ckb-sdk-ruby", git: "https://github.com/nervosnetwork/ckb-sdk-ruby.git", require: "ckb"

# Redis
gem "digest-crc"
gem "hiredis" # , "~> 0.6.3"
gem "redis" # , "~> 4.2.0"
gem "hiredis-client"
gem "digest-crc"
gem "redis" # , "~> 4.2.0"

# Background Jobs
gem "sidekiq"
gem "rufus-scheduler"
gem "sidekiq"
# bulk insertion of data into database using ActiveRecord
gem "activerecord-import"

Expand All @@ -66,10 +66,10 @@ gem "with_advisory_lock"

gem "nokogiri", ">= 1.11.0.rc4"

gem "sentry-ruby"
gem "newrelic_rpm"
gem "sentry-rails"
gem "sentry-ruby"
gem "sentry-sidekiq"
gem "newrelic_rpm"

gem "bigdecimal"

Expand All @@ -78,52 +78,53 @@ gem "rack-attack"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem "pry"
gem "pry-rails"
gem "pry-byebug"
gem "factory_bot_rails"
gem "faker"
gem "pry"
gem "pry-byebug"
gem "pry-rails"
# gem "pry-nav"
end

group :test do
gem "simplecov", require: false
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 "vcr"
gem "webmock"
gem "database_cleaner"
gem "database_cleaner-active_record"
gem "mocha"
gem "codecov", require: false
end

group :development do
gem "listen", ">= 3.0.5"
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem "spring"
gem "spring-watcher-listen"
gem "annotate"
gem "awesome_print", require: false
gem "rubocop", require: false
gem "rubocop-rails", require: false
gem "rubocop-performance", require: false
gem "awesome_print", require: false
gem "annotate"
gem "rubocop-rails", require: false
gem "solargraph"
gem "spring"
gem "spring-watcher-listen"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem "redis-objects", ">= 2.0.0.beta"
gem "pagy"
gem "http"
gem "rack-cache"
gem "dalli"
gem "after_commit_everywhere"
gem "dalli"
gem "http"
gem "kredis"
gem "pagy"
gem "rack-cache"
gem "redis-objects", ">= 2.0.0.beta"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]

gem "async-websocket", "~> 0.22.1", require: false
gem "ecdsa"
gem "jwt"

gem "active_interaction", "~> 5.3"
gem "bitcoinrb", require: "bitcoin"
31 changes: 31 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,28 @@ GEM
protocol-websocket (~> 0.9.1)
awesome_print (1.9.2)
backport (1.2.0)
base32 (0.3.4)
bech32 (1.4.2)
thor (>= 1.1.0)
benchmark (0.2.1)
bigdecimal (3.1.4)
bip-schnorr (0.7.0)
ecdsa_ext (~> 0.5.0)
bitcoinrb (1.4.0)
base32 (>= 0.3.4)
bech32 (>= 1.3.0)
bip-schnorr (>= 0.5.0)
daemon-spawn
ecdsa_ext (~> 0.5.0)
eventmachine
eventmachine_httpserver
ffi
iniparse
json_pure (>= 2.3.1)
leb128 (~> 1.0.0)
murmurhash3 (~> 0.1.7)
siphash
thor
bootsnap (1.13.0)
msgpack (~> 1.2)
builder (3.2.4)
Expand All @@ -132,6 +152,7 @@ GEM
crack (0.4.5)
rexml
crass (1.0.6)
daemon-spawn (0.4.2)
dalli (3.2.3)
database_cleaner (2.0.1)
database_cleaner-active_record (~> 2.0.0)
Expand Down Expand Up @@ -184,9 +205,13 @@ GEM
zeitwerk (~> 2.6)
e2mmap (0.1.0)
ecdsa (1.2.0)
ecdsa_ext (0.5.1)
ecdsa (~> 1.2.0)
erubi (1.11.0)
et-orbi (1.2.7)
tzinfo
eventmachine (1.2.7)
eventmachine_httpserver (0.2.1)
factory_bot (6.2.1)
activesupport (>= 5.0.0)
factory_bot_rails (6.2.0)
Expand Down Expand Up @@ -223,12 +248,14 @@ GEM
http-form_data (2.3.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
iniparse (1.5.0)
io-event (1.1.6)
jaro_winkler (1.5.4)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.3)
json_pure (2.7.1)
jwt (2.7.1)
kaminari (1.2.2)
activesupport (>= 4.1.0)
Expand All @@ -249,6 +276,7 @@ GEM
kredis (1.3.0.1)
activesupport (>= 6.0.0)
redis (>= 4.2, < 6)
leb128 (1.0.0)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -273,6 +301,7 @@ GEM
mocha (2.0.2)
ruby2_keywords (>= 0.0.5)
msgpack (1.6.0)
murmurhash3 (0.1.7)
net-http-persistent (4.0.2)
connection_pool (~> 2.2)
net-imap (0.3.1)
Expand Down Expand Up @@ -428,6 +457,7 @@ GEM
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
siphash (0.0.1)
solargraph (0.49.0)
backport (~> 1.2)
benchmark
Expand Down Expand Up @@ -485,6 +515,7 @@ DEPENDENCIES
async-websocket (~> 0.22.1)
awesome_print
bigdecimal
bitcoinrb
bootsnap
ckb-sdk-ruby!
codecov
Expand Down
36 changes: 8 additions & 28 deletions app/controllers/api/v1/address_live_cells_controller.rb
Original file line number Diff line number Diff line change
@@ -1,37 +1,17 @@
module Api
module V1
class AddressLiveCellsController < ApplicationController
before_action :validate_pagination_params, :pagination_params
before_action :validate_pagination_params

def show
address = Address.find_address!(params[:id])
raise Api::V1::Exceptions::AddressNotFoundError if address.is_a?(NullAddress)
expires_in 1.minute, public: true, must_revalidate: true, stale_while_revalidate: 10.seconds

order_by, asc_or_desc = live_cells_ordering
@addresses = address.cell_outputs.live.order(order_by => asc_or_desc).page(@page).per(@page_size).fast_page
options = FastJsonapi::PaginationMetaGenerator.new(
request:,
records: @addresses,
page: @page,
page_size: @page_size,
).call
render json: CellOutputSerializer.new(@addresses, options).serialized_json
end

private

def pagination_params
@page = params[:page] || 1
@page_size = params[:page_size] || CellOutput.default_per_page
end

def live_cells_ordering
sort, order = params.fetch(:sort, "block_timestamp.desc").split(".", 2)
if order.nil? || !order.match?(/^(asc|desc)$/i)
order = "asc"
end

[sort, order]
json = Addresses::LiveCells.run!(
{ request:,
key: params[:id], sort: params[:sort],
page: params[:page], page_size: params[:page_size] },
)
render json:
end
end
end
Expand Down
Loading
Loading