From ecaab67e72f7767bce771582cb392968f56b6f02 Mon Sep 17 00:00:00 2001 From: Morgan Bazalgette Date: Tue, 15 Oct 2024 19:35:32 +0200 Subject: [PATCH] fixup --- gnovm/pkg/gnolang/nodes.go | 1 - gnovm/pkg/gnolang/store.go | 34 --------------------------------- gnovm/pkg/gnolang/store_test.go | 1 - 3 files changed, 36 deletions(-) diff --git a/gnovm/pkg/gnolang/nodes.go b/gnovm/pkg/gnolang/nodes.go index 8927eafcfb2..5f5e8bd30b9 100644 --- a/gnovm/pkg/gnolang/nodes.go +++ b/gnovm/pkg/gnolang/nodes.go @@ -2118,7 +2118,6 @@ const ( ATTR_TYPEOF_VALUE GnoAttribute = "ATTR_TYPEOF_VALUE" ATTR_IOTA GnoAttribute = "ATTR_IOTA" ATTR_LOCATIONED GnoAttribute = "ATTR_LOCATIONED" - ATTR_INJECTED GnoAttribute = "ATTR_INJECTED" ATTR_SHIFT_RHS GnoAttribute = "ATTR_SHIFT_RHS" ) diff --git a/gnovm/pkg/gnolang/store.go b/gnovm/pkg/gnolang/store.go index c93f78228ba..0e6d89a7bf3 100644 --- a/gnovm/pkg/gnolang/store.go +++ b/gnovm/pkg/gnolang/store.go @@ -119,7 +119,6 @@ func NewStore(alloc *Allocator, baseStore, iavlStore store.Store) *defaultStore // store configuration pkgGetter: nil, cacheNativeTypes: make(map[reflect.Type]Type), - pkgInjector: nil, nativeStore: nil, go2gnoStrict: true, } @@ -149,7 +148,6 @@ func (ds *defaultStore) BeginTransaction(baseStore, iavlStore store.Store) Trans // store configuration pkgGetter: ds.pkgGetter, cacheNativeTypes: ds.cacheNativeTypes, - pkgInjector: ds.pkgInjector, nativeStore: ds.nativeStore, go2gnoStrict: ds.go2gnoStrict, @@ -254,26 +252,6 @@ func (ds *defaultStore) GetPackage(pkgPath string, isImport bool) *PackageValue rlm := ds.GetPackageRealm(pkgPath) pv.Realm = rlm } - // get package node. - pl := PackageNodeLocation(pkgPath) - pn, ok := ds.GetBlockNodeSafe(pl).(*PackageNode) - if !ok { - // Do not inject packages from packageGetter - // that don't have corresponding *PackageNodes. - } else { - // Inject natives after load. - if ds.pkgInjector != nil { - if pn.HasAttribute(ATTR_INJECTED) { - // e.g. in checktx or simulate or query. - pn.PrepareNewValues(pv) - } else { - // pv.GetBlock(ds) // preload pv.Block - ds.pkgInjector(ds, pn) - pn.SetAttribute(ATTR_INJECTED, true) - pn.PrepareNewValues(pv) - } - } - } // Rederive pv.fBlocksMap. pv.deriveFBlocksMap(ds) return pv @@ -294,18 +272,6 @@ func (ds *defaultStore) GetPackage(pkgPath string, isImport bool) *PackageValue // will get written elsewhere // later. ds.cacheObjects[oid] = pv - // inject natives after init. - if ds.pkgInjector != nil { - if pn.HasAttribute(ATTR_INJECTED) { - // not sure why this would happen. - panic("should not happen") - // pn.PrepareNewValues(pv) - } else { - ds.pkgInjector(ds, pn) - pn.SetAttribute(ATTR_INJECTED, true) - pn.PrepareNewValues(pv) - } - } // cache all types. usually preprocess() sets types, // but packages gotten from the pkgGetter may skip this step, // so fill in store.CacheTypes here. diff --git a/gnovm/pkg/gnolang/store_test.go b/gnovm/pkg/gnolang/store_test.go index 8114291d1b6..17f55993705 100644 --- a/gnovm/pkg/gnolang/store_test.go +++ b/gnovm/pkg/gnolang/store_test.go @@ -59,7 +59,6 @@ func TestTransactionStore_blockedMethods(t *testing.T) { // only be changed in the root store. assert.Panics(t, func() { transactionStore{}.SetPackageGetter(nil) }) assert.Panics(t, func() { transactionStore{}.ClearCache() }) - assert.Panics(t, func() { transactionStore{}.SetPackageInjector(nil) }) assert.Panics(t, func() { transactionStore{}.SetNativeStore(nil) }) assert.Panics(t, func() { transactionStore{}.SetStrictGo2GnoMapping(false) }) }