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

[bitcoin-move][breaking]Refactor ordinals inscription updater #2500

Merged
merged 10 commits into from
Aug 26, 2024

Conversation

jolestar
Copy link
Contributor

@jolestar jolestar commented Aug 24, 2024

Summary

  1. Add copy and drop to SimpleMap and SimpleMultiMap.
  2. Follow the ordinals inscription_updater to implement inscription_updater in Move.
  3. Add id(InscriptionID), location(SatPoint), charms(u16) fields in Inscription. cc @popcnt1 @yubing744
  4. Add unbound_inscription_count and lost_sats in InscriptionStore. cc @popcnt1

part of #2402 and #2403

Copy link

vercel bot commented Aug 24, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rooch-portal ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 26, 2024 7:21am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
rooch ⬜️ Ignored (Inspect) Visit Preview Aug 26, 2024 7:21am

Copy link

github-actions bot commented Aug 24, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

//let input = vector::borrow(txinput, input_idx);
let utxo = vector::borrow_mut(input_utxos, input_idx);
if (is_coinbase){
total_input_value = total_input_value + ord::subsidy_by_height(block_height);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果是 coinbase 交易,应该在累加 total_input_value后continue,继续循环执行,对应的 utxo为 null utxo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复了

new: option::some(FlotsamNew{
cursed: option::is_some(&curse) && !jubilant,
fee: 0,
//TODO should we handle the hidden
Copy link
Collaborator

@baichuan3 baichuan3 Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hidden 字段和home_inscription没有特别看明白,不过看inscriptions_updater.rs实现,貌似对offset没有影响

let output = vector::borrow(txoutput, output_idx);
let value = types::txout_value(output);
let output_script_buf = types::txout_script_pubkey(output);
let is_op_return = script_buf::is_op_return(output_script_buf);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ordinal原始实现里没有处理 op_return

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

最新的代码里有了。

break
};

let new_satpoint = ord::new_satpoint(types::new_outpoint(txid, (output_idx as u32)), flotsam.offset - output_value);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_satpoint的计算比较复杂,看了几遍,总觉得跟 ordinal 实现有差异,需要测试用例覆盖

@jolestar jolestar changed the title Refactor ordinals Refactor ordinals inscription updater Aug 25, 2024
@jolestar jolestar marked this pull request as ready for review August 25, 2024 18:11
@jolestar jolestar changed the title Refactor ordinals inscription updater [bitcoin-move][breaking]Refactor ordinals inscription updater Aug 25, 2024
sequence_number: src.sequence_number,
inscription_number: src.inscription_number.unsigned_abs(),
is_curse: src.inscription_number.is_negative(),
//TODO how to get charms
Copy link
Collaborator

@popcnt1 popcnt1 Aug 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For statedb/genesis: could export charms from ordinal index

@@ -136,6 +143,9 @@ pub(crate) fn create_genesis_inscription_store_object(
let inscription_store = InscriptionStore {
cursed_inscription_count,
blessed_inscription_count,
//TODO set unbound_inscription_count and lost_sats
unbound_inscription_count: 0,
lost_sats: 0,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For statedb/genesis: count lost_sats by charm flag

Copy link
Contributor Author

@jolestar jolestar Aug 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants