diff --git a/build.sh b/build.sh new file mode 100644 index 00000000..d8032638 --- /dev/null +++ b/build.sh @@ -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 diff --git a/checker_tools/client/operations.py b/checker_tools/client/operations.py index 389c29db..479e05bd 100644 --- a/checker_tools/client/operations.py +++ b/checker_tools/client/operations.py @@ -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: diff --git a/fix_ligo.py b/fix_ligo.py new file mode 100644 index 00000000..4d22f173 --- /dev/null +++ b/fix_ligo.py @@ -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) diff --git a/src/ligo.mligo b/src/ligo.mligo index 07c909f9..bb87e8d0 100644 --- a/src/ligo.mligo +++ b/src/ligo.mligo @@ -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