Skip to content

Commit

Permalink
Merge pull request #2240 from nervosnetwork/develop
Browse files Browse the repository at this point in the history
Deploy to testnet
  • Loading branch information
zmcNotafraid authored Oct 14, 2024
2 parents 148b60a + 498fa1e commit ae13f10
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions app/models/ckb_sync/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def xudt_code_hash
Settings.xudt_code_hash
end

def xudt_data_hash
Settings.xudt_data_hash
end

def xudt_compatible_code_hashes
[Settings.xudt_compatible_code_hash, Settings.xudt_compatible2_code_hash]
end
Expand Down
5 changes: 2 additions & 3 deletions app/models/ckb_sync/new_node_data_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,8 @@ def build_udts!(local_block, outputs, outputs_data)
end
end
if udts_attributes.present?
returning_attrs = Udt.insert_all!(udts_attributes.map! do |attr|
attr.merge!(created_at: Time.current, updated_at: Time.current)
end, returning: %w[id udt_type type_hash])
unique_udt_attributes = udts_attributes.uniq { |ua| ua[:type_hash] }
returning_attrs = Udt.insert_all!(unique_udt_attributes, record_timestamps: true, returning: %w[id udt_type type_hash])
omiga_inscription_info_attrs = returning_attrs.rows.filter do |r|
r[1] == 4
end.map do |k|
Expand Down
9 changes: 6 additions & 3 deletions app/utils/ckb_utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@ def self.cell_type(type_script, output_data)
[
*CkbSync::Api.instance.spore_cluster_code_hashes,
*CkbSync::Api.instance.spore_cell_code_hashes,
].include?(type_script&.code_hash) && type_script&.hash_type == "data1" ||
CkbSync::Api.instance.mode == CKB::MODE::MAINNET && [CkbSync::Api.instance.xudt_code_hash,
CkbSync::Api.instance.unique_cell_code_hash].include?(type_script&.code_hash) && type_script&.hash_type == "data1"
CkbSync::Api.instance.xudt_data_hash,
CkbSync::Api.instance.xudt_code_hash,
CkbSync::Api.instance.unique_cell_code_hash,
].include?(type_script&.code_hash) && type_script&.hash_type == "data1"

case type_script&.code_hash
when Settings.dao_code_hash, Settings.dao_type_hash
Expand Down Expand Up @@ -464,6 +465,8 @@ def self.cell_type(type_script, output_data)
"xudt"
end
end
when CkbSync::Api.instance.xudt_data_hash
"xudt"

Check warning on line 469 in app/utils/ckb_utils.rb

View check run for this annotation

Codecov / codecov/patch

app/utils/ckb_utils.rb#L469

Added line #L469 was not covered by tests
when CkbSync::Api.instance.unique_cell_code_hash
"unique_cell"
else
Expand Down
3 changes: 1 addition & 2 deletions config/settings.mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ omiga_inscription_code_hash: "0x7490970e6af9b9fe63fc19fc523a12b2ec69027e6ae484ed

# xudt
xudt_code_hash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95"
unique_cell_code_hash: "0x2c8c11c985da60b0a330c61a85507416d6382c130ba67f0c47ab071e00aec628"

# xudt compatible
xudt_compatible_code_hash: "0x092c2c4a26ea475a8e860c29cf00502103add677705e2ccd8d6fe5af3caa5ae3"
xudt_compatible2_code_hash: "0x26a33e0815888a4a0614a0b7d09fa951e0993ff21e55905510104a0b1312032b"

unique_cell_code_hash: "0x2c8c11c985da60b0a330c61a85507416d6382c130ba67f0c47ab071e00aec628"

# hash length of an attribute(especially which comes from bytea column),
# e.g. Block.uncle_block_hashes: "0x587f354162afd133b4a4f7a4b621d11e043c3c08b0af2801f1686b5403b14953", which has a length of 66 ( 2 + 64)
default_hash_length: "64"
Expand Down
1 change: 1 addition & 0 deletions config/settings.testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ omiga_inscription_info_code_hash: "0x50fdea2d0030a8d0b3d69f883b471cab2a29cae6f01
omiga_inscription_code_hash: "0x3a241ceceede72a5f55c8fb985652690f09a517d6c9070f0df0d3572fa03fb70"
# xudt
xudt_code_hash: "0x25c29dc317811a6f6f3985a7a9ebc4838bd388d19d0feeecf0bcd60f6c0975bb"
xudt_data_hash: "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95"
unique_cell_code_hash: "0x8e341bcfec6393dcd41e635733ff2dca00a6af546949f70c57a706c0f344df8b"

# xudt compatible
Expand Down

0 comments on commit ae13f10

Please sign in to comment.