Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
thehowl committed Oct 15, 2024
1 parent 3991f12 commit ecaab67
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 36 deletions.
1 change: 0 additions & 1 deletion gnovm/pkg/gnolang/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
34 changes: 0 additions & 34 deletions gnovm/pkg/gnolang/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down Expand Up @@ -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,

Expand Down Expand Up @@ -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
Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion gnovm/pkg/gnolang/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) })
}
Expand Down

0 comments on commit ecaab67

Please sign in to comment.