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

feat: adding basic tally structure #272

Merged
merged 31 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1effb13
feat: sample data request wasm execution in endblock
hacheigriega May 17, 2024
25f78c1
WIP: adding query to get data request contract addr
hacheigriega May 25, 2024
6aa4bac
test: add integration testing framework for tally testing
hacheigriega May 31, 2024
dabb9ff
fix: improve tally structure and collection InitGenesis fix
hacheigriega Jun 1, 2024
0317bf5
feat: implement tally fetch phase with mock data testing
hacheigriega Jun 5, 2024
64225c0
refactor: rename mock files
hacheigriega Jun 5, 2024
199b422
fix: fix conflicts from rebase
hacheigriega Jun 5, 2024
efa0794
fix: fix incorrect import
hacheigriega Jun 5, 2024
76eaaee
chore: update tallyvm dependencies
hacheigriega Jun 7, 2024
5598d50
chore: update seda wasm vm dep and remove shared lib file
hacheigriega Jun 12, 2024
980f72f
chore: update tally vm dep
hacheigriega Jun 14, 2024
92e140b
chore: update tally vm dependency to fix rpath issue
hacheigriega Jun 17, 2024
b5cd139
fix: fix e2e dockerfile build error due to linking issue
hacheigriega Jun 17, 2024
85d28b1
fix: update mock data and fix code to pass tally test
hacheigriega Jun 18, 2024
5e3e851
fix: fix typo fix
hacheigriega Jun 18, 2024
62a4b66
feat: none filter for DR wasm
DeshErBojhaa Jun 10, 2024
5d38961
fix: proto lint
DeshErBojhaa Jun 12, 2024
a04905e
feat: MODE filtering
DeshErBojhaa Jun 12, 2024
1760aae
refactor: include TallyInputArgs to VM call.
DeshErBojhaa Jun 12, 2024
155beab
refactor: address PR comment
DeshErBojhaa Jun 12, 2024
85bcfec
fix: early return if no mode found
DeshErBojhaa Jun 12, 2024
b665d15
refactor: move filtering to wasm-storage
DeshErBojhaa Jun 12, 2024
e8ce55f
refactor: fix lint
DeshErBojhaa Jun 12, 2024
6168f50
chore: rebase base branch
DeshErBojhaa Jun 12, 2024
bbadd22
refactor: remove number type. Treat all data type as str
DeshErBojhaa Jun 13, 2024
446a280
refactor: proper use of iota
DeshErBojhaa Jun 13, 2024
6210837
fix: tally vm args
DeshErBojhaa Jun 13, 2024
f018f61
refactor: extract filtering algo first
DeshErBojhaa Jun 13, 2024
52973d4
fix: use updated mock data and fix filtering bugs
hacheigriega Jun 18, 2024
f2b739d
fix: fix test errors
hacheigriega Jun 18, 2024
64a6499
fix: fix unit test address
hacheigriega Jun 18, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ seda.env
.env

# coverage files
coverage.txt
coverage.txt
5 changes: 4 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -612,9 +612,12 @@ func NewApp(
appCodec,
runtime.NewKVStoreService(keys[wasmstoragetypes.StoreKey]),
authtypes.NewModuleAddress(govtypes.ModuleName).String(),
app.AccountKeeper,
app.BankKeeper,
contractKeeper,
app.WasmKeeper,
)
wasmStorageModule := wasmstorage.NewAppModule(appCodec, app.WasmStorageKeeper, app.AccountKeeper, app.BankKeeper)
wasmStorageModule := wasmstorage.NewAppModule(appCodec, app.WasmStorageKeeper)

/* =================================================== */
/* TRANSFER STACK */
Expand Down
5 changes: 2 additions & 3 deletions dockerfiles/Dockerfile.e2e
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION="1.21"
ARG RUNNER_IMAGE="alpine:3.17"
ARG SEDA_EXPONENT="18"
Expand All @@ -18,7 +16,8 @@ RUN apk add --no-cache \
ca-certificates \
build-base \
linux-headers \
git
git \
binutils-gold

# Download go dependencies
WORKDIR /seda-chain
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ require (
cosmossdk.io/x/tx v0.13.2
cosmossdk.io/x/upgrade v0.1.1
github.com/CosmWasm/wasmd v0.50.0
github.com/CosmWasm/wasmvm v1.5.0
github.com/aws/aws-sdk-go v1.44.224
github.com/cometbft/cometbft v0.38.6
github.com/cosmos/cosmos-db v1.0.2
Expand All @@ -41,12 +42,14 @@ require (
github.com/hashicorp/go-plugin v1.6.0
github.com/ory/dockertest/v3 v3.10.0
github.com/pkg/errors v0.9.1
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240617203732-2649db4864d8
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
go.uber.org/mock v0.4.0
google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
Expand All @@ -64,7 +67,6 @@ require (
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/CosmWasm/wasmvm v1.5.0 // indirect
github.com/DataDog/datadog-go v4.8.3+incompatible // indirect
github.com/DataDog/zstd v1.5.5 // indirect
github.com/Microsoft/go-winio v0.6.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg
github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529 h1:VbJcd022MkoohRyAfktHnN99Brt/4eJr01mdLqPhGaE=
github.com/sedaprotocol/rosetta-seda v0.0.0-20240427181737-e1d7563b2529/go.mod h1:GdlDqGJN2g55PHiwYJs2bQMlL0rdlQQbauK4dcrOI6w=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240617203732-2649db4864d8 h1:9Vw+DoN9MW+qPDQvW1B+X7t0ulOUmYM3HTv7Khvqvj0=
github.com/sedaprotocol/seda-wasm-vm/tallyvm v0.0.0-20240617203732-2649db4864d8/go.mod h1:AaX9uRy6qD2q+o1SapTRnGUe9HHZWTmBN2BVNAptq3U=
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c h1:PbSn7HpWeox6lqBu6Ba6YZS3On3euwn1BPz/egsnEgA=
github.com/sedaprotocol/vrf-go v0.0.0-20231211075603-e5a17bb0b87c/go.mod h1:DEIXHk41VUzOMVbZnIApssPXtZ+2zrETDP7kJjGc1RM=
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
Expand Down
2 changes: 1 addition & 1 deletion proto/sedachain/wasm_storage/v1/wasm_storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ message Wasm {
google.protobuf.Timestamp added_at = 4
[ (gogoproto.stdtime) = true, (gogoproto.nullable) = false ];
// ExpirationHeight represents the block height at which the data request
// wasm will be pruned. The value of zero means no expiration.
// wasm will be pruned. The value of zero means no expiration.
int64 expiration_height = 5;
}

Expand Down
70 changes: 4 additions & 66 deletions scripts/deploy_contracts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@ set -x
CHAIN_ID=seda-1-local
RPC_URL=http://127.0.0.1:26657
BIN=$(git rev-parse --show-toplevel)/build/sedad
ARTIFACTS_DIR=$(git rev-parse --show-toplevel)/testutil/testwasms # must contain proxy_contract.wasm, data_requests.wasm, and staking.wasm
CONTRACT_WASM=$(git rev-parse --show-toplevel)/testutil/testwasms/seda_contract.wasm
VOTING_PERIOD=30 # seconds
DEV_ACCOUNT=$($BIN keys show satoshi --keyring-backend test -a) # for sending wasm-storage txs
VOTE_ACCOUNT=$($BIN keys show satoshi --keyring-backend test -a) # for sending vote txs


echo "Deploying proxy contract"

# Proxy Contracts
OUTPUT="$($BIN tx wasm store $ARTIFACTS_DIR/proxy_contract.wasm --node $RPC_URL --from $DEV_ACCOUNT --keyring-backend test --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
OUTPUT="$($BIN tx wasm store $CONTRACT_WASM --node $RPC_URL --from $DEV_ACCOUNT --keyring-backend test --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
TXHASH=$(echo $OUTPUT | jq -r '.txhash')

sleep 10
Expand All @@ -25,7 +24,8 @@ PROXY_CODE_ID=$(echo "$OUTPUT" | jq -r '.events[] | select(.type=="store_code")
echo "Instantiating proxy contract on code id $PROXY_CODE_ID"

OUTPUT=$($BIN tx wasm-storage submit-proposal instantiate-and-register-proxy-contract $PROXY_CODE_ID \
'{"token":"aseda"}' 74657374696e67 \
'{"token":"aseda", "owner": "'$DEV_ACCOUNT'" }' \
74657374696e67 \
--admin $DEV_ACCOUNT \
--label proxy$PROXY_CODE_ID \
--title 'Proxy Contract' --summary 'Instantiates and registers proxy contract' --deposit 10000000aseda \
Expand All @@ -47,65 +47,3 @@ sleep $VOTING_PERIOD

PROXY_CONTRACT_ADDRESS=$($BIN query wasm-storage proxy-contract-registry --output json | jq -r '.address')
echo "Deployed proxy contract to: $PROXY_CONTRACT_ADDRESS"

# -----------------------
# Data Requests
# -----------------------

echo "Deploying Data Request contract"

OUTPUT="$($BIN tx wasm store $ARTIFACTS_DIR/data_requests.wasm --node $RPC_URL --from $DEV_ACCOUNT --keyring-backend test --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
TXHASH=$(echo $OUTPUT | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
DRs_CODE_ID=$(echo "$OUTPUT" | jq -r '.events[] | select(.type=="store_code") | .attributes[] | select(.key=="code_id") | .value')

echo "Instantiating data request contract on code id $DRs_CODE_ID"

OUTPUT=$($BIN tx wasm instantiate $DRs_CODE_ID '{"token":"aseda", "proxy": "'$PROXY_CONTRACT_ADDRESS'" }' --no-admin --from $DEV_ACCOUNT --keyring-backend test --node $RPC_URL --label dr$DRs_CODE_ID --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)
TXHASH=$(echo "$OUTPUT" | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
DRs_CONTRACT_ADDRESS=$(echo "$OUTPUT" | jq -r '.events[] | select(.type=="instantiate") | .attributes[] | select(.key=="_contract_address") | .value')

echo "Deployed data request contract to: $DRs_CONTRACT_ADDRESS"

# -----------------------
# Staking
# -----------------------

echo "Deploying staking contract"

OUTPUT="$($BIN tx wasm store $ARTIFACTS_DIR/staking.wasm --node $RPC_URL --from $DEV_ACCOUNT --keyring-backend test --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
TXHASH=$(echo $OUTPUT | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
STAKING_CODE_ID=$(echo "$OUTPUT" | jq -r '.events[] | select(.type=="store_code") | .attributes[] | select(.key=="code_id") | .value')

echo "Instantiating staking contract on code id $STAKING_CODE_ID"

OUTPUT=$($BIN tx wasm instantiate $STAKING_CODE_ID '{"token":"aseda", "proxy": "'$PROXY_CONTRACT_ADDRESS'" }' --no-admin --from $DEV_ACCOUNT --keyring-backend test --node $RPC_URL --label staking$staking_code_id --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)
TXHASH=$(echo "$OUTPUT" | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
STAKING_CONTRACT_ADDRESS=$(echo "$OUTPUT" | jq -r '.events[] | select(.type=="instantiate") | .attributes[] | select(.key=="_contract_address") | .value')

echo "Deployed staking contract to: $STAKING_CONTRACT_ADDRESS"

# -----------------------
# Setting properties
# -----------------------

echo "Setting dr address on proxy.."
OUTPUT="$($BIN tx wasm execute $PROXY_CONTRACT_ADDRESS '{"set_data_requests":{"contract": "'$DRs_CONTRACT_ADDRESS'" }}' --from $DEV_ACCOUNT --keyring-backend test --node $RPC_URL --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
TXHASH=$(echo "$OUTPUT" | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
echo "$OUTPUT"

echo "Setting staking address on proxy.."
OUTPUT="$($BIN tx wasm execute $PROXY_CONTRACT_ADDRESS '{"set_staking":{"contract": "'$STAKING_CONTRACT_ADDRESS'" }}' --from $DEV_ACCOUNT --keyring-backend test --node $RPC_URL --gas-prices 100000000000aseda --gas auto --gas-adjustment 1.3 -y --output json --chain-id $CHAIN_ID)"
TXHASH=$(echo "$OUTPUT" | jq -r '.txhash')
sleep 10
OUTPUT="$($BIN query tx $TXHASH --node $RPC_URL --output json)"
echo "$OUTPUT"
2 changes: 1 addition & 1 deletion scripts/local_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ $BIN gentx satoshi 10000000000000000seda --keyring-backend test
$BIN collect-gentxs

# start the chain
$BIN start || echo "Failed to start the chain"
$BIN start --log_level debug || echo "Failed to start the chain"
12 changes: 12 additions & 0 deletions scripts/mockgen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash

mockgen_cmd="mockgen"

if ! [ -x "$(command -v $mockgen_cmd)" ]; then
echo "Error: $mockgen_cmd is not installed." >&2
exit 1
fi

# Generate mocks for the given package
$mockgen_cmd -source=$GOPATH/pkg/mod/github.com/\!cosm\!wasm/wasmd@v0.50.0/x/wasm/types/exported_keepers.go -package testutil -destination x/wasm-storage/keeper/testutil/wasm_keepers_mock.go
$mockgen_cmd -source=x/wasm-storage/types/expected_keepers.go -package testutil -destination x/wasm-storage/keeper/testutil/expected_keepers_mock.go
Binary file added testutil/testwasms/seda_contract.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion x/randomness/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func NewKeeper(cdc codec.BinaryCodec, storeService storetypes.KVStoreService) *K

return &Keeper{
Seed: collections.NewItem(sb, SeedPrefix, "seed", collections.StringValue),
ValidatorVRFPubKeys: collections.NewMap(sb, ValidatorVRFPrefix, "validator-vrf-pubkeys", collections.StringKey, codec.CollInterfaceValue[cryptotypes.PubKey](cdc)),
ValidatorVRFPubKeys: collections.NewMap(sb, ValidatorVRFPrefix, "validator_vrf_pubkeys", collections.StringKey, codec.CollInterfaceValue[cryptotypes.PubKey](cdc)),
}
}

Expand Down
12 changes: 3 additions & 9 deletions x/wasm-storage/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) {
if err := k.Params.Set(ctx, data.Params); err != nil {
panic(err)
}
if err := k.ProxyContractRegistry.Set(ctx, data.ProxyContractRegistry); err != nil {
panic(err)
}

for i := range data.Wasms {
wasm := data.Wasms[i]
Expand All @@ -29,15 +32,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, data types.GenesisState) {
}
}
}
if data.ProxyContractRegistry != "" {
proxyAddr, err := sdk.AccAddressFromBech32(data.ProxyContractRegistry)
if err != nil {
panic(err)
}
if err = k.ProxyContractRegistry.Set(ctx, proxyAddr.String()); err != nil {
panic(err)
}
}
}

// ExportGenesis extracts all data from store to genesis state.
Expand Down
127 changes: 125 additions & 2 deletions x/wasm-storage/keeper/abci.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,50 @@
package keeper

import (
"encoding/base64"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"sort"

"cosmossdk.io/collections"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/sedaprotocol/seda-wasm-vm/tallyvm"
)

type Request struct {
hacheigriega marked this conversation as resolved.
Show resolved Hide resolved
DrBinaryID string `json:"dr_binary_id"`
DrInputs string `json:"dr_inputs"`
GasLimit string `json:"gas_limit"`
GasPrice string `json:"gas_price"`
Height uint64 `json:"height"`
ID string `json:"id"`
Memo string `json:"memo"`
PaybackAddress string `json:"payback_address"`
ReplicationFactor int64 `json:"replication_factor"`
Reveals map[string]RevealBody `json:"reveals"`
SedaPayload string `json:"seda_payload"`
TallyBinaryID string `json:"tally_binary_id"`
TallyInputs string `json:"tally_inputs"`
Version string `json:"version"`
}

type RevealBody struct {
ExitCode uint8 `json:"exit_code"`
Reveal string `json:"reveal"` // base64-encoded string
}

func (k Keeper) EndBlock(ctx sdk.Context) error {
err := k.ProcessExpiredWasms(ctx)
if err != nil {
return err
}

// TODO: Add Tally VM

err = k.ExecuteTally(ctx)
if err != nil {
return err
}
return nil
}

Expand All @@ -32,3 +64,94 @@ func (k Keeper) ProcessExpiredWasms(ctx sdk.Context) error {
}
return nil
}

func (k Keeper) ExecuteTally(ctx sdk.Context) error {
// 1. Get contract address.
contractAddr, err := k.ProxyContractRegistry.Get(ctx)
if contractAddr == "" || errors.Is(err, collections.ErrNotFound) {
k.Logger(ctx).Debug("proxy contract address not registered")
return nil
}
if err != nil {
return err
}

// 2. Fetch tally-ready DRs.
queryRes, err := k.wasmViewKeeper.QuerySmart(ctx, sdk.MustAccAddressFromBech32(contractAddr), []byte(`{"get_data_requests_by_status":{"status": "tallying"}}`))
hacheigriega marked this conversation as resolved.
Show resolved Hide resolved
hacheigriega marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return err
}
var tallyList []Request
err = json.Unmarshal(queryRes, &tallyList)
if err != nil {
return err
}

// 3. Loop through the list to apply filter and execute tally.
for id, req := range tallyList {
tallyInputs, err := base64.StdEncoding.DecodeString(req.TallyInputs)
if err != nil {
return fmt.Errorf("failed to decode tally input: %w", err)
}

// Sort reveals.
keys := make([]string, len(req.Reveals))
i := 0
for k := range req.Reveals {
keys[i] = k
i++
}
Comment on lines +98 to +103
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
keys := make([]string, len(req.Reveals))
i := 0
for k := range req.Reveals {
keys[i] = k
i++
}
keys := make([]string, 0, len(req.Reveals))
for k := range req.Reveals {
keys = append(keys, k)
}

sort.Strings(keys)
reveals := make([]RevealBody, len(req.Reveals))
for i, k := range keys {
reveals[i] = req.Reveals[k]
}

outliers, consensus, err := ApplyFilter(tallyInputs, reveals)
if err != nil {
return err
}

tallyID, err := hex.DecodeString(req.TallyBinaryID)
if err != nil {
return fmt.Errorf("failed to decode tally ID to hex: %w", err)
}
tallyWasm, err := k.DataRequestWasm.Get(ctx, tallyID)
if err != nil {
return fmt.Errorf("failed to get tally wasm for DR ID %d: %w", id, err)
}

args, err := tallyVMArg(tallyInputs, req.Reveals, outliers)
if err != nil {
return err
}

result := tallyvm.ExecuteTallyVm(tallyWasm.Bytecode, args, map[string]string{
"CONSENSUS": fmt.Sprintf("%v", consensus),
})
fmt.Println(result)
}

// 4. Post results.
// msg := []byte("{\"data_requests\": {}}")
Copy link
Contributor

Choose a reason for hiding this comment

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

// drContractAddr, err := k.wasmKeeper.Sudo(ctx, sdk.MustAccAddressFromBech32(proxyContractAddr), msg)
// fmt.Println("dr contract addy: " + string(drContractAddr))

return nil
}

func tallyVMArg(inputArgs []byte, reveals map[string]RevealBody, outliers []bool) ([]string, error) {
arg := []string{string(inputArgs)}
r, err := json.Marshal(reveals)
if err != nil {
return nil, err
}
arg = append(arg, string(r))
o, err := json.Marshal(outliers)
if err != nil {
return nil, err
}
arg = append(arg, string(o))

return arg, err
}
Loading
Loading