Skip to content

Commit

Permalink
refactor: include TallyInputArgs to VM call.
Browse files Browse the repository at this point in the history
  • Loading branch information
DeshErBojhaa committed Jun 12, 2024
1 parent de62dc4 commit b12fb80
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions x/wasm-storage/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (

"cosmossdk.io/collections"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/ethereum/go-ethereum/rlp"

vm "github.com/sedaprotocol/seda-wasm-vm/bind_go"
)

Expand Down Expand Up @@ -39,8 +37,9 @@ type (
}

tallyArg struct {
Reveals map[string]RevealBody
Outliers []bool
Reveals map[string]RevealBody
Outliers []bool
TallyInputArgs []byte
}

TallyingList map[string]struct {
Expand Down Expand Up @@ -130,7 +129,7 @@ func (k Keeper) ExecuteTally(ctx sdk.Context) error {
return fmt.Errorf("failed to get tally wasm for DR ID %s: %w", id, err)
}

args, err := tallyVMArg(req.Reveals, outliers)
args, err := tallyVMArg(req.TallyInputs, req.Reveals, outliers)
if err != nil {
return err
}
Expand All @@ -149,10 +148,11 @@ func (k Keeper) ExecuteTally(ctx sdk.Context) error {
return nil
}

func tallyVMArg(reveals map[string]RevealBody, outliers []bool) ([]string, error) {
argBytes, err := rlp.EncodeToBytes(tallyArg{
Reveals: reveals,
Outliers: outliers,
func tallyVMArg(inputArgs []byte, reveals map[string]RevealBody, outliers []bool) ([]string, error) {
argBytes, err := json.Marshal(tallyArg{
TallyInputArgs: inputArgs,
Reveals: reveals,
Outliers: outliers,
})
if err != nil {
return nil, err
Expand Down

0 comments on commit b12fb80

Please sign in to comment.