OriginProtocol / origin-bridge

We've moved to a monorepo: https://github.com/OriginProtocol/origin/tree/master/infra/bridge
MIT License
15 stars 7 forks source link

Not all events are being indexed #90

Closed tyleryasaka closed 6 years ago

tyleryasaka commented 6 years ago

I could be doing something wrong, but it appears that not all the events are being indexed. In the origin-box setup, only 1 listing and 2 purchases are indexed (regardless of how many new listings you create).

The listing endpoint is http://localhost:5000/api/listing The purchase endpoint is http://localhost:5000/api/purchase

That's where you can see the indexed events.

In the demo dapp (http://localhost:3000), you can see the actual listings/purchases.

ambertch commented 6 years ago

On the box I'm currently running, I see for listings:

{ "num_results": 5, "objects": [ { "contract_address": "0x2C8afBb062e16F0C5cFecAe5c032314A6038c611", "created_at": null, "expired": null, "expires_at": null, "ipfs_data": { "category": "Vacation Rentals", "description": "Built on the slopes of Hualalai Mountain in Kailua, Hawaii, the Mamalahoa Estate knows how to make a first impression. You enter the property through a grove of citrus and macadamia trees. A floating walkway takes you across a koi pond, surrounded by lush greenery and a waterfall. Once inside, the 5,391-square-foot home is comprised of a master and two guest suites, each with a private staircase leading down to the garden courtyard. A chef's kitchen with koa cabinetry looks onto a double-height living area. Flanked by sliding doors, the room opens to a veranda that overlooks two swimming pools and the Kona coastline. Consisting of 90 acres, the grounds also feature a driving range, tennis court, bocce courts, and a three-car garage.", "location": "Kailua, Hawaii, US", "name": "MAMALAHOA ESTATE", "price": 8.5 }, "ipfs_hash": "QmZtQDL4UjQWryQLjsS5JUsbdbn2B27Tmvz2gvLkw7wmmb", "owner_address": "0xf17f52151EbEF6C7334FAD080c5704D77216b732", "price": "8.50", "registry_id": null, "units": 1 }, { "contract_address": "0x4E205e04A1A8f230702fe51f3AfdCC38aafB0f3C", "created_at": null, "expired": null, "expires_at": null, "ipfs_data": { "category": "Music", "datetime": "2018-05-26T19:00:00.000Z", "description": "Taylor Swift's Reputation Stadium Tour is the fifth world concert tour by American singer-songwriter Taylor Swift, in support of her sixth studio album, Reputation.", "location": "Sports Authority Field at Mile High, Denver, CO, USA", "name": "Taylor Swift's Reputation Tour", "price": 0.3 }, "ipfs_hash": "QmfXRgtSbrGggApvaFCa88ofeNQP79G18DpWaSW1Wya1u8", "owner_address": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", "price": "0.30", "registry_id": null, "units": 23 }, { "contract_address": "0x5677DB552d5Fd9911a5560CB0Bd40Be90a70EFf2", "created_at": null, "expired": null, "expires_at": null, "ipfs_data": { "category": "Vacation Rentals", "description": "Due to multiple limitations, the Zinc House goes against tradition to capture the best views of the sea. The contemporary structure is comprised of four interlocking volumes. A white wing houses the garage, leading to a two-story zinc entrance hall. From here, the home flips the conventional layout, putting bedrooms on the ground floor and the main living area above in a timber-clad box. Flanked by glazed panels, the kitchen and living room can overlook the garden in the rear and the coast ahead.", "location": "-8.640509, 179.073778", "name": "Zinc House", "price": 3.999 }, "ipfs_hash": "QmTfozaMrUBZdYBzPgxuSC15zBRgLCEfQmWFZwmDHYGY1e", "owner_address": "0xf17f52151EbEF6C7334FAD080c5704D77216b732", "price": "3.00", "registry_id": null, "units": 1 }, { "contract_address": "0x9390BCAc10a3FE3B85947A5780d68a2c805dEA64", "created_at": null, "expired": null, "expires_at": null, "ipfs_data": { "category": "Cars & Trucks", "description": "Introduced in 1971, the International Scout II rode on a stretched-wheelbase version of the rugged Scout chassis as a competitor to trucks like the larger Chevrolet Blazer. The highly customizable Scout was popular for work and racing, taking home a class win in the 1977 Baja 1000. This restored beautifully restored 1977 Scout II's customizations run more than skin deep, with a 6.0-liter GM engine and transmission to go along with the wheels and suspension lift.", "location": "Los Angeles, CA, USA", "name": "1977 INTERNATIONAL SCOUT II", "price": 0.6 }, "ipfs_hash": "QmZD8wZWEqzKwvEtGWXzCb3MuXvmxLdCxXGHMRocQFnpoy", "owner_address": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", "price": "0.60", "registry_id": null, "units": 1 }, { "contract_address": "0xABEBF5e71a6Cd15136c56141dE7d495757cC21e3", "created_at": null, "expired": null, "expires_at": null, "ipfs_data": { "category": "Vacation Rentals", "description": "Overlooking Lake Llanquihue, Casa Wulf is inspired by the terrain. The home sits on a steep slope. This lead to its three-story design, creating a natural balcony facing the water. Among the levels, the main living area is at the center, with the bedrooms above and a basement workshop below. Each floor was constructed using a different system, resulting in a range of facades. Their orientation takes advantage of the incoming sunlight and while also exposing the interiors to the surrounding landscape.", "location": "-41.010387, -72.763702", "name": "Casa Wolf", "price": 1.5 }, "ipfs_hash": "QmVYeipL2JWFkpWsGqNNXDFUVAmPWEEK8u3Q45CZ1YrZPf", "owner_address": "0x627306090abaB3A6e1400e9345bC60c78a8BEf57", "price": "1.50", "registry_id": null, "units": 1 } ], "page": 1, "total_pages": 1 }

and purchases:

{ "num_results": 3, "objects": [ { "buyer_address": "0x821aEa9a577a9b44299B9c15c88cf3087F3b5544", "buyer_timeout": "2018-07-10T18:28:58+00:00", "contract_address": "0x10A5C71EAF20dcFfD20C3fafb34183f57bEB2EB8", "created_at": "2018-06-19T18:28:58+00:00", "listing_address": "0x4E205e04A1A8f230702fe51f3AfdCC38aafB0f3C", "stage": "3" }, { "buyer_address": "0xC5fdf4076b8F3A5357c5E395ab970B5B54098Fef", "buyer_timeout": "2018-07-10T18:28:58+00:00", "contract_address": "0x125068bdf1807019822eF4095AB6F83A222B3cCE", "created_at": "2018-06-19T18:28:57+00:00", "listing_address": "0x4E205e04A1A8f230702fe51f3AfdCC38aafB0f3C", "stage": "2" }, { "buyer_address": "0xC5fdf4076b8F3A5357c5E395ab970B5B54098Fef", "buyer_timeout": "1970-01-01T00:00:00+00:00", "contract_address": "0xCa163A64f8c3d8A6c15A46f95DA492476Ef3E613", "created_at": "2018-06-19T18:28:57+00:00", "listing_address": "0x4E205e04A1A8f230702fe51f3AfdCC38aafB0f3C", "stage": "1" } ], "page": 1, "total_pages": 1 }

What happens if you do the following:

  1. stop origin-js and the worker process: pm2 stop origin-js pm2 stop celery
  2. reset the blockchain data: pm2 start origin-js
  3. tail the logs, wait for origin-js to complete startup: pm2 logs origin-js
  4. run the worker pm2 start celery, wait for a run to complete (> 10 seconds)

Also, something of a nitpick, though if following REST conventions should the endpoints for retrieving all items be /listings and purchases?

tyleryasaka commented 6 years ago

@ambertch Tried your steps, same result. I'll keep looking into it.

Agree on the nitpick. I created an issue for it. https://github.com/OriginProtocol/bridge-server/issues/91

tyleryasaka commented 6 years ago

@ambertch Tried again today and was able to get everything working. I think it had something to do with contract ABIs getting out of sync during development. Thanks for your help!