forked from TrueCloudLab/neoneo-go
vm: add 'events' command to VM CLI
And dump events automatically after HALTed or FAULTed end of execution.
This commit is contained in:
parent
f45d8fc08d
commit
f1ecdb82cc
3 changed files with 116 additions and 7 deletions
|
@ -23,7 +23,7 @@ import (
|
|||
|
||||
const neoAmount = 99999000
|
||||
|
||||
// InitSimple initializes chain with single contract storing several storage values.
|
||||
// InitSimple initializes chain with simple contracts from 'examples' folder.
|
||||
// It's not as complicated as chain got after Init and may be used for tests where
|
||||
// chain with a small amount of data is needed and for historical functionality testing.
|
||||
// Needs a path to the root directory.
|
||||
|
@ -31,14 +31,19 @@ func InitSimple(t *testing.T, rootpath string, e *neotest.Executor) {
|
|||
// examplesPrefix is a prefix of the example smart-contracts.
|
||||
var examplesPrefix = filepath.Join(rootpath, "examples")
|
||||
|
||||
deployExample := func(t *testing.T, name string) util.Uint160 {
|
||||
_, h := newDeployTx(t, e, e.Validator,
|
||||
filepath.Join(examplesPrefix, name, name+".go"),
|
||||
filepath.Join(examplesPrefix, name, name+".yml"),
|
||||
true)
|
||||
return h
|
||||
}
|
||||
|
||||
// Block #1: deploy storage contract (examples/storage/storage.go).
|
||||
_, storageHash := newDeployTx(t, e, e.Validator,
|
||||
filepath.Join(examplesPrefix, "storage", "storage.go"),
|
||||
filepath.Join(examplesPrefix, "storage", "storage.yml"),
|
||||
true)
|
||||
storageHash := deployExample(t, "storage")
|
||||
storageValidatorInvoker := e.ValidatorInvoker(storageHash)
|
||||
|
||||
// Block #2: put (1, 1) kv pair.
|
||||
storageValidatorInvoker := e.ValidatorInvoker(storageHash)
|
||||
storageValidatorInvoker.Invoke(t, 1, "put", 1, 1)
|
||||
|
||||
// Block #3: put (2, 2) kv pair.
|
||||
|
@ -46,6 +51,9 @@ func InitSimple(t *testing.T, rootpath string, e *neotest.Executor) {
|
|||
|
||||
// Block #4: update (1, 1) -> (1, 2).
|
||||
storageValidatorInvoker.Invoke(t, 1, "put", 1, 2)
|
||||
|
||||
// Block #5: deploy runtime contract (examples/runtime/runtime.go).
|
||||
_ = deployExample(t, "runtime")
|
||||
}
|
||||
|
||||
// Init pushes some predefined set of transactions into the given chain, it needs a path to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue