Origin: VM Execution Error

Created on 6 Sep 2019  路  6Comments  路  Source: OriginProtocol/origin

On https://shoporigin.com/#/purchases/1-000-3118-8492700-1...

Error: GraphQL error: VM execution error.
    at new t (bundle.esm.js:63)
    at t.getCurrentResult (bundle.esm.js:159)
    at t.getQueryResult (react-hooks.esm.js:245)
    at t.a.getExecuteResult (react-hooks.esm.js:71)
    at t.execute (react-hooks.esm.js:88)
    at c (react-hooks.esm.js:344)
    at ko (react-hooks.esm.js:318)
    at xo (react-hooks.esm.js:353)
    at Xo (react-components.esm.js:8)
    at Qi (react-dom.production.min.js:150)
    at ka (react-dom.production.min.js:166)
    at Oa (react-dom.production.min.js:179)
    at zs (react-dom.production.min.js:232)
    at Hs (react-dom.production.min.js:233)
    at Co (react-dom.production.min.js:249)
    at xo (react-dom.production.min.js:248)
    at To (react-dom.production.min.js:245)
    at Ys (react-dom.production.min.js:243)
    at sa (react-dom.production.min.js:157)
    at Object.error (react-hooks.esm.js:221)
    at b (Observable.js:134)
    at v (Observable.js:165)
    at e.value (Observable.js:224)
    at bundle.esm.js:434
    at Array.forEach (<anonymous>)
    at re (bundle.esm.js:434)
    at Object.r [as error] (bundle.esm.js:385)
    at i (bundle.esm.js:1208)
    at bundle.esm.js:1246
    at bundle.esm.js:1558
    at Set.forEach (<anonymous>)
    at bundle.esm.js:1556
    at Map.forEach (<anonymous>)
    at e.broadcastQueries (bundle.esm.js:1554)
    at bundle.esm.js:1645
    at Object.next (Observable.js:308)
    at b (Observable.js:130)
    at v (Observable.js:165)
    at e.value (Observable.js:219)
    at bundle.esm.js:865
    at Set.forEach (<anonymous>)
    at Object.next (bundle.esm.js:865)
    at b (Observable.js:130)
    at v (Observable.js:165)
    at e.value (Observable.js:219)
    at bundle.esm.js:23

@ breadcrumbs.js:58 

  query Offer($offerId: ID!) {
    marketplace {
      offer(id: $offerId) {
        listing {
          ...basicListingFields
        }
        ...basicOfferFields
      }
    }
  }

      fragment basicListingFields on Listing {
        id
        contractAddr
        valid
        validationError
        status
        totalEvents
        seller {
          id
        }
        arbitrator {
          id
        }
        deposit
        depositAvailable
        createdEvent {
          timestamp
        }
        pendingBuyers {
          id
        }

        category
        categoryStr
        subCategory
        title
        description
        currencyId
        price {
          amount
          currency {
            ... on Currency {
              id
            }
          }
        }
        acceptedTokens {
          id
        }
        media {
          url
          urlExpanded
          contentType
        }
        commission
        commissionPerUnit
        ... on UnitListing {
          unitsTotal
          unitsAvailable
          unitsSold
          unitsPending
          multiUnit
        }
        ... on ServiceListing {
          unitsSold
          unitsPending
          unitsAvailable
        }
        ... on FractionalListing {
          weekendPrice {
            amount
            currency {
              ... on Currency {
                id
              }
            }
          }
          booked
          customPricing
          unavailable
        }
        ... on FractionalHourlyListing {
          timeZone
          workingHours
          booked
          customPricing
          unavailable
        }
        ... on GiftCardListing {
          unitsTotal
          unitsAvailable
          unitsSold
          unitsPending
          multiUnit
          retailer
          cardAmount
          issuingCountry
          isDigital
          isCashPurchase
          receiptAvailable
        }
      }


      fragment basicOfferFields on Offer {
        id
        listingId
        offerId
        value
        currency
        quantity
        refund
        commission
        status
        finalizes
        arbitrator {
          id
        }
        affiliate {
          id
        }
        buyer {
          id
        }
        withdrawnBy {
          id
        }
        createdEvent {
          timestamp
        }
        acceptedEvent {
          timestamp
        }
        finalizedEvent {
          timestamp
        }
        withdrawnEvent {
          timestamp
          returnValues {
            party
          }
        }
        disputedEvent {
          timestamp
        }
        rulingEvent {
          timestamp
        }
        statusStr
        startDate
        endDate
        totalPrice {
          amount
          currency {
            ... on Currency {
              id
            }
          }
        }
      }

At Origin, we use ZenHub to manage our engineering tasks and product development. Download their browser extension and check out our open workspace at github.com/originprotocol/origin#zenhub.

P1 bug dapp transaction flow

All 6 comments

The URL is malformed. A valid offer details URL should be:

 https://shoporigin.com/#/purchases/<listing-ID>-<offer-id>

For example https://shoporigin.com/#/purchases/1-000-3127-3

But the URL clicked on was:

 https://shoporigin.com/#/purchases/<listingID>-<blockNumber>-<offerId>

So somehow a blockNumber got inserted in between listingId and offerId, causing the graphql server to interpret blockNumber as an offerId which causes an out of bound access on the Ethereum VM when accessing the structure offers[listingId][offerId]

Now the question is where did this malformed URL come from ?
@joshfraser do you remember what you clicked on ?

Possible scenario:

  • Go to an old offer.
  • Click on view listing
  • The listingId will include the blockNumber (so as to show the version of the listing when the offer was made)
  • Click on "Purchase"

Screen Shot 2019-09-05 at 10 30 07 PM

Screenshot 2019-09-06 15 52 52

Downgrading this because it seems to only affect repeat buyers 鈾伙笍

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davecraige picture davecraige  路  9Comments

micahalcorn picture micahalcorn  路  6Comments

shahthepro picture shahthepro  路  5Comments

mikeshultz picture mikeshultz  路  4Comments

micahalcorn picture micahalcorn  路  8Comments