Skip to content
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

Tweak version linter max_depth #14386

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions scripts/version-linter.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
difference will always also be reported for t2 directly. The maximum
depth should be set low enough to minimize such false positives.

There are some special rules for the types associated with signed commands and zkApp commands.
See `check_command_types` below.
There are some special rules for the types associated with signed commands and zkApp commands;
see `check_command_types`, below. There is also a special rule for RPC types; see
`check_rpc_types`, below.
"""

import subprocess
Expand All @@ -36,7 +37,7 @@
exit_code=0

# type shape truncation depth
max_depth = 12
max_depth = 9

def set_error():
global exit_code
Expand All @@ -54,15 +55,15 @@ def branch_commit(branch):
def download_type_shapes(role,branch,sha1) :
file=type_shape_file(sha1)
print ('Downloading type shape file',file,'for',role,'branch',branch,'at commit',sha1)
result=subprocess.run(['wget' ,f'https://storage.googleapis.com/mina-type-shapes/{file}'])
result=subprocess.run(['wget','--no-clobber',f'https://storage.googleapis.com/mina-type-shapes/{file}'])

def type_shape_file(sha1) :
# created by buildkite build-artifact script
# loaded to cloud bucket
return sha1 + '-type_shape.txt'

# truncate type shapes to avoid false positives
def truncate_type_shape (sexp) :
def truncate_type_shape (type_shape) :
def truncate_at_depth (sexp,curr_depth) :
if curr_depth >= max_depth :
return sexpdata.Symbol('.')
Expand All @@ -72,8 +73,11 @@ def truncate_at_depth (sexp,curr_depth) :
else :
return sexp
fp = io.StringIO()
sexp = sexpdata.loads(type_shape)
sexpdata.dump(truncate_at_depth(sexp,0),fp)
return fp.getvalue ()
truncated = fp.getvalue ()
# remove double-quotes
return truncated[1:-1]

def make_type_shape_dict(type_shape_file):
shape_dict=dict()
Expand Down