ethersphere / bee

Bee is a Swarm client implemented in Go. It’s the basic building block for the Swarm network: a private; decentralized; and self-sustaining network for permissionless publishing and access to your (application) data.
https://www.ethswarm.org
BSD 3-Clause "New" or "Revised" License
1.44k stars 338 forks source link

Mismatched Immutable Flag #4519

Open ldeffenb opened 6 months ago

ldeffenb commented 6 months ago

Context

1.18.2 on goerli testnet

Summary

I have a testnet node that has had this stamp for some time now:

  "stamps": [
    {
      "batchID": "45ef9e72cad000467d828bd82b769f63ff848f216013c1866c0270533bc879e3",
      "utilization": 49,
      "usable": true,
      "label": "",
      "depth": 22,
      "amount": "10000000000",
      "bucketDepth": 16,
      "blockNumber": 9446968,
      "immutableFlag": false,
      "exists": true,
      "batchTTL": 1326582
    }

I noticed some errors about this stamp being immutable, so I queried the /batches from the same node. That response says:

    {
      "batchID": "45ef9e72cad000467d828bd82b769f63ff848f216013c1866c0270533bc879e3",
      "value": "5045859328",
      "start": 10116420,
      "owner": "62b32288d5292708de7443f78f6714c95e4c75ff",
      "depth": 22,
      "bucketDepth": 16,
      "immutable": true,
      "batchTTL": 1326582
    },

Expected behavior

I would expect the /stamps and /batches to have the same value for immutable.

Actual behavior

/stamps says it is NOT immutable but /batches says it IS immutable

Steps to reproduce

I wish I knew!

Possible solution

I need to see if I can query the postage contract to see what it says about this stamp, and maybe even track down the purchase transaction to see what it says as well.

ldeffenb commented 6 months ago

Contract says the batch IS immutable: image

ldeffenb commented 6 months ago

The batch was last updated via a copyBatch transaction that shows also that it IS immutable: https://goerli.etherscan.io/tx/0xf9d38c1cd70565accbf3ff815a717e0d5a41a727a79905ea5b3f7bebfee255f1 image

ldeffenb commented 6 months ago

Ah, but the batch was created as NOT immutable! Something in the transfer of the batch between the original and the current contract managed to set the immutable flag on this batch! https://goerli.etherscan.io/tx/0xcdbde8176680b60ea016ab5755d68b74fdbbf577b7ee65c50ba16746a8d31049#eventlog image

n00b21337 commented 5 months ago

The transfer was made with a scraper made in Golang. It reads data from chain, saves it in JSON, and then we have another batch operation that reads that data and creates new stamps from it. Problem is that I am not sure If i have that test migration data anywhere to compare, will try to find it and compare.

I can assume 2 possibilities. that the scrapper got the wrong info somehow, and that the importer didn't read the info properly.

n00b21337 commented 5 months ago

First glance didnt give me wrong info. Some test scrapping looks like these, which looks ok

image