fixes to make demo work
This commit is contained in:
parent
8636946f80
commit
e578d1f07b
|
@ -44,8 +44,6 @@ func cmdIBCRegisterTx(c *cli.Context) error {
|
|||
}
|
||||
|
||||
func cmdIBCUpdateTx(c *cli.Context) error {
|
||||
parent := c.Parent()
|
||||
|
||||
headerBytes, err := hex.DecodeString(stripHex(c.String("header")))
|
||||
if err != nil {
|
||||
return errors.New(cmn.Fmt("Header (%v) is invalid hex: %v", c.String("header"), err))
|
||||
|
@ -77,7 +75,7 @@ func cmdIBCUpdateTx(c *cli.Context) error {
|
|||
}{ibcTx}))
|
||||
name := "IBC"
|
||||
|
||||
return appTx(parent, name, data)
|
||||
return appTx(c.Parent(), name, data)
|
||||
}
|
||||
|
||||
func cmdIBCPacketCreateTx(c *cli.Context) error {
|
||||
|
@ -126,7 +124,7 @@ func cmdIBCPacketPostTx(c *cli.Context) error {
|
|||
}
|
||||
|
||||
var packet ibc.Packet
|
||||
var proof merkle.IAVLProof
|
||||
proof := new(merkle.IAVLProof)
|
||||
|
||||
if err := wire.ReadBinaryBytes(packetBytes, &packet); err != nil {
|
||||
return errors.New(cmn.Fmt("Error unmarshalling packet: %v", err))
|
||||
|
|
|
@ -81,10 +81,10 @@ func cmdBlock(c *cli.Context) error {
|
|||
return errors.New(cmn.Fmt("Height must be an int, got %v: %v", heightString, err))
|
||||
}
|
||||
|
||||
block, err := getBlock(c, height)
|
||||
/*block, err := getBlock(c, height)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}*/
|
||||
nextBlock, err := getBlock(c, height+1)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -95,11 +95,11 @@ func cmdBlock(c *cli.Context) error {
|
|||
JSON BlockJSON `json:"json"`
|
||||
}{
|
||||
BlockHex{
|
||||
Header: wire.BinaryBytes(block.Header),
|
||||
Header: wire.BinaryBytes(nextBlock.Header),
|
||||
Commit: wire.BinaryBytes(nextBlock.LastCommit),
|
||||
},
|
||||
BlockJSON{
|
||||
Header: block.Header,
|
||||
Header: nextBlock.Header,
|
||||
Commit: nextBlock.LastCommit,
|
||||
},
|
||||
})))
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"app_hash": "",
|
||||
"chain_id": "test-chain-AtzVUw",
|
||||
"chain_id": "test_chain_1",
|
||||
"genesis_time": "0001-01-01T00:00:00.000Z",
|
||||
"validators": [
|
||||
{
|
||||
|
@ -12,4 +12,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"app_hash": "",
|
||||
"chain_id": "test-chain-cLhwLM",
|
||||
"chain_id": "test_chain_2",
|
||||
"genesis_time": "0001-01-01T00:00:00.000Z",
|
||||
"validators": [
|
||||
{
|
||||
|
@ -12,4 +12,4 @@
|
|||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ basecoin start --address tcp://localhost:36658 --ibc-plugin --dir ./data/chain2/
|
|||
echo ""
|
||||
echo "... waiting for chains to start"
|
||||
echo ""
|
||||
sleep 5
|
||||
sleep 10
|
||||
|
||||
echo "... registering chain1 on chain2"
|
||||
echo ""
|
||||
|
@ -57,18 +57,30 @@ QUERY_RESULT=$(basecoin query ibc,egress,$CHAIN_ID1,$CHAIN_ID2,1)
|
|||
HEIGHT=$(echo $QUERY_RESULT | jq .height)
|
||||
PACKET=$(echo $QUERY_RESULT | jq .value)
|
||||
PROOF=$(echo $QUERY_RESULT | jq .proof)
|
||||
PACKET=$(removeQuotes $PACKET)
|
||||
PROOF=$(removeQuotes $PROOF)
|
||||
echo ""
|
||||
echo "QUERY_RESULT: $QUERY_RESULT"
|
||||
echo "HEIGHT: $HEIGHT"
|
||||
echo "PACKET: $PACKET"
|
||||
echo "PROOF: $PROOF"
|
||||
|
||||
|
||||
echo ""
|
||||
echo "... waiting for some blocks to be mined"
|
||||
echo ""
|
||||
sleep 5
|
||||
|
||||
echo ""
|
||||
echo "... querying for block data"
|
||||
echo ""
|
||||
# get the header and commit for the height
|
||||
HEADER_AND_COMMIT=$(basecoin block $HEIGHT)
|
||||
HEADER=$(echo $HEADER_AND_COMMIT | jq.hex.header)
|
||||
COMMIT=$(echo $HEADER_AND_COMMIT | jq.hex.commit)
|
||||
HEADER=$(echo $HEADER_AND_COMMIT | jq .hex.header)
|
||||
HEADER=$(removeQuotes $HEADER)
|
||||
COMMIT=$(echo $HEADER_AND_COMMIT | jq .hex.commit)
|
||||
COMMIT=$(removeQuotes $COMMIT)
|
||||
echo ""
|
||||
echo "HEADER_AND_COMMIT: $HEADER_AND_COMMIT"
|
||||
echo "HEADER: $HEADER"
|
||||
echo "COMMIT: $COMMIT"
|
||||
|
@ -83,4 +95,10 @@ echo ""
|
|||
echo "... posting packet from chain1 on chain2"
|
||||
echo ""
|
||||
# post the packet from chain1 to chain2
|
||||
basecoin ibc --amount 10 $CHAIN_FLAGS2 packet post --from $CHAIN_ID1 --height $HEIGHT --packet $PACKET --proof $PROOF
|
||||
basecoin ibc --amount 10 $CHAIN_FLAGS2 packet post --from $CHAIN_ID1 --height $((HEIGHT + 1)) --packet 0x$PACKET --proof 0x$PROOF
|
||||
|
||||
echo ""
|
||||
echo "... checking if the packet is present on chain2"
|
||||
echo ""
|
||||
# query for the packet on chain2 !
|
||||
basecoin query --node tcp://localhost:36657 ibc,ingress,test_chain_2,test_chain_1,1
|
||||
|
|
|
@ -337,7 +337,7 @@ func (sm *IBCStateMachine) runPacketPostTx(tx IBCPacketPostTx) {
|
|||
}
|
||||
if !exists {
|
||||
sm.res.Code = IBCCodeUnknownHeight
|
||||
sm.res.Log = cmn.Fmt("Loading Header: %v", err.Error())
|
||||
sm.res.Log = cmn.Fmt("Loading Header: Unknown height")
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue