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

quick jakarta fix #326

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
./scripts/generate-entrypoints.rb ./src/checker.mli > ./src/checkerEntrypoints.ml
python ./checker_tools/builder/cli.py generate --out src
./scripts/generate-ligo.sh
python fix_ligo.py
./scripts/compile-ligo.rb
2 changes: 1 addition & 1 deletion checker_tools/client/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def await_operations(
)
# Note: This is only a *minimum* bound.
block_expected_starting_at = current_block_timestamp.timestamp() + int(
tz.shell.blocks[current_level].context.constants()["time_between_blocks"][0]
tz.shell.blocks[current_level].context.constants()["minimal_block_delay"][0]
)
sleep_for = max(1, block_expected_starting_at - datetime.utcnow().timestamp())
if sleep_for > MAX_BLOCK_TIME:
Expand Down
31 changes: 31 additions & 0 deletions fix_ligo.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import os


if __name__ == '__main__':
dst_dir = './generated/ligo'
files_list = [os.path.join(dst_dir, f) for f in os.listdir(dst_dir) if f.endswith('mligo')]
print(f'Found {len(files_list)} files.')

for file_path in files_list:
print(f'Fixing {file_path}.')
with open(file_path) as f:
initial_text = f.read()
fixed_text = initial_text.replace(
'Tezos.amount',
'(Tezos.get_amount unit)'
).replace(
'Tezos.sender',
'(Tezos.get_sender unit)'
).replace(
'Tezos.level',
'(Tezos.get_level unit)'
).replace(
'Tezos.now',
'(Tezos.get_now unit)'
).replace(
'Tezos.self_address',
'(Tezos.get_self_address unit)'
)

with open(file_path, 'w') as f:
f.write(fixed_text)
2 changes: 1 addition & 1 deletion src/ligo.mligo
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[@inline] let add_timestamp_int (i: timestamp) (j: int) : timestamp = i + j

[@inline] let sub_int_int (i: int) (j: int) : int = i - j
[@inline] let sub_tez_tez (i: tez) (j: tez) : tez = i - j
[@inline] let sub_tez_tez (i: tez) (j: tez) : tez = match i - j with | None -> (failwith "subTezosError") | Some n -> n
[@inline] let sub_nat_nat (i: nat) (j: nat) : int = i - j
[@inline] let sub_timestamp_timestamp (i: timestamp) (j: timestamp) : int = i - j

Expand Down