diff --git a/build/main.go b/build/main.go index bbbcf1fd27..bb9f325b5c 100644 --- a/build/main.go +++ b/build/main.go @@ -50,6 +50,7 @@ func deps() { "go get -u github.com/alecthomas/gometalinter", "gometalinter --install", "go get -u github.com/stretchr/testify", + "go get -u github.com/xeipuuv/gojsonschema", } for _, name := range list { diff --git a/commands/actor.go b/commands/actor.go index efcda6dba1..cc6fda990a 100644 --- a/commands/actor.go +++ b/commands/actor.go @@ -7,9 +7,9 @@ import ( "io" "reflect" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" + "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/core" "github.com/filecoin-project/go-filecoin/node" diff --git a/commands/actor_daemon_test.go b/commands/actor_daemon_test.go index ed90303b75..262e4b7cad 100644 --- a/commands/actor_daemon_test.go +++ b/commands/actor_daemon_test.go @@ -3,10 +3,12 @@ package commands import ( "bytes" "encoding/json" + "os" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/xeipuuv/gojsonschema" ) func TestActorDaemon(t *testing.T) { @@ -20,14 +22,33 @@ func TestActorDaemon(t *testing.T) { op1 := d.RunSuccess("actor", "ls", "--enc", "json") result1 := op1.ReadStdoutTrimNewlines() + wd, _ := os.Getwd() + schemaLoader := gojsonschema.NewReferenceLoader("file://" + wd + "/schema/actor_ls.schema.json") + var avs []actorView for _, line := range bytes.Split([]byte(result1), []byte{'\n'}) { + // test that json conforms to our schema + jsonLoader := gojsonschema.NewBytesLoader(line) + result, err := gojsonschema.Validate(schemaLoader, jsonLoader) + require.NoError(err) + + assert.True(result.Valid()) + for _, desc := range result.Errors() { + t.Errorf("- %s\n", desc) + } + + // unmarshall JSON to actor view an add to slice var av actorView - err := json.Unmarshal(line, &av) + err = json.Unmarshal(line, &av) require.NoError(err) avs = append(avs, av) } assert.NotZero(len(avs)) + + // Expect the second actor to be an account actor and to have no exports. + // This checks that a bug that gave all actors the same as the first has been fixed. + assert.Equal("AccountActor", avs[1].ActorType) + assert.Equal(0, len(avs[1].Exports)) }) } diff --git a/commands/actor_test.go b/commands/actor_test.go index 4c61db4236..30f57a2bbb 100644 --- a/commands/actor_test.go +++ b/commands/actor_test.go @@ -2,13 +2,16 @@ package commands import ( "context" + "encoding/json" + "os" "testing" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" - hamt "gx/ipfs/QmdtiofXbibTe6Day9ii5zjBZpSRm8vhfoerrNuY3sAQ7e/go-hamt-ipld" + "gx/ipfs/QmdtiofXbibTe6Day9ii5zjBZpSRm8vhfoerrNuY3sAQ7e/go-hamt-ipld" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + "github.com/xeipuuv/gojsonschema" "github.com/filecoin-project/go-filecoin/core" "github.com/filecoin-project/go-filecoin/node" @@ -92,6 +95,51 @@ func TestActorLs(t *testing.T) { assert.Equal("MinerActor", actorViews[2].ActorType) assert.Equal("UnknownActor", actorViews[3].ActorType) }) + + validateActorView := func(a *actorView, sl gojsonschema.JSONLoader) (*gojsonschema.Result, error) { + jsonBytes, err := json.Marshal(a) + if err != nil { + return nil, err + } + jsonLoader := gojsonschema.NewBytesLoader(jsonBytes) + + return gojsonschema.Validate(sl, jsonLoader) + } + + assertSchemaValid := func(t *testing.T, a *actorView, sl gojsonschema.JSONLoader) { + assert := assert.New(t) + require := require.New(t) + + result, err := validateActorView(a, sl) + require.NoError(err) + + assert.True(result.Valid()) + for _, desc := range result.Errors() { + t.Errorf("- %s\n", desc) + } + } + + t.Run("Emitted AccountActor JSON conforms to schema", func(t *testing.T) { + + wd, _ := os.Getwd() + schemaLoader := gojsonschema.NewReferenceLoader("file://" + wd + "/schema/actor_ls.schema.json") + + actor, _ := core.NewAccountActor(types.NewTokenAmount(100)) + a := makeActorView(actor, "address", &core.AccountActor{}) + + assertSchemaValid(t, a, schemaLoader) + + actor, _ = core.NewStorageMarketActor() + a = makeActorView(actor, "address", &core.StorageMarketActor{}) + + assertSchemaValid(t, a, schemaLoader) + + addr, _ := types.NewAddressFromString("minerAddress") + actor, _ = core.NewMinerActor(addr, types.NewBytesAmount(50000), types.NewTokenAmount(200)) + a = makeActorView(actor, "address", &core.MinerActor{}) + + assertSchemaValid(t, a, schemaLoader) + }) } func TestPresentExports(t *testing.T) { diff --git a/commands/address.go b/commands/address.go index 7bdddc8312..7117e893bf 100644 --- a/commands/address.go +++ b/commands/address.go @@ -5,7 +5,7 @@ import ( "io" "math/big" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/types" diff --git a/commands/bootstrap.go b/commands/bootstrap.go index 0f246901f5..00892e77e9 100644 --- a/commands/bootstrap.go +++ b/commands/bootstrap.go @@ -6,7 +6,7 @@ import ( config "github.com/filecoin-project/go-filecoin/config" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ) diff --git a/commands/chain.go b/commands/chain.go index ba8062bb85..77fb85999a 100644 --- a/commands/chain.go +++ b/commands/chain.go @@ -4,8 +4,8 @@ package commands import ( "context" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" diff --git a/commands/chain_test.go b/commands/chain_test.go index f7d797c834..8779f30c65 100644 --- a/commands/chain_test.go +++ b/commands/chain_test.go @@ -5,8 +5,8 @@ import ( "encoding/json" "testing" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" "github.com/stretchr/testify/assert" diff --git a/commands/client.go b/commands/client.go index 493f543116..52bb1a038f 100644 --- a/commands/client.go +++ b/commands/client.go @@ -5,9 +5,9 @@ import ( "fmt" "io" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" chunk "gx/ipfs/QmWo8jYc19ppG7YoTsrr2kEtLRbARTJho5oNXFTR6B7Peq/go-ipfs-chunker" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" cid "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" diff --git a/commands/daemon.go b/commands/daemon.go index c7de58c2f9..fae7694207 100644 --- a/commands/daemon.go +++ b/commands/daemon.go @@ -8,8 +8,8 @@ import ( "os/signal" "time" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" - cmdhttp "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds/http" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" + cmdhttp "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds/http" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/config" diff --git a/commands/dag.go b/commands/dag.go index 60393c1b87..74293064dc 100644 --- a/commands/dag.go +++ b/commands/dag.go @@ -5,8 +5,8 @@ import ( "context" "time" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" diff --git a/commands/dag_test.go b/commands/dag_test.go index 06fa5e84cf..0979e77d80 100644 --- a/commands/dag_test.go +++ b/commands/dag_test.go @@ -4,7 +4,7 @@ import ( "context" "testing" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" ipld "gx/ipfs/Qme5bWv7wtjUNGsK2BNGVUFPKiuxWrsqrtvYwCLRw8YFES/go-ipld-format" diff --git a/commands/env.go b/commands/env.go index d0ce44199f..9eb201384e 100644 --- a/commands/env.go +++ b/commands/env.go @@ -3,7 +3,7 @@ package commands import ( "context" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "github.com/filecoin-project/go-filecoin/node" ) diff --git a/commands/id.go b/commands/id.go index 19cedf2bdf..3dad66c739 100644 --- a/commands/id.go +++ b/commands/id.go @@ -6,7 +6,7 @@ import ( "io" "strings" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/node" diff --git a/commands/init.go b/commands/init.go index 9d0cf60ad4..df139e3447 100644 --- a/commands/init.go +++ b/commands/init.go @@ -5,8 +5,8 @@ import ( "io" "os" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" errors "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/config" diff --git a/commands/main.go b/commands/main.go index 568bacae4e..b4bc814b24 100644 --- a/commands/main.go +++ b/commands/main.go @@ -5,8 +5,8 @@ import ( "net" "os" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" - cmdhttp "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds/http" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" + cmdhttp "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds/http" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ) diff --git a/commands/main_test.go b/commands/main_test.go index 575409b2ee..22cdc6a6e5 100644 --- a/commands/main_test.go +++ b/commands/main_test.go @@ -5,7 +5,7 @@ import ( "net" "testing" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "github.com/stretchr/testify/assert" ) diff --git a/commands/message.go b/commands/message.go index 21f8e79230..906b805024 100644 --- a/commands/message.go +++ b/commands/message.go @@ -5,8 +5,8 @@ import ( "fmt" "io" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" diff --git a/commands/miner.go b/commands/miner.go index b5d9da4d94..5b6b903bbd 100644 --- a/commands/miner.go +++ b/commands/miner.go @@ -3,8 +3,8 @@ package commands import ( "io" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmVmDhyTTUcQXFD1rRQ64fGLMSAoaQvNH3hwuaCFAPq2hy/errors" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" diff --git a/commands/mining.go b/commands/mining.go index 0a4d694df5..2c9887a6f7 100644 --- a/commands/mining.go +++ b/commands/mining.go @@ -5,7 +5,7 @@ import ( "fmt" "io" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" "gx/ipfs/QmcZfnkapfECQGcLZaf9B79NRg7cRa9EnZh4LSbkCzwNvY/go-cid" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" diff --git a/commands/mpool.go b/commands/mpool.go index cb6c41be22..737db33bf3 100644 --- a/commands/mpool.go +++ b/commands/mpool.go @@ -4,7 +4,7 @@ import ( "fmt" "io" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/types" diff --git a/commands/orderbook.go b/commands/orderbook.go index 619f727322..1de926fb18 100644 --- a/commands/orderbook.go +++ b/commands/orderbook.go @@ -4,7 +4,7 @@ import ( "encoding/json" "io" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/core" diff --git a/commands/ping.go b/commands/ping.go index 4a1e456689..bcb06caadc 100644 --- a/commands/ping.go +++ b/commands/ping.go @@ -7,7 +7,7 @@ import ( "time" "gx/ipfs/QmNh1kGFFdsPu79KNSaL4NUKUPb4Eiz4KHdMtFY6664RDp/go-libp2p/p2p/protocol/ping" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" peer "gx/ipfs/QmZoWKhxUmZ2seW4BzX6fJkNR8hh9PsGModr7q171yq2SS/go-libp2p-peer" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ) diff --git a/commands/run.go b/commands/run.go index d317a841d8..623a52970d 100644 --- a/commands/run.go +++ b/commands/run.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" - cmdsCli "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds/cli" + "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" + cmdsCli "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds/cli" "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ) diff --git a/commands/schema/actor_ls.schema.json b/commands/schema/actor_ls.schema.json new file mode 100644 index 0000000000..d6f6fd2380 --- /dev/null +++ b/commands/schema/actor_ls.schema.json @@ -0,0 +1,164 @@ +{ + "definitions": { + "Export": { + "type": "object", + "properties": { + "Params": { "type": "array", "items": { "type": "string" } }, + "Return":{ "type": "array", "items": { "type": "string" } } + }, + "required": ["Params", "Return"], + "additionalProperties": false + }, + "Exports": { + "type": "object", + "additionalProperties": { "$ref": "#/definitions/Export" } + }, + "MinerMemory": { + "type": "object", + "properties": { + "Collateral": { "type": "number" }, + "LockedStorage": { "type": "number" }, + "Owner": { "type": "string" }, + "PledgeBytes": { "type": "number" } + }, + "required": ["Collateral", "LockedStorage", "Owner", "PledgeBytes"] + }, + "StorageMarketMemory": { + "type": "object", + "properties": { + "Filemap": { + "type": "object", + "properties": { + "Deals": { + "type": ["array", "null"], + "items": { + "$ref": "#/definitions/Deal" + } + }, + "Files": { "type": "object" } + }, + "required": ["Deals", "Files"] + }, + "Miners": { + "type": "object", + "additionalProperties": { + "type": "object" + } + }, + "Orderbook": { + "type": "object", + "properties": { + "Asks":{ + "type": "object", + "additionalProperties": { "$ref": "#/definitions/Ask" } + }, + "Bids": { + "type": "object", + "additionalProperties": { "$ref": "#/definitions/Bid" } + }, + "NextAskID": { "type": "number" }, + "NextBidID":{ "type": "number" } + }, + "required": ["Asks", "Bids", "NextAskID", "NextBidID"] + } + }, + "required": ["Miners", "Orderbook"] + }, + "Ask": { + "type": "object", + "properties": { + "id": { "type": "number" }, + "owner": { "type": "string" }, + "price":{ "type": "number" }, + "size": { "type": "number" } + }, + "required": ["id", "owner", "price", "size"] + }, + "Bid": { + "type": "object", + "properties": { + "collateral": { "type": ["number", "null"] }, + "id": { "type": "number" }, + "owner": { "type": "string" }, + "price": { "type": "number" }, + "size":{ "type": "number" }, + "used":{ "type": "boolean" } + }, + "required": ["collateral", "id", "owner", "price", "size", "used"] + }, + "Deal": { + "type": "object", + "properties": { + "ask": { "type": "number" }, + "bid": { "type": "number" } + }, + "required": ["ask", "bid"] + }, + "Cid": { + "type": "object", + "properties": { + "/": { "type": "string" } + }, + "required": ["/"], + "additionalProperties": false + }, + "Actor": { + "type": "object", + "properties": { + "address": { "type": "string" }, + "code": { "$ref": "#/definitions/Cid" }, + "nonce": { "type": "number" }, + "exports": { "$ref": "#/definitions/Exports" }, + "memory": { "type": ["object", "null"] } + }, + "required": ["address", "code", "nonce", "balance", "exports", "actorType", "memory"] + } + }, + "allOf": [ + { + "$ref": "#/definitions/Actor" + }, + { + "oneOf": [ + { + "properties": { + "actorType": { + "type": "string", + "enum": [ + "AccountActor" + ] + }, + "balance": { + "type": "number" + } + }, + "required": [ + "balance" + ] + }, + { + "properties": { + "actorType": { + "type": "string", + "enum": [ + "StorageMarketActor" + ] + }, + "memory": { "$ref": "#/definitions/StorageMarketMemory" } + } + }, + { + "properties": { + "actorType": { + "type": "string", + "enum": [ + "MinerActor" + ] + }, + "memory": { "$ref": "#/definitions/MinerMemory" } + } + } + ] + } + ] +} \ No newline at end of file diff --git a/commands/swarm.go b/commands/swarm.go index a62feba2e0..2628094248 100644 --- a/commands/swarm.go +++ b/commands/swarm.go @@ -7,9 +7,9 @@ import ( "strings" swarm "gx/ipfs/QmSwZMWwFZSUpe5muU2xgTUwppH24KfMwdPXiwbEp2c6G5/go-libp2p-swarm" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" ma "gx/ipfs/QmWWQ2Txc2c6tqjsBpzg5Ar652cHPGNsQQp2SejkNmkUMb/go-multiaddr" pstore "gx/ipfs/QmXauCuJzmzapetmC6W4TuDJLL1yFFrVzSHoWv8YdbmnxH/go-libp2p-peerstore" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" ipfsaddr "gx/ipfs/QmQViVWBHbU6HmYjXcdNq7tVASCNgdg64ZGcauuDkLCivW/go-ipfs-addr" diff --git a/commands/version.go b/commands/version.go index ddeb7fdc44..bc5d55898c 100644 --- a/commands/version.go +++ b/commands/version.go @@ -4,7 +4,7 @@ import ( "fmt" "io" - cmds "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + cmds "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" cmdkit "gx/ipfs/QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM/go-ipfs-cmdkit" "github.com/filecoin-project/go-filecoin/flags" diff --git a/package.json b/package.json index ee54e0b958..ec25004b87 100644 --- a/package.json +++ b/package.json @@ -32,9 +32,9 @@ "version": "0.7.20" }, { - "hash": "QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB", + "hash": "QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ", "name": "go-ipfs-cmds", - "version": "1.1.1" + "version": "1.1.2" }, { "hash": "QmceUdzxkimdYsgtX733uNgzf1DLHyBKN6ehGSp85ayppM", diff --git a/testhelpers/commands.go b/testhelpers/commands.go index 00cf586341..335b316eaa 100644 --- a/testhelpers/commands.go +++ b/testhelpers/commands.go @@ -7,7 +7,7 @@ import ( "io" "strings" - "gx/ipfs/QmYMj156vnPY7pYvtkvQiMDAzqWDDHkfiW5bYbMpYoHxhB/go-ipfs-cmds" + "gx/ipfs/QmUf5GFfV2Be3UtSAPKDVkoRd1TwEBTmx9TSSCFGGjNgdQ/go-ipfs-cmds" ) type writercloser struct {