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

Add more validation on resources #1749

Merged
merged 7 commits into from
Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 22 additions & 22 deletions event/event.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions execution/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package execution

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/mesg-foundation/engine/ext/xvalidator"
"github.com/mesg-foundation/engine/hash"
"github.com/mesg-foundation/engine/protobuf/types"
"github.com/tendermint/tendermint/crypto"
)

// New returns a new execution.
func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, taskKey, price string, inputs *types.Struct, tags []string, executorHash hash.Hash) *Execution {
func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, taskKey, price string, inputs *types.Struct, tags []string, executorHash hash.Hash) (*Execution, error) {
exec := &Execution{
ProcessHash: processHash,
EventHash: eventHash,
Expand All @@ -24,7 +25,7 @@ func New(processHash, instanceHash, parentHash, eventHash hash.Hash, nodeKey, ta
}
exec.Hash = hash.Dump(exec)
exec.Address = sdk.AccAddress(crypto.AddressHash(exec.Hash))
return exec
return exec, xvalidator.Struct(exec)
}

// Execute changes executions status to in progres.
Expand Down
Loading