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

Occupied capacity incorrect/unintuitive on cell. #1589

Open
jordanmack opened this issue Jan 18, 2024 · 2 comments
Open

Occupied capacity incorrect/unintuitive on cell. #1589

jordanmack opened this issue Jan 18, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jordanmack
Copy link

Describe the bug

When I look at the "declared" and "occupied" amounts, either they do not intuitively make sense to me, or the amounts are incorrect.

I assume "declared" to mean the total amount of CKB within the cell. I would suggest using the more standard term of "capacity" here. If it has some other meaning I am unclear on it. It says 145 CKBytes which seems to indicate the capacity.

I assume "occupied" is the amount of data actually used by the data within the cell. It says 128 CKBytes, which does not seem to add up as I would expect.

To Reproduce

  1. Go to https://explorer.nervos.org/transaction/0x20826a6762a40a9bda477c84464999ba5e1e7c4ca29c2659c3c5c065fd5b33a9
  2. Click on Cell Info for Output 1.
  3. Click on Capacity Usage.

Expected behavior
Here is the lock script, type script, and data:

Lock Script
{
    "code_hash": "0xd00c84f0ec8fd441c38bc3f87a371f547190f2fcff88e642bc5bf54b9e318323",
    "args": "0x00017170e87d1b34d166745b7274e0105a3fe7100a04",
    "hash_type": "type"
}

In the lock script the code_hash is 32 bytes, args is 22 bytes, hash_type is 1 byte. This is 55 bytes total.

Type Script
{
    "code_hash": "0x50bd8d6680b8b9cf98b73f3c08faf8b2a21914311954118ad6609be6e78a1b95",
    "args": "0x8a0d5884ef2b7bf7e6c06c32482015b4eb0985f9cc4112c12a20ca36716066c6",
    "hash_type": "data1"
}

In the type script the code_hash is 32 bytes, args is 32 bytes, hash_type is 1 byte. This is 65 bytes total.

Data
{
    "data": "0x00ca9a3b000000000000000000000000"
}

The data is 16 bytes total.

The capacity field of the cell is 8 bytes total.

Field Occupied
Lock Script 55 bytes
Type Script 65 bytes
Data 16 bytes
Capacity 8 bytes
Total 144 bytes

This does not match the "occupied" capacity of "128 CKBytes".

Screenshots
20240117235046

@jordanmack jordanmack added the bug Something isn't working label Jan 18, 2024
@Keith-CY Keith-CY self-assigned this Jan 18, 2024
@Keith-CY
Copy link
Collaborator

@Danie0918 @Sven-TBD please check this issue

@Danie0918
Copy link

This was found to be a bug after troubleshooting by @zmcNotafraid :

For transactions with 'Pending' status, occupied is not counted in the size of data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants