hirosystems / ordhook

Build indexers, standards and protocols on top of Ordinals and Inscriptions (BRC20, etc).
Apache License 2.0
180 stars 55 forks source link

I noticed an issue where ordhook v2.1.0 is missing the `inscription_id` field #279

Closed ybeetle8 closed 5 months ago

ybeetle8 commented 6 months ago

I noticed an issue where ordhook v2.1.0 is missing the inscription_id field compared to ordhook v2.0.0 when parsing a transaction. Here's a detailed comparison of how each version parses the transaction:

Here's the transaction link: https://mempool.space/zh/testnet/tx/71c963a142ec90b0798b7425c6f4e6405e167de9efc701fa49610a47b52f3073

ordhook v2.0.0 parsing output:

"metadata": {
    "ordinal_operations": [
        {
            "transferred": {
                "destination": {
                    "type": "transferred",
                    "value": "tb1q93uhqgwzpe5um0fc3uffdm24dx2km2g7f37ev9"
                },
                "inscription_id": "301135058dbc681ba4eb95881aefbc75e05731d85980402cebb0d52770dc5344i0",
                "post_transfer_output_value": 10000,
                "satpoint_post_transfer": "71c963a142ec90b0798b7425c6f4e6405e167de9efc701fa49610a47b52f3073:1:0",
                "satpoint_pre_transfer": "301135058dbc681ba4eb95881aefbc75e05731d85980402cebb0d52770dc5344:0:0",
                "tx_index": 101
            }
        }
    ],
    "proof": null
}

ordhook v2.1.0 parsing output:

"metadata": {
    "ordinal_operations": [
        {
            "inscription_transferred": {
                "destination": {
                    "type": "transferred",
                    "value": "tb1q93uhqgwzpe5um0fc3uffdm24dx2km2g7f37ev9"
                },
                "ordinal_number": 1366987679634613,
                "post_transfer_output_value": 10000,
                "satpoint_post_transfer": "71c963a142ec90b0798b7425c6f4e6405e167de9efc701fa49610a47b52f3073:1:0",
                "satpoint_pre_transfer": "301135058dbc681ba4eb95881aefbc75e05731d85980402cebb0d52770dc5344:0:0",
                "tx_index": 101
            }
        }
    ],
    "proof": null
}

Clearly, the inscription_id field is missing in the output parsed by ordhook v2.1.0.

lgalabru commented 5 months ago

Hi @ybeetle8! You are right, and this is feature, not a bug. Since the Jubilee, ordinals already inscribed, being re-inscribed are tolerated by the consensus, making re-inscriptions more common than before. To minimize the amount of transfers in the (already heavy) payloads, we are now informing that "an inscribed satoshi is being transferred", instead of having n transfers for the n inscriptions attached to a given satoshi. I hope it'll make sense!

liushmh commented 5 months ago

hi @lgalabru in this case, I see inscription_id field is replaced with ordinal_number in creating table https://github.com/hirosystems/ordhook/blob/2a4ce1ff6eddba6b3dca9a859733e9f0fa3190d3/components/ordhook-core/src/db/mod.rs#L109

but for some queries, such as find_all_inscription_transfers, nscription_id and remove_entry_from_inscriptions inscription_id is still used https://github.com/hirosystems/ordhook/blob/2a4ce1ff6eddba6b3dca9a859733e9f0fa3190d3/components/ordhook-core/src/db/mod.rs#L942

it will cause an error, how can I deal with it?

thanks

liushmh commented 5 months ago

ok, I think after Jubilee, there is no query transfers by inscription_id, right? @lgalabru

lgalabru commented 5 months ago

Correct!