compiler: check that safe methods exist

If a method is missing from the manifest, it is most likely a typo
or regression after refactoring. There is no "turn-off" flag
for this error because we can do this precisely.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-10-06 15:18:57 +03:00
parent b4e24bef14
commit 0c01d89827
2 changed files with 19 additions and 0 deletions

View file

@ -270,6 +270,11 @@ func CreateManifest(di *DebugInfo, o *Options) (*manifest.Manifest, error) {
if err != nil {
return m, fmt.Errorf("failed to convert debug info to manifest: %w", err)
}
for _, name := range o.SafeMethods {
if m.ABI.GetMethod(name, -1) == nil {
return m, fmt.Errorf("method %s is marked as safe but missing from manifest", name)
}
}
if !o.NoStandardCheck {
if err := standard.CheckABI(m, o.ContractSupportedStandards...); err != nil {
return m, err