Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds an escrow module for swaping starnames and tokens #98

Merged
merged 82 commits into from
Nov 15, 2021

Conversation

LeCodeurDuDimanche
Copy link
Contributor

This PR introduces a new x/escrow module that allows to sell objects (that can be starname Accounts and Domains) for tokens.
This module is independent of the x/starname module (it has a dependency over x/configuration for now, but when #31 will be fixed it will not be the case anymore).

Blocked by #95 and #97
Closes #29

Now after the escrow expiration, anyone can ask fo refund of the escrow (which will still be refunded to the seller), and anyone can buy from an escrow
Adds SDK parameters support for escrow and adds a ModuleEnabled parameter which determines if the escrow queries and services can be used or not. If ModuleEnabled is false, then all those calls panic
@davepuchyr davepuchyr removed the merge when green See: https://github.com/phstc/probot-merge-when-green/ label Jul 29, 2021
@davepuchyr
Copy link
Contributor

I started sync'ing iov-mainnet-ibc with version v0.10.12 and it expectedly halted at block 4598000. Then, I upgraded to this PR's version of starnamed and got the following error. (My app.toml has pruning = "everything".)

Jul 30 11:29:25 systemd[1]: Started Starname Asset Name Service.
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF starting ABCI with Tendermint
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting multiAppConn service impl=multiAppConn module=proxy
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting localClient service connection=query impl=localClient module=abci-client
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting localClient service connection=snapshot impl=localClient module=abci-client
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting localClient service connection=mempool impl=localClient module=abci-client
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting localClient service connection=consensus impl=localClient module=abci-client
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting EventBus service impl=EventBus module=events
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting PubSub service impl=PubSub module=pubsub
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Starting IndexerService service impl=IndexerService module=txindex
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF ABCI Handshake App Info hash="��*}\ve�\ft)v3��\\��ߖN\n\x1a�á\x00��\x10�\x16�" height=4597999 module=consensus protocol-version=0 software-version=
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF ABCI Replay Blocks appHeight=4597999 module=consensus stateHeight=4597999 storeHeight=4598000
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF Replay last block using real app module=consensus
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF applying upgrade "fix-cosmos-sdk-migrate-bug" at height: 4598000
Jul 30 11:29:25 starnamed[1798186]: 11:29AM INF executed block height=4598000 module=consensus num_invalid_txs=0 num_valid_txs=0
Jul 30 11:29:25 starnamed[1798186]: panic: cannot delete latest saved version (1)
Jul 30 11:29:25 starnamed[1798186]: goroutine 1 [running]:
Jul 30 11:29:25 starnamed[1798186]: github.com/cosmos/cosmos-sdk/store/rootmulti.(*Store).pruneStores(0xc001110b40)
Jul 30 11:29:25 starnamed[1798186]:         github.com/cosmos/[email protected]/store/rootmulti/store.go:388 +0x26e
Jul 30 11:29:25 starnamed[1798186]: github.com/cosmos/cosmos-sdk/store/rootmulti.(*Store).Commit(0xc001110b40, 0x4628f0, 0x0, 0xc002b0c160, 0x71374491c28a2f98)
Jul 30 11:29:25 starnamed[1798186]:         github.com/cosmos/[email protected]/store/rootmulti/store.go:362 +0x1c6
Jul 30 11:29:25 starnamed[1798186]: github.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).Commit(0xc001103860, 0x0, 0x0, 0x0, 0x0)
Jul 30 11:29:25 starnamed[1798186]:         github.com/cosmos/[email protected]/baseapp/abci.go:293 +0x27c
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/abci/client.(*localClient).CommitSync(0xc001305bc0, 0x0, 0x0, 0x0)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/abci/client/local_client.go:258 +0xab
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/proxy.(*appConnConsensus).CommitSync(0xc000fc3150, 0x0, 0x0, 0x1051f6f)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/proxy/app_conn.go:93 +0x33
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/state.(*BlockExecutor).Commit(0xc000e48fc0, 0xb, 0x0, 0x0, 0x0, 0xc0006b0a00, 0xf, 0x418818, 0x4628f0, 0xc001a32500, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/state/execution.go:228 +0x244
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/state.(*BlockExecutor).ApplyBlock(0xc000e48fc0, 0xb, 0x0, 0x0, 0x0, 0xc0006b0a00, 0xf, 0x418818, 0x4628f0, 0xc001a32500, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/state/execution.go:180 +0x725
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/consensus.(*Handshaker).replayBlock(0xc00066c2a0, 0xb, 0x0, 0x0, 0x0, 0xc0006b0a00, 0xf, 0x418818, 0x4628ef, 0xc0006b4060, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/consensus/replay.go:503 +0x292
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/consensus.(*Handshaker).ReplayBlocks(0xc00066c2a0, 0xb, 0x0, 0x0, 0x0, 0xc0006b0a00, 0xf, 0x418818, 0x4628ef, 0xc0006b4060, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/consensus/replay.go:416 +0xd79
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/consensus.(*Handshaker).Handshake(0xc00066c2a0, 0x2364a68, 0xc0001b4750, 0x1f4, 0xc0012fe190)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/consensus/replay.go:268 +0x458
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/node.doHandshake(0x2360930, 0xc000fc3480, 0xb, 0x0, 0x0, 0x0, 0xc0006b0a00, 0xf, 0x418818, 0x4628ef, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/node/node.go:308 +0x1d8
Jul 30 11:29:25 starnamed[1798186]: github.com/tendermint/tendermint/node.NewNode(0xc000fb9900, 0x2340160, 0xc001111d60, 0xc000268c50, 0x230a980, 0xc0016a9cc8, 0xc000268cc0, 0x210d4c0, 0xc000268db0, 0x2349c68, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/tendermint/[email protected]/node/node.go:715 +0x2025
Jul 30 11:29:25 starnamed[1798186]: github.com/cosmos/cosmos-sdk/server.startInProcess(0xc0010cc620, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x2352a88, 0xc000fd8800, ...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/cosmos/[email protected]/server/start.go:244 +0x585
Jul 30 11:29:25 starnamed[1798186]: github.com/cosmos/cosmos-sdk/server.StartCmd.func2(0xc001045180, 0xc000fe2460, 0x0, 0x7, 0x0, 0x0)
Jul 30 11:29:25 starnamed[1798186]:         github.com/cosmos/[email protected]/server/start.go:120 +0x209
Jul 30 11:29:25 starnamed[1798186]: github.com/spf13/cobra.(*Command).execute(0xc001045180, 0xc000fe23f0, 0x7, 0x7, 0xc001045180, 0xc000fe23f0)
Jul 30 11:29:25 starnamed[1798186]:         github.com/spf13/[email protected]/command.go:852 +0x472
Jul 30 11:29:25 starnamed[1798186]: github.com/spf13/cobra.(*Command).ExecuteC(0xc000f7ec80, 0x1e247db, 0x2, 0xc000197140)
Jul 30 11:29:25 starnamed[1798186]:         github.com/spf13/[email protected]/command.go:960 +0x375
Jul 30 11:29:25 starnamed[1798186]: github.com/spf13/cobra.(*Command).Execute(...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/spf13/[email protected]/command.go:897
Jul 30 11:29:25 starnamed[1798186]: github.com/spf13/cobra.(*Command).ExecuteContext(...)
Jul 30 11:29:25 starnamed[1798186]:         github.com/spf13/[email protected]/command.go:890
Jul 30 11:29:25 starnamed[1798186]: main.Execute(0xc000f7ec80, 0xc000197140, 0x14, 0x2366538, 0xc000f71480)
Jul 30 11:29:25 starnamed[1798186]:         github.com/iov-one/starnamed/cmd/wasmd/execute.go:38 +0x28f
Jul 30 11:29:25 starnamed[1798186]: main.main()
Jul 30 11:29:25 starnamed[1798186]:         github.com/iov-one/starnamed/cmd/wasmd/main.go:13 +0x45
Jul 30 11:29:25 systemd[1]: starnamed.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Jul 30 11:29:25 systemd[1]: starnamed.service: Failed with result 'exit-code'.

@davepuchyr davepuchyr marked this pull request as draft July 31, 2021 08:24
@davepuchyr
Copy link
Contributor

Still no go after your latest fix when trying to start from a recent (post proposal 9) block.

Aug 05 10:05:09 systemd[1]: Started Starname Asset Name Service.
Aug 05 10:05:09 starnamed[530898]: 10:05AM INF starting ABCI with Tendermint
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting multiAppConn service impl=multiAppConn module=proxy
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting localClient service connection=query impl=localClient module=abci-client
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting localClient service connection=snapshot impl=localClient module=abci-client
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting localClient service connection=mempool impl=localClient module=abci-client
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting localClient service connection=consensus impl=localClient module=abci-client
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting EventBus service impl=EventBus module=events
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting PubSub service impl=PubSub module=pubsub
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting IndexerService service impl=IndexerService module=txindex
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF ABCI Handshake App Info hash="��̢E�r\x10�@��UJ��KW?}�v\x03���D�+=�N" height=4827830 module=consensus protocol-version=0 software-version=
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF ABCI Replay Blocks appHeight=4827830 module=consensus stateHeight=4827830 storeHeight=4827830
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Completed ABCI Handshake - Tendermint and App are synced appHash="��̢E�r\x10�@��UJ��KW?}�v\x03���D�+=�N" appHeight=4827830 module=consensus
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Version info block=11 p2p=8 software=
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF This node is not a validator addr=05482EF679ABDF890791DDEC85EF1654A74240A4 module=consensus pubKey=Sc+rAT9cNygdo6ZKbj1OW2J+a9kYmW9tvlDyjS0bZ3U=
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF P2P Node ID ID=6890366d31eac1588077e8f9bd413c9001acd088 file=/home/iov/iov-mainnet-ibc/config/node_key.json module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Adding persistent peers addrs=["0fd08a878b26544a6d487456815e55b0f2350028@debt:16656","[email protected]:16656","[email protected]:26656","[email protected]:26656","[email protected]:26656","[email protected]:16656","[email protected]:16656","[email protected]:26656","[email protected]:26656","[email protected]:26656"] module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Adding unconditional peer ids ids=[] module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Add our address to book addr={"id":"6890366d31eac1588077e8f9bd413c9001acd088","ip":"0.0.0.0","port":16656} book=/home/iov/iov-mainnet-ibc/config/addrbook.json module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting Node service impl=Node
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting pprof server laddr=localhost:6060
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting RPC HTTP server on [::]:16657 module=rpc-server
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting P2P Switch service impl="P2P Switch" module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting Evidence service impl=Evidence module=evidence
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting StateSync service impl=StateSync module=statesync
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting PEX service impl=PEX module=pex
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting AddrBook service book=/home/iov/iov-mainnet-ibc/config/addrbook.json impl=AddrBook module=p2p
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting Mempool service impl=Mempool module=mempool
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting BlockchainReactor service impl=BlockchainReactor module=blockchain
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting BlockPool service impl=BlockPool module=blockchain
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Starting Consensus service impl=ConsensusReactor module=consensus
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Reactor  module=consensus waitSync=true
Aug 05 10:05:10 starnamed[530898]: 10:05AM INF Ensure peers module=pex numDialing=0 numInPeers=0 numOutPeers=0 numToDial=10
...p2p stuff...
Aug 05 10:05:11 starnamed[530898]: 10:05AM INF executed block height=4827831 module=state num_invalid_txs=0 num_valid_txs=0
Aug 05 10:05:11 starnamed[530898]: 10:05AM INF commit synced commit=436F6D6D697449447B5B313038203232372032303020313731203336203134382032303720323037203136312032343220313532203738203236203335203131392031362032323620313538203130352037382031372031323520332031343820313535203136382033203539203235322031343020313831203132385D3A3439414142377D
Aug 05 10:05:11 starnamed[530898]: 10:05AM INF committed state app_hash=6CE3C8AB2494CFCFA1F2984E1A237710E29E694E117D03949BA8033BFC8CB580 height=4827831 module=state num_txs=0
Aug 05 10:05:11 starnamed[530898]: panic: Failed to process committed block (4827832:29DE0B167FBF570D96A34C4E1B12C24FB41EEE47665EA71B05F5482A95A56D92): wrong Block.Header.AppHash.  Expected 6CE3C8AB2494CFCFA1F2984E1A237710E29E694E117D03949BA8033BFC8CB580, got 5366EF056594DC81E81F2ADDA545FC15595CE05F5A8863FFF1FDDC0CD0967983
Aug 05 10:05:11 starnamed[530898]: goroutine 80 [running]:
Aug 05 10:05:11 starnamed[530898]: github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).poolRoutine(0xc000d7ddc0, 0x0)
Aug 05 10:05:11 starnamed[530898]:         github.com/tendermint/[email protected]/blockchain/v0/reactor.go:401 +0x15bf
Aug 05 10:05:11 starnamed[530898]: created by github.com/tendermint/tendermint/blockchain/v0.(*BlockchainReactor).OnStart
Aug 05 10:05:11 starnamed[530898]:         github.com/tendermint/[email protected]/blockchain/v0/reactor.go:110 +0x8c
Aug 05 10:05:11 systemd[1]: starnamed.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Aug 05 10:05:11 systemd[1]: starnamed.service: Failed with result 'exit-code'.

@davepuchyr
Copy link
Contributor

Still no go after your latest fix when trying to start from a recent (post proposal 9) block.

@LeCodeurDuDimanche , the panic is not related to your code. It's caused by going from [email protected] to [email protected].

Copy link
Contributor

@davepuchyr davepuchyr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work, @LeCodeurDuDimanche!

@davepuchyr
Copy link
Contributor

Blocked by v0.10.14 tag.

@davepuchyr davepuchyr removed the blocked label Nov 3, 2021
@davepuchyr davepuchyr marked this pull request as ready for review November 3, 2021 13:59
@davepuchyr davepuchyr self-requested a review November 3, 2021 14:00
@davepuchyr davepuchyr added the merge when green See: https://github.com/phstc/probot-merge-when-green/ label Nov 15, 2021
@merge-when-green merge-when-green bot merged commit d9a64b5 into master Nov 15, 2021
@merge-when-green merge-when-green bot deleted the escrow branch November 15, 2021 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge when green See: https://github.com/phstc/probot-merge-when-green/ v0.11.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add a swap module for exchanging starnames and tokens
2 participants