blocknetdx / eth-payment-processor

eth-payment-processor
3 stars 4 forks source link

Failed to activate project w/ ETH payment #24

Closed ConanMishler closed 2 years ago

ConanMishler commented 2 years ago

Inspired by the successful activation of a project through aBLOCK payment, I went on to request a new project and activate it via ETH payment. The project_request call yielded this (after rates were intentionally lowered on the server):

{
    "result": {
        "api_key": "yjUZiB-XFzARsgc2t11XuMkEtIJsHh1oAPA0LsbbhA0",
        "expiry_time": "2022-02-15 06:10:01 EST",
        "payment_amount_tier1_aablock": 1.752046,
        "payment_amount_tier1_ablock": 0.390625,
        "payment_amount_tier1_eth": 0.000332,
        "payment_amount_tier2_aablock": 350.409251,
        "payment_amount_tier2_ablock": 78.125,
        "payment_amount_tier2_eth": 0.06631,
        "payment_avax_address": "0xe59C639DA8278599c04503CF511b1adF972c61F3",
        "payment_eth_address": "0xAD0ae3AB7E2Eae865dc1DeE3Fa195Ce13da32650",
        "project_id": "ed7a4642-41f7-4593-86a8-be592ccc9272"
    }
}

Then I sent 0.000332 ETH to the payment_eth_address: https://etherscan.io/tx/0xb8b1c68b18a1b7aac843cfdcac4978a8bd6003c255a4d03d4033dd83b2790653

Then I checked the status of "project_id": "ed7a4642-41f7-4593-86a8-be592ccc9272", only to find it has not become active. ☹️

I'm seeing this in the payment processor logs:

[2022-02-15:02:51:12] CRITICAL - error handling eth back event
Traceback (most recent call last):
  File "/app/manager/util/eth_payments.py", line 164, in eth_start_back
    self.handle_eth_events(events)
  File "<string>", line 2, in handle_eth_events
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 533, in new_func
    result = func(*args, **kwargs)
  File "/app/manager/util/eth_payments.py", line 246, in handle_eth_events
    self.handle_eth_event(event)
  File "/app/manager/util/eth_payments.py", line 385, in handle_eth_event
    payment_obj.project.api_token_count += calc_api_calls(value, 'ablock',
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 2310, in __set__
    new_val = attr.validate(new_val, obj, from_db=False)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 2544, in validate
    val = Attribute.validate(attr, val, obj, entity, from_db)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/core.py", line 2215, in validate
    val = converter.validate(val, obj)
  File "/usr/local/lib/python3.8/site-packages/pony/orm/dbapiprovider.py", line 546, in validate
    throw(ValueError, 'Value %r of attr %s is greater than the maximum allowed value %r'
  File "/usr/local/lib/python3.8/site-packages/pony/utils/utils.py", line 106, in throw
    raise exc
ValueError: Value 2168400007 of attr Project.api_token_count is greater than the maximum allowed value 2147483647
ConanMishler commented 2 years ago

Update: With the most recent changes made in https://github.com/blocknetdx/eth-payment-processor/pull/23, the eth payment I sent yesterday has now been received by the payment processor and yesterday's new project has been activated. However, when I tried to create a new project today and again activate it with eth payment, it failed to activate. This time, however, there are no error messages in the payment processor logs.

Requesting new project yielded:

{
    "result": {
        "api_key": "V_tXZtkliAj-AOmp0vzYWwJQDxEbVmI49MqHFWefVGs",
        "expiry_time": "2022-02-16 20:20:49 EST",
        "payment_amount_tier1_aablock": 1.626546,
        "payment_amount_tier1_ablock": 0.390625,
        "payment_amount_tier1_eth": 0.000327,
        "payment_amount_tier2_aablock": 325.309115,
        "payment_amount_tier2_ablock": 78.125,
        "payment_amount_tier2_eth": 0.065453,
        "payment_avax_address": "0x953F1bF38602D8D92C264b5aaC40bf0a98BF88d2",
        "payment_eth_address": "0xDa70fa5ce40871A8De493613798D086963cba996",
        "project_id": "5fbfcb02-a185-4dd6-97fc-936564d834c0"
    }
}

So I sent the requested amount of ETH to the payment_eth_address: https://etherscan.io/tx/0x5aeb6219c57a0c499cb2484fb67549a8b1dd7d0439b89b660c1c13f7e3884eea

But alas, the payment was never acknowledged by the payment processor and the project remains inactive. :-(

ConanMishler commented 2 years ago

@shrnkld Any particular reason this was reopened? Did you recently test this? Are you using the latest payment processor?:

image: blocknetdx/eth-payment-processor:latest

Can you post the most recent log messages of the payment processor?:

docker logs exrproxy-env_eth_payment_api_1 -n 100
shrnkld commented 2 years ago

Re-opened in error. Closed again. (I was testing a new github integration)