Skip to content
This repository has been archived by the owner on Nov 16, 2022. It is now read-only.

Commit

Permalink
Merge branch 'master' into unmock-copy-non-evm-proof
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanisorn Thongprapaisaeng authored Aug 16, 2020
2 parents 1150c92 + 4cd2d5a commit 8bc1e80
Show file tree
Hide file tree
Showing 54 changed files with 1,874 additions and 879 deletions.
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,47 @@

# Changelog

## [v1.2.1](https://github.com/bandprotocol/bandchain/releases/tag/v1.2.1)

### Chain (Non-consensus)

- (feat) [\#2446](https://github.com/bandprotocol/bandchain/pull/2446) Add migrate command to guanyu version.
- (patch) [\#2465](https://github.com/bandprotocol/bandchain/pull/2465) Upgrade to Cosmos-SDK v0.39.1. + [\#2396](https://github.com/bandprotocol/bandchain/pull/2396) Upgrade to Cosmos-SDK v0.39.1-rc3.
- (chore) [\#2381](https://github.com/bandprotocol/bandchain/pull/2381) test: Add more unit tests in keeper.go.

### Yoda

- (chore) [\#2470](https://github.com/bandprotocol/bandchain/pull/2470) Fix log spam when failed to query tx.
- (impv) [\#2467](https://github.com/bandprotocol/bandchain/pull/2467) Add yoda version in memo tx
- (impv) [\#2463](https://github.com/bandprotocol/bandchain/pull/2463) Remove docker from executor option.

### Emitter & Flusher

- (impv) [\#2466](https://github.com/bandprotocol/bandchain/pull/2466) Change exit code variable type
- (impv) [\#2453](https://github.com/bandprotocol/bandchain/pull/2453) Add index to improve graphql performance
- (bugs) [\#2447](https://github.com/bandprotocol/bandchain/pull/2447) Improve validator votes view performance

### Scan

- (impv) [\#2461](https://github.com/bandprotocol/bandchain/pull/2461) Implemented bottom part of datasouce index page and improved some components.
- (impv) [\#2454](https://github.com/bandprotocol/bandchain/pull/2454) Implemented datasource top part box and created the new tooltip component
- (impv) [\#2449](https://github.com/bandprotocol/bandchain/pull/2449) Adjusted gas limit as msg
- (impv) [\#2448](https://github.com/bandprotocol/bandchain/pull/2448) Implemented All Datasources page with the new grid system.
- (impv) [\#2416](https://github.com/bandprotocol/bandchain/pull/2416) Added more HD Path index for ledger
- (impv) [\#2394](https://github.com/bandprotocol/bandchain/pull/2394) Implemented the msg on TxMobileTable for GUANYU
- (bugs) [\#2383](https://github.com/bandprotocol/bandchain/pull/2383) Support `EditValidator` Message for Wenchang and Guan Yu
- (impv) [\#2380](https://github.com/bandprotocol/bandchain/pull/2380) Fixed case sensitive issue on Validator Homepage.
- (impv) [\#2378](https://github.com/bandprotocol/bandchain/pull/2378) Improved the layout to compatable with small mobile screen
- (impv) [\#2355](https://github.com/bandprotocol/bandchain/pull/2355) Implemented the realtime price function

### Runtime

- (impv) [\#2469](https://github.com/bandprotocol/bandchain/pull/2469) Add field version in success response.

### Owasm

- (impv) [\#2392](https://github.com/bandprotocol/bandchain/pull/2392) Improve ext code structure and fix partial cmp bug

## [v1.2.0](https://github.com/bandprotocol/bandchain/releases/tag/v1.2.0)

### Chain (Consensus)
Expand Down
17 changes: 3 additions & 14 deletions CHANGELOG_UNRELEASED.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,22 @@

### Chain (Non-consensus)

- (patch) [\#2396](https://github.com/bandprotocol/bandchain/pull/2396) Upgrade to Cosmos-SDK v0.39.1-rc3.
- (chore) [\#2381](https://github.com/bandprotocol/bandchain/pull/2381) test: Add more unit tests in keeper.go.

### Yoda

### Emitter & Flusher

### Scan

- (impv) [\#2455](https://github.com/bandprotocol/bandchain/pull/2455) Implement full copy non evm proof
- (impv) [\#2449](https://github.com/bandprotocol/bandchain/pull/2449) Adjusted gas limit as msg
- (impv) [\#2448](https://github.com/bandprotocol/bandchain/pull/2448) Implemented All Datasources page with the new grid system.
- (impv) [\#2416](https://github.com/bandprotocol/bandchain/pull/2416) Added more HD Path index for ledger
- (impv) [\#2394](https://github.com/bandprotocol/bandchain/pull/2394) Implemented the msg on TxMobileTable for GUANYU
- (bugs) [\#2383](https://github.com/bandprotocol/bandchain/pull/2383) Support `EditValidator` Message for Wenchang and Guan Yu
- (impv) [\#2380](https://github.com/bandprotocol/bandchain/pull/2380) Fixed case sensitive issue on Validator Homepage.
- (impv) [\#2378](https://github.com/bandprotocol/bandchain/pull/2378) Improved the layout to compatable with small mobile screen
- (impv) [\#2355](https://github.com/bandprotocol/bandchain/pull/2355) Implemented the realtime price function
- (imprv) [\#2455](https://github.com/bandprotocol/bandchain/pull/2455) Implement full copy non evm proof
- (imprv) [\#2473](https://github.com/bandprotocol/bandchain/pull/2473) Implemented OWASM code tab for OC index page, improved some components
- (imprv) [\#2471](https://github.com/bandprotocol/bandchain/pull/2471) Implemented the all oraclescripts page and refactor some part

### Bridges

### Runtime

### Owasm

- (impv) [\#2392](https://github.com/bandprotocol/bandchain/pull/2392) Improve ext code structure and fix partial cmp bug

### Oracle Binary Encoding (OBI)

### Helpers
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This repository is a [monorepo] containing the reference implementation of BandC

## Running with Docker

There are 2 ways to run bandchian
There are 2 ways to run bandchain

#### Run on 4 validators

Expand Down
2 changes: 1 addition & 1 deletion chain/cmd/bandd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func main() {
// Add subcommands to bandd root cmd.
rootCmd.AddCommand(InitCmd(ctx, cdc, app.NewDefaultGenesisState(), app.DefaultNodeHome))
rootCmd.AddCommand(genutilcli.CollectGenTxsCmd(ctx, cdc, auth.GenesisAccountIterator{}, app.DefaultNodeHome))
rootCmd.AddCommand(genutilcli.MigrateGenesisCmd(ctx, cdc))
rootCmd.AddCommand(MigrateGenesisCmd(ctx, cdc))
rootCmd.AddCommand(genutilcli.GenTxCmd(ctx, cdc, app.ModuleBasics, staking.AppModuleBasic{}, auth.GenesisAccountIterator{}, app.DefaultNodeHome, app.DefaultCLIHome))
rootCmd.AddCommand(genutilcli.ValidateGenesisCmd(ctx, cdc, app.ModuleBasics))
rootCmd.AddCommand(AddGenesisAccountCmd(ctx, cdc, app.DefaultNodeHome, app.DefaultCLIHome))
Expand Down
129 changes: 129 additions & 0 deletions chain/cmd/bandd/migrate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
package main

import (
"fmt"
"io/ioutil"
"time"

"github.com/bandprotocol/bandchain/chain/app"
"github.com/bandprotocol/bandchain/chain/x/oracle"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
errors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/evidence"
extypes "github.com/cosmos/cosmos-sdk/x/genutil"
v038 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v0_38"
v039 "github.com/cosmos/cosmos-sdk/x/genutil/legacy/v0_39"
"github.com/cosmos/cosmos-sdk/x/upgrade"
"github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types"
)

const (
flagGenesisTime = "genesis-time"
flagChainID = "chain-id"
)

// GenesisDocFromFile reads JSON data from a file and unmarshalls it into a GenesisDoc.
func GenesisDocFromFile(genDocFile string, cdc *codec.Codec) (*tmtypes.GenesisDoc, error) {
jsonBlob, err := ioutil.ReadFile(genDocFile)
if err != nil {
return nil, errors.Wrap(err, "Couldn't read GenesisDoc file")
}

var genDoc tmtypes.GenesisDoc
err = cdc.UnmarshalJSON(jsonBlob, &genDoc)
if err != nil {
return nil, err
}

// Set up Tendermint consensus params with default value.
genDoc.ConsensusParams.Evidence = tmtypes.DefaultEvidenceParams()

if err := genDoc.ValidateAndComplete(); err != nil {
return nil, err
}

return &genDoc, nil
}

// MigrateGenesisCmd returns a command to execute genesis state migration.
// nolint: funlen
func MigrateGenesisCmd(_ *server.Context, cdc *codec.Codec) *cobra.Command {
cmd := &cobra.Command{
Use: "migrate [genesis-file]",
Short: "Migrate Wenchang genesis to Guanyu version",
Long: fmt.Sprintf(`Migrate the Wenchang genesis into the Guanyu version and print to STDOUT.
Example:
$ %s migrate /path/to/genesis.json --chain-id=band-guanyu --genesis-time=2020-08-11T17:00:00Z
`, version.ServerName),
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
var err error

importGenesis := args[0]
genDoc, err := GenesisDocFromFile(importGenesis, cdc)
if err != nil {
return errors.Wrapf(err, "failed to read genesis document from file %s", importGenesis)
}

var state extypes.AppMap
if err := cdc.UnmarshalJSON(genDoc.AppState, &state); err != nil {
return errors.Wrap(err, "failed to JSON unmarshal initial genesis state")
}

// Migrate from Wenchang (0.36 like genesis file) to cosmos-sdk v0.39
state = v039.Migrate(v038.Migrate(state))

// Add genesis state of the new modules get state from `app` default genesis.
defaultGuanyu := app.NewDefaultGenesisState()
state[oracle.ModuleName] = cdc.MustMarshalJSON(defaultGuanyu[oracle.ModuleName])
state[evidence.ModuleName] = cdc.MustMarshalJSON(defaultGuanyu[evidence.ModuleName])
state[upgrade.ModuleName] = cdc.MustMarshalJSON(defaultGuanyu[upgrade.ModuleName])

genDoc.AppState, err = cdc.MarshalJSON(state)
if err != nil {
return errors.Wrap(err, "failed to JSON marshal migrated genesis state")
}
if err := genDoc.ValidateAndComplete(); err != nil {
return err
}

genesisTime := cmd.Flag(flagGenesisTime).Value.String()
if genesisTime != "" {
var t time.Time

err := t.UnmarshalText([]byte(genesisTime))
if err != nil {
return errors.Wrap(err, "failed to unmarshal genesis time")
}

genDoc.GenesisTime = t
}

chainID := cmd.Flag(flagChainID).Value.String()
if chainID != "" {
genDoc.ChainID = chainID
}

bz, err := cdc.MarshalJSONIndent(genDoc, "", " ")
if err != nil {
return errors.Wrap(err, "failed to marshal genesis doc")
}

sortedBz, err := sdk.SortJSON(bz)
if err != nil {
return errors.Wrap(err, "failed to sort JSON genesis doc")
}

fmt.Println(string(sortedBz))
return nil
},
}
cmd.Flags().String(flagGenesisTime, "", "override genesis_time with this flag")
cmd.Flags().String(flagChainID, "band-guanyu", "override chain_id with this flag")
return cmd
}
2 changes: 1 addition & 1 deletion chain/docker-config/start_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ do
yoda config node tcp://172.18.0.1$v:26657
yoda config chain-rest-server http://172.18.0.20:1317
yoda config validator $(bandcli keys show validator$v -a --bech val --keyring-backend test)
yoda config executor "rest:https://3hdt5gnbr6.execute-api.ap-southeast-1.amazonaws.com/live/py-execution"
yoda config executor "rest:https://3hdt5gnbr6.execute-api.ap-southeast-1.amazonaws.com/live/py-execution?timeout=10s"

# activate validator
echo "y" | bandcli tx oracle activate --from validator$v --keyring-backend test
Expand Down
8 changes: 4 additions & 4 deletions chain/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ go 1.13

require (
github.com/bandprotocol/bandchain/go-owasm v0.0.0-00010101000000-000000000000
github.com/cosmos/cosmos-sdk v0.39.1-rc3
github.com/cosmos/cosmos-sdk v0.39.1
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d
github.com/ethereum/go-ethereum v1.9.18
github.com/ethereum/go-ethereum v1.9.19
github.com/gin-gonic/gin v1.6.3
github.com/gogo/protobuf v1.3.1
github.com/golang/protobuf v1.4.2
Expand All @@ -19,11 +19,11 @@ require (
github.com/rakyll/statik v0.1.7 // indirect
github.com/segmentio/kafka-go v0.3.7
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.7.0
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
github.com/tendermint/go-amino v0.15.1
github.com/tendermint/iavl v0.14.0
github.com/tendermint/tendermint v0.33.7
github.com/tendermint/tendermint v0.33.8
github.com/tendermint/tm-db v0.5.1
)

Expand Down
15 changes: 8 additions & 7 deletions chain/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7
github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4=
github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA=
github.com/cosmos/cosmos-sdk v0.39.1-rc3 h1:uU+xVzYFmnYWZ4cUz80KESRPynB0zHkVEWDWEI01yDg=
github.com/cosmos/cosmos-sdk v0.39.1-rc3/go.mod h1:ry2ROl5n+f2/QXpKJo3rdWNJwll00z7KhIVcxNcl16M=
github.com/cosmos/cosmos-sdk v0.39.1 h1:vhjf9PZh9ph8btAj9aBpHoVITgVVjNBpM3x5Gl/Vwac=
github.com/cosmos/cosmos-sdk v0.39.1/go.mod h1:ry2ROl5n+f2/QXpKJo3rdWNJwll00z7KhIVcxNcl16M=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d h1:49RLWk1j44Xu4fjHb6JFYmeUnDORVwHNkDxaQ0ctCVU=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4=
Expand Down Expand Up @@ -185,10 +185,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.9.17 h1:2D02O8KcoyQHxfizvMi0vGXXzFIkQTMeKXwt0+4SYEA=
github.com/ethereum/go-ethereum v1.9.17/go.mod h1:kihoiSg74VC4dZAXMkmoWp70oQabz48BJg1tuzricFc=
github.com/ethereum/go-ethereum v1.9.18 h1:+vzvufVD7+OfQa07IJP20Z7AGZsJaw0M6JIA/WQcqy8=
github.com/ethereum/go-ethereum v1.9.18/go.mod h1:JSSTypSMTkGZtAdAChH2wP5dZEvPGh3nUTuDpH+hNrg=
github.com/ethereum/go-ethereum v1.9.19 h1:c9IrhzqPKY+ZkS/YhXCO3rgNzlxsVrCYIRvrIAFmIWM=
github.com/ethereum/go-ethereum v1.9.19/go.mod h1:JSSTypSMTkGZtAdAChH2wP5dZEvPGh3nUTuDpH+hNrg=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51 h1:0JZ+dUmQeA8IIVUMzysrX4/AKuQwWhV2dYQuPZdvdSQ=
github.com/facebookgo/ensure v0.0.0-20160127193407-b4ab57deab51/go.mod h1:Yg+htXGokKKdzcwhuNDwVvN+uBxDGXJ7G/VN1d8fa64=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
Expand Down Expand Up @@ -353,7 +351,6 @@ github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0m
github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I=
github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc=
github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM=
github.com/holiman/uint256 v1.1.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw=
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
Expand Down Expand Up @@ -746,6 +743,8 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y
github.com/spf13/viper v1.6.3/go.mod h1:jUMtyi0/lB5yZH/FjyGAoH7IMNrIhlBf6pXZmbMDvzw=
github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM=
github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk=
github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg=
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q=
github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570 h1:gIlAHnH1vJb5vwEjIp5kBj/eu99p/bl0Ay2goiPe5xE=
Expand Down Expand Up @@ -788,6 +787,8 @@ github.com/tendermint/tendermint v0.33.6 h1:W4UOsXY4ROJZ3TLLGVVv71VXD4WK2gJRb3gz
github.com/tendermint/tendermint v0.33.6/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM=
github.com/tendermint/tendermint v0.33.7 h1:b5CQD8ggDtl4u0EbXzabi0MaOw9NrcXker6ijEkAE74=
github.com/tendermint/tendermint v0.33.7/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM=
github.com/tendermint/tendermint v0.33.8 h1:Xxu4QhpqcomSE0iQDw1MqLgfsa8fqtPtWFJK6zZOVso=
github.com/tendermint/tendermint v0.33.8/go.mod h1:0yUs9eIuuDq07nQql9BmI30FtYGcEC60Tu5JzB5IezM=
github.com/tendermint/tm-db v0.5.1 h1:H9HDq8UEA7Eeg13kdYckkgwwkQLBnJGgX4PgLJRhieY=
github.com/tendermint/tm-db v0.5.1/go.mod h1:g92zWjHpCYlEvQXvy9M168Su8V1IBEeawpXVVBaK4f4=
github.com/thepudds/fzgo v0.2.2/go.mod h1:ZgigL1toyKrar3rWdXz7Fuv7bUpKZ4BAYN49TpEFMCI=
Expand Down
2 changes: 1 addition & 1 deletion chain/scripts/start_yoda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yoda config chain-id bandchain
yoda config validator $(bandcli keys show $1 -a --bech val --keyring-backend test)

# setup execution endpoint
yoda config executor "docker:bandprotocol/runtime:1.0.2?timeout=10s"
yoda config executor "rest:https://3hdt5gnbr6.execute-api.ap-southeast-1.amazonaws.com/live/py-execution?timeout=10s"

# setup broadcast-timeout to yoda config
yoda config broadcast-timeout "30s"
Expand Down
7 changes: 4 additions & 3 deletions chain/yoda/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
sdkCtx "github.com/cosmos/cosmos-sdk/client/context"
ckeys "github.com/cosmos/cosmos-sdk/client/keys"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/cosmos/cosmos-sdk/x/auth/client/utils"

Expand All @@ -19,7 +20,7 @@ var (
cdc = app.MakeCodec()
)

func SubmitReport(c *Context, l *Logger, id otypes.RequestID, reps []otypes.RawReport) {
func SubmitReport(c *Context, l *Logger, id otypes.RequestID, reps []otypes.RawReport, execVersion string) {
key := <-c.keys
defer func() {
c.keys <- key
Expand All @@ -43,7 +44,7 @@ func SubmitReport(c *Context, l *Logger, id otypes.RequestID, reps []otypes.RawR

txBldr := auth.NewTxBuilder(
auth.DefaultTxEncoder(cdc), acc.GetAccountNumber(), acc.GetSequence(),
200000, 1, false, cfg.ChainID, "", sdk.NewCoins(), c.gasPrices,
200000, 1, false, cfg.ChainID, fmt.Sprintf("yoda:%s/exec:%s", version.Version, execVersion), sdk.NewCoins(), c.gasPrices,
)
// txBldr, err = authclient.EnrichWithGas(txBldr, cliCtx, []sdk.Msg{msg})
// if err != nil {
Expand Down Expand Up @@ -72,7 +73,7 @@ func SubmitReport(c *Context, l *Logger, id otypes.RequestID, reps []otypes.RawR
time.Sleep(c.rpcPollIntervall)
txRes, err := utils.QueryTx(cliCtx, txHash)
if err != nil {
l.Info(":warning: Failed to query tx with error: %s", err.Error())
l.Debug(":warning: Failed to query tx with error: %s", err.Error())
continue
}
if txRes.Code != 0 {
Expand Down
16 changes: 1 addition & 15 deletions chain/yoda/executor/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package executor
import (
"bytes"
"context"
"fmt"
"io"
"io/ioutil"
"os"
Expand All @@ -20,21 +19,8 @@ type DockerExec struct {
timeout time.Duration
}

var testProgram []byte = []byte("#!/usr/bin/env python3\nimport sys\nprint(sys.argv[1])")

func NewDockerExec(image string, timeout time.Duration) *DockerExec {
exec := &DockerExec{image: image, timeout: timeout}
res, err := exec.Exec(testProgram, "TEST_ARG")
if err != nil {
panic(fmt.Sprintf("NewDockerExec: failed to run test program: %s", err.Error()))
}
if res.Code != 0 {
panic(fmt.Sprintf("NewDockerExec: test program returned nonzero code: %d", res.Code))
}
if string(res.Output) != "TEST_ARG\n" {
panic(fmt.Sprintf("NewDockerExec: test program returned wrong output: %s", res.Output))
}
return exec
return &DockerExec{image: image, timeout: timeout}
}

func (e *DockerExec) Exec(code []byte, arg string) (ExecResult, error) {
Expand Down
Loading

0 comments on commit 8bc1e80

Please sign in to comment.