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

Merged
merged 4 commits into from
Aug 27, 2024
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
4 changes: 2 additions & 2 deletions app/workers/xudt_tag_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class XudtTagWorker
include Sidekiq::Job

def perform
udts = Udt.published_xudt.left_joins(:xudt_tag).where(xudt_tag: { id: nil }).limit(100)
udts = Udt.published_xudt.left_joins(:xudt_tag).where(xudt_tag: { id: nil }).where.not(issuer_address: nil).limit(100)
if !udts.empty?
attrs =
udts.map do |udt|
Expand Down Expand Up @@ -46,7 +46,7 @@ def invisible_char?(symbol)
end

def out_of_length?(symbol)
symbol.length > 5 || symbol.length < 4
symbol.length > 60
end

def first_xudt?(symbol, block_timestamp)
Expand Down
10 changes: 6 additions & 4 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
:redis_cache_store, {
url: ENV["REDIS_URL"],
driver: :hiredis,
namespace: ENV["CACHE_NAMESPACE"]
namespace: ENV["CACHE_NAMESPACE"],
}

# Use a real queuing backend for Active Job (and separate queues per environment).
Expand All @@ -77,7 +77,7 @@
authentication: "plain",
enable_starttls_auto: true,
open_timeout: 5,
read_timeout: 5
read_timeout: 5,
}

# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
Expand All @@ -103,9 +103,11 @@
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false

client = Dalli::Client.new(ENV["MEMCACHED_URL"],
value_max_bytes: 10485760)
config.action_dispatch.rack_cache = {
verbose: true,
metastore: File.join(ENV["MEMCACHED_URL"], "meta"),
entitystore: File.join(ENV["MEMCACHED_URL"], "body")
metastore: client,
entitystore: client,
}
end
6 changes: 5 additions & 1 deletion test/factories/udt.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
symbol { "kfc" }
decimal { 6 }
h24_ckb_transactions_count { 0 }
issuer_address do
script = CKB::Types::Script.new(code_hash: Settings.secp_cell_type_hash, args: "0x#{SecureRandom.hex(20)}",
hash_type: "type")
CKB::Address.new(script).generate
end

trait :with_transactions do
after(:create) do |udt, _evaluator|
Expand Down Expand Up @@ -71,6 +76,5 @@
symbol { "XC" }
decimal { 8 }
end

end
end
2 changes: 1 addition & 1 deletion test/workers/xudt_tag_worker_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class XudtTagWorkerTest < ActiveJob::TestCase
end

test "insert out-of-length-range tag" do
create(:udt, :xudt, symbol: "CK BBBB")
create(:udt, :xudt, symbol: "CKBBBB" * 11)
assert_changes -> { XudtTag.count }, from: 0, to: 1 do
XudtTagWorker.new.perform
end
Expand Down
Loading