@@ -105,6 +105,7 @@ func (k Keeper) newInterpreter(ctx context.Context, params types.Params) (*prolo
105
105
interpreter .WithHooks (
106
106
whitelistBlacklistHookFn (whitelistPredicates , blacklistPredicates ),
107
107
gasMeterHookFn (sdkctx , params .GetGasPolicy ()),
108
+ telemetryPredicateCallCounterHookFn (),
108
109
),
109
110
interpreter .WithPredicates (ctx , interpreter .RegistryNames ),
110
111
interpreter .WithBootstrap (ctx , util .NonZeroOrDefault (interpreterParams .GetBootstrap (), bootstrap .Bootstrap ())),
@@ -135,23 +136,20 @@ func whitelistBlacklistHookFn(whitelist, blacklist []string) engine.HookFunc {
135
136
return nil
136
137
}
137
138
138
- predicateStringer , ok := operand .(fmt. Stringer )
139
+ predicate , ok := stringifyOperand ( operand )
139
140
if ! ok {
140
141
return engine .SyntaxError (operand , env )
141
142
}
142
143
143
- predicate := predicateStringer .String ()
144
-
145
- if interpreter .IsRegistered (predicate ) {
146
- if _ , found := allowed .Get (predicate ); ! found {
147
- return engine .PermissionError (
148
- prolog2 .AtomOperationExecute ,
149
- prolog2 .AtomPermissionForbiddenPredicate ,
150
- engine .NewAtom (predicate ),
151
- env ,
152
- )
153
- }
144
+ if _ , found := allowed .Get (predicate ); ! found {
145
+ return engine .PermissionError (
146
+ prolog2 .AtomOperationExecute ,
147
+ prolog2 .AtomPermissionForbiddenPredicate ,
148
+ engine .NewAtom (predicate ),
149
+ env ,
150
+ )
154
151
}
152
+
155
153
return nil
156
154
}
157
155
}
@@ -166,13 +164,11 @@ func gasMeterHookFn(ctx context.Context, gasPolicy types.GasPolicy) engine.HookF
166
164
return nil
167
165
}
168
166
169
- operandStringer , ok := operand .(fmt. Stringer )
167
+ predicate , ok := stringifyOperand ( operand )
170
168
if ! ok {
171
169
return engine .SyntaxError (operand , env )
172
170
}
173
171
174
- predicate := operandStringer .String ()
175
-
176
172
cost := lookupCost (predicate ,
177
173
lo .CoalesceOrEmpty (gasPolicy .DefaultPredicateCost , defaultPredicateCost ),
178
174
gasPolicy .PredicateCosts )
0 commit comments