Skip to content
This repository has been archived by the owner on Mar 28, 2023. It is now read-only.

(#2002, 2005, 2006, 2012) Handle zero mod fee #2018

Merged
merged 7 commits into from
Mar 6, 2020
Merged

Conversation

amangale
Copy link
Collaborator

@amangale amangale commented Mar 4, 2020

This PR fixes issue #2002 #2005 #2006 #2012

@amangale amangale requested a review from cpacia March 4, 2020 19:45
@OB1Bot
Copy link
Collaborator

OB1Bot commented Mar 4, 2020

Can one of the admins verify this patch?

@coveralls
Copy link

coveralls commented Mar 4, 2020

Coverage Status

Coverage decreased (-0.006%) to 41.561% when pulling d630f09 on zero_mod_fee into cae0bf0 on ethereum-master.

@drwasho drwasho added ethereum Ethereum integration-related issues. 🔍 readyForReview Issue or PR ready for code review prior to closing. labels Mar 4, 2020
@drwasho drwasho changed the title Handle zero mod fee (#2012, 2005, 2006) Handle zero mod fee Mar 4, 2020
@drwasho drwasho changed the title (#2012, 2005, 2006) Handle zero mod fee (#2005, 2006, 2012) Handle zero mod fee Mar 4, 2020
@drwasho drwasho linked an issue Mar 4, 2020 that may be closed by this pull request
@drwasho drwasho changed the title (#2005, 2006, 2012) Handle zero mod fee (#2002, 2005, 2006, 2012) Handle zero mod fee Mar 4, 2020
@drwasho
Copy link
Member

drwasho commented Mar 5, 2020

Moderator settings:

{
    "description": "I am test moderator.",
    "termsAndConditions": "Will moderate anything and everything legal.",
    "languages": [
        "English",
        "Spanish"
    ],
    "fee": {
        "feeType": "PERCENTAGE",
        "percentage": 0
    },
    "acceptedCurrencies": [
        "TBTC",
        "TBCH",
        "TLTC",
        "TZEC",
        "TETH"
    ]
}

✅ Normal moderated tx test:

image

✅ Split dispute payout (buyer disputed @ AWAITING_FULFILLMENT)

image

✅ Split dispute payout (buyer disputed @ FULFILLED)

image

✅ Split dispute payout (seller disputed @ FULFILLED)

image

^ confirmed on Etherscan

@drwasho
Copy link
Member

drwasho commented Mar 5, 2020

Moderator settings:

{
    "description": "I am test moderator.",
    "termsAndConditions": "Will moderate anything and everything legal.",
    "languages": [
        "English",
        "Spanish"
    ],
    "fee": {
        "feeType": "FIXED_PLUS_PERCENTAGE",
        "percentage": 0,
        "fixedFee": {
            "bigAmount": "0",
            "amountCurrency": {
                "code": "USD",
                "divisibility": 2
            }
        }
    },
    "acceptedCurrencies": [
        "TBTC",
        "TBCH",
        "TLTC",
        "TZEC",
        "TETH"
    ]
}

Same tests as the previous comment passed, the only wrinkle was for seller dispute split payout:

image

The bug corresponded with this error in stdout:

goroutine 50816 [running]:
runtime/debug.Stack(0x4a3ae8b, 0xc000317590, 0x1)
        /usr/local/go/src/runtime/debug/stack.go:24 +0xa7
runtime/debug.PrintStack()
        /usr/local/go/src/runtime/debug/stack.go:16 +0x22
github.com/OpenBazaar/openbazaar-go/api.(*jsonAPIHandler).ServeHTTP.func1()
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/api/jsonapi.go:176 +0x10b
panic(0x534e980, 0xc002ba82a0)
        /usr/local/go/src/runtime/panic.go:513 +0x1b9
github.com/OpenBazaar/openbazaar-go/vendor/github.com/OpenBazaar/go-ethwallet/wallet.(*EthereumWallet).GetConfirmations(0xc0005103f0, 0xa1312759756ad8ef, 0x938647fc7a833d81, 0x12d943684e24e588, 0xa2e6a5f67e3b519e, 0x0, 0x0, 0x0)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/vendor/github.com/OpenBazaar/go-ethwallet/wallet/wallet.go:1449 +0x7c1
github.com/OpenBazaar/openbazaar-go/core.(*OpenBazaarNode).BuildTransactionRecords(0xc00064d320, 0xc002e6a0c0, 0xc003d8de40, 0x3, 0x4, 0xc00000000c, 0x3, 0x4, 0x0, 0xc000da57d0, ...)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/core/utils.go:55 +0x374
github.com/OpenBazaar/openbazaar-go/core.(*OpenBazaarNode).GetOrder(0xc00064d320, 0xc0015e691e, 0x2e, 0xa, 0xc0015e691e, 0x2e)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/core/order.go:92 +0x4fb
github.com/OpenBazaar/openbazaar-go/api.(*jsonAPIHandler).GETOrder(0xc00062ea00, 0x5a14ca0, 0xc000c96b60, 0xc00292ea00)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/api/jsonapi.go:1725 +0x6c
github.com/OpenBazaar/openbazaar-go/api.get(0xc00062ea00, 0xc001ab3a40, 0x38, 0x5a14ca0, 0xc000c96b60, 0xc00292ea00)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/api/endpoints.go:165 +0xcc3
github.com/OpenBazaar/openbazaar-go/api.(*jsonAPIHandler).ServeHTTP(0xc00062ea00, 0x5a14ca0, 0xc000c96b60, 0xc00292ea00)
        /Users/drwasho/Work/go/src/github.com/OpenBazaar/openbazaar-go/api/jsonapi.go:183 +0x766
net/http.(*ServeMux).ServeHTTP(0xc0017725a0, 0x5a14ca0, 0xc000c96b60, 0xc00292ea00)
        /usr/local/go/src/net/http/server.go:2361 +0x127
net/http.serverHandler.ServeHTTP(0xc00161c410, 0x5a14ca0, 0xc000c96b60, 0xc00292ea00)
        /usr/local/go/src/net/http/server.go:2741 +0xab
net/http.(*conn).serve(0xc00246e000, 0x5a167a0, 0xc002200340)
        /usr/local/go/src/net/http/server.go:1847 +0x646
created by net/http.(*Server).Serve
        /usr/local/go/src/net/http/server.go:2851 +0x2f5

Despite this, the funds were still successfully received and making the same API call a few minutes later was successful.

@drwasho
Copy link
Member

drwasho commented Mar 5, 2020

Tests passing with moderator settings:

{
    "description": "I am test moderator.",
    "termsAndConditions": "Will moderate anything and everything legal.",
    "languages": [
        "English",
        "Spanish"
    ],
    "fee": {
        "feeType": "FIXED",
        "fixedFee": {
            "bigAmount": "0",
            "amountCurrency": {
                "code": "USD",
                "divisibility": 2
            }
        }
    },
    "acceptedCurrencies": [
        "TBTC",
        "TBCH",
        "TLTC",
        "TZEC",
        "TETH"
    ]
}

@drwasho
Copy link
Member

drwasho commented Mar 5, 2020

Normal moderator settings are also working:

{
    "description": "I am test moderator.",
    "termsAndConditions": "Will moderate anything and everything legal.",
    "languages": [
        "English",
        "Spanish"
    ],
    "fee": {
        "feeType": "FIXED_PLUS_PERCENTAGE",
        "percentage": 1,
        "fixedFee": {
            "bigAmount": "10",
            "amountCurrency": {
                "code": "USD",
                "divisibility": 2
            }
        }
    },
    "acceptedCurrencies": [
        "TBTC",
        "TBCH",
        "TLTC",
        "TZEC",
        "TETH"
    ]
}

@cpacia cpacia merged commit 1c9222c into ethereum-master Mar 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ethereum Ethereum integration-related issues. 🔍 readyForReview Issue or PR ready for code review prior to closing.
Projects
None yet
5 participants