compiler: check for contract permissions
On many occassions we can determine at compile-time if contract config lacks some properties it needs. This includes all native contract invocations through stdlib, as both hashes and methods are known at compile-time there. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
16a8edaa17
commit
4249674ddc
7 changed files with 261 additions and 36 deletions
|
@ -13,6 +13,7 @@ import (
|
|||
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/manifest"
|
||||
"github.com/nspcc-dev/neo-go/pkg/util"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
)
|
||||
|
||||
|
@ -24,6 +25,8 @@ type DebugInfo struct {
|
|||
Events []EventDebugInfo `json:"events"`
|
||||
// EmittedEvents contains events occurring in code.
|
||||
EmittedEvents map[string][][]string `json:"-"`
|
||||
// InvokedContracts contains foreign contract invocations.
|
||||
InvokedContracts map[util.Uint160][]string `json:"-"`
|
||||
// StaticVariables contains list of static variable names and types.
|
||||
StaticVariables []string `json:"static-variables"`
|
||||
}
|
||||
|
@ -180,6 +183,7 @@ func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
|
|||
d.Methods = append(d.Methods, *m)
|
||||
}
|
||||
d.EmittedEvents = c.emittedEvents
|
||||
d.InvokedContracts = c.invokedContracts
|
||||
return d
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue