Skip to content

Commit

Permalink
fix: 🐛 remove deprecated statements
Browse files Browse the repository at this point in the history
The following deprecated statements have been removed:
* `Rule caller restroom-mw`, use instead `Rule unknown ignore`
* `create hash to point  of each object in `, use instead `create hash to point  of  in a foreach loop`
* `check reflow signature fingerprint is new`, use instead `verify reflow signature fingerprint is new`
* ` is found`, use instead `verify  is found`
* ` is found in `, use instead `verify  is found in `
* ` is found in  at least  times`, use instead `verify  is found in  at least  times`
* ` is not found`, use instead `verify  is not found`
* ` is not found in `, use instead `verify  is not found in `
* `copy  in  to `, use instead `copy  from  to `
* `create copy of  in `, use instead `create copy of  from `
* `create copy of  in  in `, use instead `pickup from path `
* `create copy of last element in `, use instead `create copy of last element from `
* `create copy of element  in array `, use instead `create copy of element  from array `
* `insert  in `, use instead `move  in `
* `create length of `, use instead `create size of `
* `verify length of  is less than `, use instead `verify size of  is less than `
* `verify length of  is less or equal than `, use instead `verify size of  is less or equal than `
* `verify length of  is more than `, use instead `verify size of  is more than `
* `verify length of  is more or equal than `, use instead `verify size of  is more or equal than `
* `create json of `, use instead `create json escaped string of `
* `number  is less than `, use instead `verify number  is less than `
* `number  is less or equal than `, use instead `verify number  is less or equal than `
* `number  is more than `, use instead `verify number  is more than `
* `number  is more or equal than `, use instead `verify number  is more or equal than `
* `elements in  are equal`, use instead `verify elements in  are equal`
* `elements in  are not equal`, use instead `verify elements in  are not equal`
* `petition signature is not a duplicate`, use instead `verify petition signature is not a duplicate`
* `petition signature is just one more`, use instead `verify petition signature is just one more`
  • Loading branch information
matteo-cristino committed Oct 31, 2023
1 parent a206de2 commit 2e868d3
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 275 deletions.
5 changes: 0 additions & 5 deletions src/lua/zencode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ function ZEN:begin(new_heap)
CONF.parser.strict_match = false
return true
end,
['caller restroom-mw'] = function()
warn("DEPRECATED:\nRule caller restroom-mw\nuse instead\nRule unknown ignore")
CONF.parser.strict_match = false
return true
end,
['set'] = function (conf, value)
if not conf or not value then return false end
CONF[conf] = fif( tonumber(value), tonumber(value),
Expand Down
20 changes: 0 additions & 20 deletions src/lua/zencode_array.lua
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,6 @@ When("create new array", function()
new_codec('new array', {zentype='a'})
end)

When(deprecated("create copy of element '' in array ''",
"create copy of element '' from array ''",
function(pos, arr)
empty 'copy'
local src, src_codec = have(arr)
zencode_assert(src_codec.zentype == "a", "Not an array: "..arr)
local num = tonumber(mayhave(pos) or pos)
zencode_assert(num, "Argument is not a position number: "..pos)
zencode_assert(src[num], "No element found in: "..arr.."["..pos.."]")
ACK.copy = src[num]
local n_codec = { encoding = src_codec.encoding }
-- table of schemas can only contain elements
if src_codec.schema then
n_codec.schema = src_codec.schema
n_codec.zentype = "e"
end
new_codec('copy', n_codec)
end)
)

When("create copy of element '' from array ''", function(pos, arr)
empty 'copy'
local src, src_codec = have(arr)
Expand Down
8 changes: 0 additions & 8 deletions src/lua/zencode_dictionary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,14 +251,6 @@ local function create_copy_f(root, in1, in2)
end
When("create copy of '' from dictionary ''", function(name, dict) create_copy_f(dict, name) end)
When("create copy of '' from ''", function(name, dict) create_copy_f(dict, name) end)
When(deprecated("create copy of '' in ''",
"create copy of '' from ''",
function(name, dict) create_copy_f(dict, name) end)
)
When(deprecated("create copy of '' in '' in ''",
"pickup from path ''",
function(obj, branch, root) create_copy_f(root, branch, obj) end)
)
When("create copy of object named by '' from dictionary ''", function(name, dict)
local label = have(name)
create_copy_f(dict, label:string())
Expand Down
5 changes: 0 additions & 5 deletions src/lua/zencode_ecdh.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ local function signature_f(o)
}
end

local function warn_keypair()
warn("Use of 'keypair' is deprecated in favor of 'keyring'")
warn("Examples: I have my 'keyring' or I create the keyring")
end

ZEN:add_schema(
{
-- keypair (ECDH)
Expand Down
20 changes: 0 additions & 20 deletions src/lua/zencode_hash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,6 @@ When("create hash to point '' of ''", function(curve, object)
new_codec('hash_to_point', { zentype='e' })
end)

When(deprecated("create hash to point '' of each object in ''",
[[Foreach 'element' in 'array'
When I create hash to point of 'array'
and I move 'hash to point' in 'array of hashes'
EndForeach]],
function(curve, object)
local F = _G[curve]
zencode_assert(
luatype(F.hashtopoint) == 'function',
'Hash type ' .. curve .. ' is invalid (no hashtopoint)'
)
empty'hash_to_point'
local obj = have(object)
local count = isarray(obj)
zencode_assert(count > 0, 'Object is not an array: ' .. object)
ACK.hash_to_point = deepmap(F.hashtopoint, obj)
new_codec('hash_to_point', {zentype='a'})
end)
)

When(
"create hashes of each object in ''",
function(arr)
Expand Down
20 changes: 4 additions & 16 deletions src/lua/zencode_petition.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ IfWhen(
end
)

local function _check_duplicate()
IfWhen('verify petition signature is not a duplicate', function()
if luatype(ACK.petition.list) == 'table' then
zencode_assert(
(not array_contains(
Expand All @@ -218,15 +218,9 @@ local function _check_duplicate()
ACK.petition.list = {}
end
table.insert(ACK.petition.list, ACK.petition_signature.uid_signature)
end

IfWhen(deprecated('petition signature is not a duplicate',
'verify petition signature is not a duplicate',
_check_duplicate)
)
IfWhen('verify petition signature is not a duplicate', _check_duplicate)
end)

local function _check_one_more()
IfWhen('verify petition signature is just one more', function()
-- verify that the signature is +1 (no other value supported)
ACK.petition_signature.one =
PET.prove_sign_petition(ACK.petition.owner, BIG.new(1))
Expand All @@ -237,14 +231,8 @@ local function _check_one_more()
),
'ABC petition signature adds more than one signature'
)
end

IfWhen(deprecated('petition signature is just one more',
'verify petition signature is just one more',
_check_one_more)
)

IfWhen('verify petition signature is just one more', _check_one_more)
end)

When(
'add signature to petition',
Expand Down
11 changes: 1 addition & 10 deletions src/lua/zencode_reflow.lua
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ IfWhen(
end
)

local function _fingerprint_is_new()
IfWhen("verify reflow signature fingerprint is new", function()
have 'reflow_signature'
have 'reflow_seal'
if not ACK.reflow_seal.fingerprints then
Expand All @@ -298,15 +298,6 @@ local function _fingerprint_is_new()
'Signature fingerprint is not new'
)
end

IfWhen(deprecated("check reflow signature fingerprint is new",
"verify reflow signature fingerprint is new",
_fingerprint_is_new
)
)

IfWhen("verify reflow signature fingerprint is new",
_fingerprint_is_new
)

When(
Expand Down
74 changes: 3 additions & 71 deletions src/lua/zencode_table.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ When("move named by '' in ''", function(src_name, dest)
CODEC[src] = nil
end)

When(deprecated("insert '' in ''",
"move '' in ''",
function(src, dest)
move_or_copy_in(have(src), src, dest)
ACK[src] = nil
CODEC[src] = nil
end)
)

When("move '' in ''", function(src, dest)
move_or_copy_in(have(src), src, dest)
ACK[src] = nil
Expand Down Expand Up @@ -151,12 +142,7 @@ local function count_f(obj_name)
end
return count
end
When(deprecated("create length of ''",
"create size of ''",
function(arr)
ACK.length = F.new(count_f(arr))
new_codec('length', {zentype='e', encoding='float'})
end))

When("create size of ''", function(arr)
ACK.size = F.new(count_f(arr))
new_codec('size', {zentype='e', encoding='float'})
Expand All @@ -177,31 +163,17 @@ local function _is_found_in(ele_name, obj_name)
end
end

IfWhen(deprecated("'' is not found in ''",
"verify '' is not found in ''",
function(ele_name, obj_name)
zencode_assert(not _is_found_in(ele_name, obj_name),
"Object should not be found: "..ele_name.." in "..obj_name)
end)
)
IfWhen("verify '' is not found in ''", function(ele_name, obj_name)
zencode_assert(not _is_found_in(ele_name, obj_name),
"Object should not be found: "..ele_name.." in "..obj_name)
end)

IfWhen(deprecated("'' is found in ''",
"verify '' is found in ''",
function(ele_name, obj_name)
zencode_assert(_is_found_in(ele_name, obj_name),
"Cannot find object: "..ele_name.." in "..obj_name)
end)
)
IfWhen("verify '' is found in ''", function(ele_name, obj_name)
zencode_assert(_is_found_in(ele_name, obj_name),
"Cannot find object: "..ele_name.." in "..obj_name)
end)

local function _found_in_atleast(ele_name, obj_name, times)
IfWhen("verify '' is found in '' at least '' times", function(ele_name, obj_name, times)
local ele, ele_codec = have(ele_name)
zencode_assert( luatype(ele) ~= 'table',
"Invalid use of table in object comparison: "..ele_name)
Expand All @@ -221,47 +193,7 @@ local function _found_in_atleast(ele_name, obj_name, times)
else
zencode_assert(found >= num, "Object "..ele_name.." found only "..tostring(found).." times instead of "..tostring(num).." in array "..obj_name)
end
end

IfWhen(deprecated("'' is found in '' at least '' times",
"verify '' is found in '' at least '' times",
_found_in_atleast)
)
IfWhen("verify '' is found in '' at least '' times", _found_in_atleast)

When(deprecated("create copy of last element in ''",
"create copy of last element from ''",
function(obj_name)
local obj, obj_codec = have(obj_name)
if type(obj) ~= 'table' then
error("Can only index tables")
end
if obj_codec.zentype == 'a' then
if #obj == 0 then
error("Last element doesn't exist for empty array")
end
ACK.copy_of_last_element = obj[#obj]
elseif obj_codec.zentype == 'd' then
local elem = nil
for _, v in sort_pairs(obj) do
elem = v
end
if not elem then
error("Last element doesn't exist for empty dictionary")
end
ACK.copy_of_last_element = elem
else
error("Cannot find last element in " .. obj_codec.zentype)
end
local n_codec = {encoding = obj_codec.encoding}
-- if copying from table of schema
if obj_codec.schema then
n_codec.schema = obj_codec.schema
n_codec.zentype = "e"
end
new_codec('copy_of_last_element', n_codec)
end)
)
end)

When("create copy of last element from ''", function(obj_name)
local obj, obj_codec = have(obj_name)
Expand Down
Loading

0 comments on commit 2e868d3

Please sign in to comment.