-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable some lua functions #306
Conversation
sync success |
Nov 1 05:18:42.040 INF ../go/aergo/cmd/aergosvr/aergosvr.go:100 > AERGO SVR STARTED branch=topic/disable-lua-require module=asvr revision=b9d3bb50 |
@kslee8282 |
getmetatable(bignum.number(0)).__add = function(x,y) return x-y end | ||
if getmetatable ~= nil then | ||
-- override the __add metamethod on bignum module | ||
getmetatable(bignum.number(0)).__add = function(x,y) return x-y end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't review deeper code about getmemtable, but it doesn't look like addtion rather substraction. Anyway, if this code did not cause any problem, we can leave this as is, since this commit don't change the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, this test overrides the add (+
) operator with a subtraction (-
) to check if that feature of overriding functions is possible. the feature is disabled by this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This PR removes some Lua functions, starting on hardfork 4:
package
modulerequire
getfenv
setfenv
getmetatable
setmetatable
rawget
rawset
rawequal
string.dump
They continue existing for previous hardforks for compatibility with gas computations. The first 4 are also available when Aergo is build in debug mode
This PR also does not build some disabled packages (os, io, jit, debug) and so the code cannot be accessed in any way
It includes tests to make sure the disabled modules and functions are not available