diff --git a/compat/main.py b/compat/main.py
index 1da0c95d21..9a973e9a80 100644
--- a/compat/main.py
+++ b/compat/main.py
@@ -1,43 +1,22 @@
from __future__ import annotations
-import dataclasses
-import html
-import json
import logging
import os
-import re
import shlex
import shutil
+import stat
import subprocess
-import sys
-import textwrap
-from collections import defaultdict
from contextlib import contextmanager
from dataclasses import dataclass, field
-from enum import Enum, unique
from pathlib import Path
-from typing import List, Optional, Collection, Dict, IO, Any
-from typing_extensions import Protocol, Literal
+from typing import List, Optional, Collection, Dict
import click as click
import coloredlogs
-import tabulate
import yaml
-from click.utils import LazyFile
from dacite import from_dict
SUITE_PATH = Path("suite").resolve()
-CMD_PATH = Path("../runtime/cmd").resolve()
-PARSER_PATH = Path("parse").resolve()
-CHECKER_PATH = Path("check").resolve()
-
-ansi_escape_pattern = re.compile(r'\x1b[^m]*m')
-
-
-class Openable(Protocol):
- def open(self) -> IO:
- pass
-
@contextmanager
def cwd(path):
@@ -48,91 +27,34 @@ def cwd(path):
finally:
os.chdir(oldpwd)
-
-@dataclass
-class File:
- path: str
- prepare: Optional[str]
- member_account_access: List[str] = field(default_factory=list)
-
- def rewrite(self, path: Path):
- if not isinstance(self.prepare, str):
- return
-
- logger.info(f"Preparing {path}")
-
- source: str
- with path.open(mode="r") as f:
- source = f.read()
-
- def replace(pattern, replacement):
- nonlocal source
- source = re.sub(pattern, replacement, source)
-
- variables = {"replace": replace}
- with cwd(str(path.parent.absolute())):
- exec(self.prepare, variables)
-
- with path.open(mode="w") as f:
- f.write(source)
-
- @classmethod
- def parse(cls, path: Path, use_json: bool, bench: bool) -> (bool, Optional):
- return cls._run(PARSER_PATH, "Parsing", path, use_json, bench)
-
- def check(self, path: Path, use_json: bool, bench: bool) -> (bool, Optional):
- extra_args = [
- f"-memberAccountAccess=S.{path}:S.{(path.parent / Path(other_path)).resolve()}"
- for other_path in self.member_account_access
- ]
- return self._run(CHECKER_PATH, "Checking", path, use_json, bench, extra_args)
-
- @staticmethod
- def _run(
- tool_path: Path,
- verb: str,
- path: Path,
- use_json: bool,
- bench: bool,
- extra_args: List[str] = None
- ) -> (bool, Optional):
- logger.info(f"{verb} {path}")
- json_args = ["-json"] if use_json else []
- bench_args = ["-bench"] if bench else []
- args = json_args + bench_args + (extra_args or [])
-
- completed_process = subprocess.run(
- [tool_path, *args, path],
- cwd=str(path.parent),
- capture_output=use_json
- )
- result = None
- if use_json:
- result = json.loads(completed_process.stdout)
-
- if completed_process.returncode != 0:
- logger.error(f"{verb} failed: {path}")
- return False, result
-
- return True, result
-
-
@dataclass
class GoTest:
path: str
command: str
- def run(self, working_dir: Path, prepare: bool, go_test_ref: Optional[str]) -> bool:
- if go_test_ref:
- replacement = f'github.com/onflow/cadence@{go_test_ref}'
+ def run(self, working_dir: Path, prepare: bool, cadence_version: Optional[str], flowgo_version: Optional[str]) -> bool:
+ if cadence_version:
+ cadence_replacement = f'github.com/onflow/cadence@{cadence_version}'
else:
- replacement = shlex.quote(str(Path.cwd().parent.absolute()))
+ # default: point to local cadence repo
+ cadence_replacement = shlex.quote(Path.cwd().parent.absolute().resolve().as_posix())
+
+ if flowgo_version:
+ flowgo_replacement = f'github.com/onflow/flow-go@{flowgo_version}'
+ else:
+ # default: use the newest version of flow-go available
+ flowgo_replacement = f'github.com/onflow/flow-go@latest'
with cwd(working_dir / self.path):
if prepare:
+ logger.info("Editing dependencies")
+ subprocess.run([
+ "go", "get", flowgo_replacement,
+ ])
subprocess.run([
- "go", "mod", "edit", "-replace", f'github.com/onflow/cadence={replacement}',
+ "go", "mod", "edit", "-replace", f'github.com/onflow/cadence={cadence_replacement}',
])
+ logger.info("Downloading dependencies")
subprocess.run([
"go", "get", "-t", ".",
])
@@ -140,40 +62,6 @@ def run(self, working_dir: Path, prepare: bool, go_test_ref: Optional[str]) -> b
result = subprocess.run(shlex.split(self.command))
return result.returncode == 0
-
-@dataclass
-class BenchmarkResult:
- iterations: int
- time: int
-
-
-@dataclass
-class ParseResult:
- error: Optional[Any] = field(default=None)
- bench: Optional[BenchmarkResult] = field(default=None)
-
- @classmethod
- def from_dict(cls, data: Dict):
- return from_dict(data_class=cls, data=data)
-
-
-@dataclass
-class CheckResult:
- error: Optional[Any] = field(default=None)
- bench: Optional[BenchmarkResult] = field(default=None)
-
- @classmethod
- def from_dict(cls, data: Dict):
- return from_dict(data_class=cls, data=data)
-
-
-@dataclass
-class Result:
- path: str
- parse_result: ParseResult
- check_result: Optional[CheckResult] = field(default=None)
-
-
def load_index(path: Path) -> List[str]:
logger.info(f"Loading suite index from {path} ...")
with path.open(mode="r") as f:
@@ -184,7 +72,6 @@ class Description:
description: str
url: str
branch: str
- files: List[File] = field(default_factory=list)
go_tests: List[GoTest] = field(default_factory=list)
@staticmethod
@@ -200,6 +87,11 @@ def from_dict(cls, data: Dict):
def _clone(self, working_dir: Path):
if working_dir.exists():
+ for root, dirs, files in os.walk(working_dir):
+ for dir in dirs:
+ os.chmod(os.path.join(root, dir), stat.S_IRUSR | stat.S_IWUSR)
+ for file in files:
+ os.chmod(os.path.join(root, file), stat.S_IRUSR | stat.S_IWUSR)
shutil.rmtree(working_dir)
logger.info(f"Cloning {self.url} ({self.branch})")
@@ -210,69 +102,25 @@ def run(
self,
name: str,
prepare: bool,
- use_json: bool,
- bench: bool,
- check: bool,
go_test: bool,
- go_test_ref: Optional[str],
- ) -> (bool, List[Result]):
+ cadence_version: Optional[str],
+ flowgo_version: Optional[str],
+ ) -> (bool):
working_dir = SUITE_PATH / name
if prepare:
self._clone(working_dir)
- results: List[Result] = []
- check_succeeded = True
- if check:
- check_succeeded, results = self.check(working_dir, prepare=prepare, use_json=use_json, bench=bench)
-
go_tests_succeeded = True
if go_test:
for test in self.go_tests:
- if not test.run(working_dir, prepare=prepare, go_test_ref=go_test_ref):
+ if not test.run(working_dir, prepare=prepare, cadence_version=cadence_version, flowgo_version=flowgo_version):
go_tests_succeeded = False
- succeeded = check_succeeded and go_tests_succeeded
-
- return succeeded, results
-
- def check(self, working_dir: Path, prepare: bool, use_json: bool, bench: bool) -> (bool, List[Result]):
-
- run_succeeded = True
-
- results: List[Result] = []
-
- for file in self.files:
- path = working_dir.joinpath(file.path)
-
- if prepare:
- file.rewrite(path)
-
- parse_succeeded, parse_results = \
- File.parse(path, use_json=use_json, bench=bench)
- result = Result(
- path=str(path),
- parse_result=ParseResult.from_dict(parse_results[0]) if parse_results else None
- )
- if not parse_succeeded:
- run_succeeded = False
- if use_json:
- results.append(result)
- continue
-
- check_succeeded, check_results = \
- file.check(path, use_json=use_json, bench=bench)
- if check_results:
- result.check_result = CheckResult.from_dict(check_results[0])
- if use_json:
- results.append(result)
- if not check_succeeded:
- run_succeeded = False
- continue
-
- return run_succeeded, results
+ succeeded = go_tests_succeeded
+ return succeeded
class Git:
@@ -300,371 +148,6 @@ def checkout(ref: str):
raise Exception(f'failed to checkout ref {ref}')
-def build(name):
- logger.info(f"Building {name}")
- subprocess.run(["go", "build", CMD_PATH / name])
-
-
-class EnhancedJSONEncoder(json.JSONEncoder):
- def default(self, o):
- if dataclasses.is_dataclass(o):
- return dataclasses.asdict(o)
- if isinstance(o, Enum):
- return o.value
- return super().default(o)
-
-
-def indent(text: str) -> str:
- return textwrap.indent(text, " ")
-
-
-def format_markdown_details(details: str) -> str:
- stripped = ansi_escape_pattern.sub('', details)
- escaped = html.escape(stripped).replace("\n", "
")
- return f"Details
{escaped}
"
-
-
-@dataclass
-class Comparisons:
- parse_error_comparisons: Dict[str, ErrorComparison]
- parse_bench_comparisons: Optional[Dict[str, BenchComparison]]
- check_error_comparisons: Dict[str, ErrorComparison]
- check_bench_comparisons: Optional[Dict[str, BenchComparison]]
-
- @classmethod
- def from_results(cls,
- other_results: List[Result],
- current_results: List[Result],
- bench: bool,
- delta_threshold: float
- ) -> Comparisons:
-
- parse_error_comparisons: Dict[str, ErrorComparison] = {}
- check_error_comparisons: Dict[str, ErrorComparison] = {}
-
- parse_bench_comparisons: Optional[Dict[str, BenchComparison]] = None
- check_bench_comparisons: Optional[Dict[str, BenchComparison]] = None
- if bench:
- parse_bench_comparisons: Dict[str, BenchComparison] = {}
- check_bench_comparisons: Dict[str, BenchComparison] = {}
-
- other_results.sort(key=lambda result: result.path)
- current_results.sort(key=lambda result: result.path)
-
- for other_result, current_result in zip(other_results, current_results):
- path = other_result.path
- assert current_result.path == path
-
- parse_error_comparisons[path] = ErrorComparison(
- other_result.parse_result.error,
- current_result.parse_result.error
- )
- check_error_comparisons[path] = ErrorComparison(
- other_result.check_result.error,
- current_result.check_result.error
- )
-
- if bench:
- if other_result.parse_result.bench and current_result.parse_result.bench:
- parse_bench_comparisons[path] = BenchComparison(
- other_result.parse_result.bench,
- current_result.parse_result.bench,
- delta_threshold=delta_threshold
- )
-
- if other_result.check_result.bench and current_result.check_result.bench:
- check_bench_comparisons[path] = BenchComparison(
- other_result.check_result.bench,
- current_result.check_result.bench,
- delta_threshold=delta_threshold
- )
-
- return Comparisons(
- parse_error_comparisons,
- parse_bench_comparisons,
- check_error_comparisons,
- check_bench_comparisons
- )
-
- def write(self, output: IO, format: Format):
-
- result: Optional[str] = None
- if format in ("pretty", "markdown"):
-
- output.write("\n## Parser Errors\n\n")
- self._write_error_comparisons(self.parse_error_comparisons, output, format)
- if self.parse_bench_comparisons:
- output.write("\n## Parser Benchmarks\n\n")
- self._write_bench_comparisons(self.parse_bench_comparisons, output, format)
-
- output.write("\n## Checker Errors\n\n")
- self._write_error_comparisons(self.check_error_comparisons, output, format)
- if self.check_bench_comparisons:
- output.write("\n## Checker Benchmarks\n\n")
- self._write_bench_comparisons(self.check_bench_comparisons, output, format)
-
- if format == "json":
- result = json_serialize(self)
-
- if result:
- output.write(result)
-
- @staticmethod
- def _write_error_comparisons(comparisons: Dict[str, ErrorComparison], output: IO, format: Format):
-
- def write_table(data, headers):
- output.write(tabulate.tabulate(data, headers, tablefmt="pipe"))
- output.write("\n\n")
-
- groups = defaultdict(list)
-
- for path, comparison in comparisons.items():
- relative_path = Path(path).relative_to(SUITE_PATH)
- groups[comparison.category].append((relative_path, comparison))
-
- for category in (
- ErrorCategory.REGRESSION,
- ErrorCategory.STILL_FAIL,
- ErrorCategory.CHANGE,
- ErrorCategory.IMPROVEMENT,
- ErrorCategory.STILL_SUCCESS,
- ):
-
- category_comparisons = groups.get(category, [])
-
- if not len(category_comparisons):
- continue
-
- if format == "pretty":
-
- if category == ErrorCategory.REGRESSION:
- output.write("😠Regressions\n")
- output.write("-------------\n")
-
- for path, comparison in category_comparisons:
- output.write(f"- {path}:\n")
- output.write(indent(comparison.current))
- output.write("\n\n")
-
- elif category == ErrorCategory.STILL_FAIL:
- output.write("😢 Still failing\n")
- output.write("---------------\n")
-
- for path, comparison in category_comparisons:
- output.write(f"- {path}:\n")
- output.write(indent(comparison.current))
- output.write("\n\n")
-
- elif category == ErrorCategory.CHANGE:
- output.write("😕 Changed\n")
- output.write("---------\n")
-
- for path, comparison in category_comparisons:
- output.write(f"- {path}:\n")
- output.write(" Before:\n")
- output.write(indent(comparison.other))
- output.write("\n")
- output.write(" Now:\n")
- output.write(indent(comparison.current))
- output.write("\n\n")
-
- elif category == ErrorCategory.IMPROVEMENT:
- output.write("🎉 Improvements\n")
- output.write("--------------\n")
-
- for path, comparison in category_comparisons:
- output.write(f"- {path}\n")
-
- elif category == ErrorCategory.STILL_SUCCESS:
- output.write("🙂 Still succeeding\n")
- output.write("------------------\n")
-
- for path, comparison in category_comparisons:
- output.write(f"- {path}\n")
-
- output.write("\n")
-
- elif format == "markdown":
-
- if category == ErrorCategory.REGRESSION:
- data = []
- headers = ["😠Regressions", "Details"]
- for path, comparison in category_comparisons:
- data.append([path, format_markdown_details(comparison.current)])
-
- write_table(data, headers)
-
- elif category == ErrorCategory.STILL_FAIL:
- data = []
- headers = ["😢 Still failing", "Details"]
- for path, comparison in category_comparisons:
- data.append([path, format_markdown_details(comparison.current)])
-
- write_table(data, headers)
-
- elif category == ErrorCategory.CHANGE:
- data = []
- headers = ["😕 Changed", "Before", "Now"]
- for path, comparison in category_comparisons:
- data.append([
- path,
- format_markdown_details(comparison.other),
- format_markdown_details(comparison.current)
- ])
-
- write_table(data, headers)
-
- elif category == ErrorCategory.IMPROVEMENT:
- data = []
- headers = ["🎉 Improvements"]
- for path, comparison in category_comparisons:
- data.append([path])
-
- write_table(data, headers)
-
- elif category == ErrorCategory.STILL_SUCCESS:
- data = []
- headers = ["🙂 Still succeeding"]
- for path, comparison in category_comparisons:
- data.append([path])
-
- write_table(data, headers)
-
- @classmethod
- def _write_bench_comparisons(cls, comparisons: Dict[str, BenchComparison], output: IO, format: Format):
-
- def write_table(data, headers):
- output.write(tabulate.tabulate(data, headers, tablefmt="pipe"))
- output.write("\n\n")
-
- groups = defaultdict(list)
-
- for path, comparison in comparisons.items():
- relative_path = Path(path).relative_to(SUITE_PATH)
- groups[comparison.category].append((relative_path, comparison))
-
- for category in (
- BenchCategory.REGRESSION,
- BenchCategory.IMPROVEMENT,
- BenchCategory.SAME,
- ):
-
- category_comparisons = groups.get(category, [])
-
- if not len(category_comparisons):
- continue
-
- title = ""
- if category == BenchCategory.REGRESSION:
- title = "😠Regressions"
- elif category == BenchCategory.IMPROVEMENT:
- title = "🎉 Improvements"
- elif category == BenchCategory.SAME:
- title = "🙂 Same"
-
- data = []
- headers = [title, "OLD", "NEW", "DELTA", "RATIO"]
- for path, comparison in category_comparisons:
- data.append([
- path,
- cls._time_markdown(comparison.other.time),
- cls._time_markdown(comparison.current.time),
- cls._delta_markdown(comparison.delta),
- cls._ratio_markdown(comparison.ratio)
- ])
-
- write_table(data, headers)
-
- @staticmethod
- def _time_markdown(time: int) -> str:
- return f'{time / 1000000:.2f}'
-
- @staticmethod
- def _delta_markdown(delta: float) -> str:
- result = f'{delta:.2f}%'
- if result[0] != '-':
- result = '+' + result
- return result
-
- @staticmethod
- def _ratio_markdown(ratio: float) -> str:
- return f'**{ratio:.2f}x**'
-
-
-@unique
-class ErrorCategory(Enum):
- REGRESSION = "Regression"
- IMPROVEMENT = "Improvement"
- CHANGE = "Change"
- STILL_SUCCESS = "Still succeeding"
- STILL_FAIL = "Still failing"
-
-
-@dataclass
-class ErrorComparison:
- other: Optional[str]
- current: Optional[str]
- category: ErrorCategory = field(init=False)
-
- def __post_init__(self):
- self.category = self._category()
-
- def _category(self) -> ErrorCategory:
- if self.other != self.current:
- return ErrorCategory.CHANGE
- elif not self.other and self.current:
- return ErrorCategory.REGRESSION
- elif self.other and not self.current:
- return ErrorCategory.IMPROVEMENT
- elif self.other:
- return ErrorCategory.STILL_FAIL
- else:
- return ErrorCategory.STILL_SUCCESS
-
-
-@unique
-class BenchCategory(Enum):
- REGRESSION = "Regression"
- IMPROVEMENT = "Improvement"
- SAME = "Same"
-
-
-@dataclass
-class BenchComparison:
- other: BenchmarkResult
- current: BenchmarkResult
- delta_threshold: float
- ratio: float = field(init=False)
- delta: float = field(init=False)
- category: BenchCategory = field(init=False)
-
- def __post_init__(self):
- self.ratio = self.other.time / self.current.time
- self.delta = -(((self.current.time * 100) / self.other.time) - 100)
- self.category = self._category()
-
- def _category(self) -> BenchCategory:
- if abs(self.delta) > self.delta_threshold:
- if self.delta > 0:
- return BenchCategory.IMPROVEMENT
- if self.delta < 0:
- return BenchCategory.REGRESSION
-
- return BenchCategory.SAME
-
-
-Format = Literal["pretty", "json", "markdown"]
-
-
-def json_serialize(data) -> str:
- return json.dumps(data, indent=4, cls=EnhancedJSONEncoder)
-
-
-def build_all():
- for name in ("parse", "check"):
- build(name)
-
-
@click.command()
@click.option(
"--rerun",
@@ -672,51 +155,21 @@ def build_all():
default=False,
help="Rerun without cloning and preparing the suites"
)
-@click.option(
- "--format",
- type=click.Choice(["pretty", "json", "markdown"], case_sensitive=False),
- default="pretty",
- help="output format",
-)
-@click.option(
- "--bench/--no-bench",
- is_flag=True,
- default=False,
- help="Run benchmarks"
-)
-@click.option(
- "--check/--no-check",
- is_flag=True,
- default=True,
- help="Parse and check the suite files"
-)
@click.option(
"--go-test/--no-go-test",
is_flag=True,
- default=False,
+ default=True,
help="Run the suite Go tests"
)
@click.option(
- "--go-test-ref",
+ "--cadence-version",
default=None,
- help="Git ref of Cadence for Go tests"
+ help="version of Cadence for Go tests"
)
@click.option(
- "--output",
+ "--flowgo-version",
default=None,
- type=click.File("w"),
- help="Write output to given path. Standard output by default"
-)
-@click.option(
- "--compare-ref",
- "other_ref",
- help="Compare with another Git ref (e.g. commit or branch)"
-)
-@click.option(
- "--delta-threshold",
- default=4,
- type=float,
- help="Delta threshold to consider a benchmark result a change"
+ help="version of flow-go for Go tests"
)
@click.argument(
"names",
@@ -724,119 +177,59 @@ def build_all():
)
def main(
rerun: bool,
- format: Format,
- bench: bool,
- check: bool,
go_test: bool,
- go_test_ref: Optional[str],
- output: Optional[LazyFile],
- other_ref: Optional[str],
- delta_threshold: float,
+ cadence_version: str,
+ flowgo_version: str,
names: Collection[str]
):
- if other_ref is None and format not in ("pretty", "json"):
- raise Exception(f"unsupported format: {format}")
prepare = not rerun
- output: IO = output.open() if output else sys.stdout
-
- # Comparison of different runs is only possible when using JSON
-
- use_json_for_run = format != "pretty" or (other_ref is not None)
-
# Run for the current checkout
- current_success, current_results = run(
+ current_success = run(
prepare=prepare,
- use_json=use_json_for_run,
- bench=bench,
- check=check,
go_test=go_test,
- go_test_ref=go_test_ref,
+ cadence_version=cadence_version,
+ flowgo_version=flowgo_version,
names=names
)
- # Run for the other checkout, if any
-
- if other_ref:
- current_ref = Git.get_head_ref()
- try:
- Git.checkout(other_ref)
-
- _, other_results = run(
- # suite repositories were already cloned in the previous run
- prepare=False,
- use_json=use_json_for_run,
- bench=bench,
- check=check,
- go_test=go_test,
- names=names
- )
-
- comparisons = Comparisons.from_results(
- other_results,
- current_results,
- bench=bench,
- delta_threshold=delta_threshold,
- )
-
- comparisons.write(output, format)
-
- finally:
- Git.checkout(current_ref)
-
- else:
-
- if format == "json":
- results_json = json_serialize(current_results)
- output.write(results_json)
-
- output.close()
-
if not current_success:
exit(1)
def run(
prepare: bool,
- use_json: bool,
- bench: bool,
- check: bool,
go_test: bool,
- go_test_ref: Optional[str],
+ cadence_version: str,
+ flowgo_version: str,
names: Collection[str]
-) -> (bool, List[Result]):
-
- build_all()
+) -> (bool):
all_succeeded = True
+ logger.info(f'Chosen versions: cadence@{ cadence_version if cadence_version else "local version" }, flow-go@{flowgo_version if flowgo_version else "latest"}')
+
if not names:
names = load_index(SUITE_PATH / "index.yaml")
- all_results: List[Result] = []
-
for name in names:
description = Description.load(name)
- run_succeeded, results = description.run(
+ run_succeeded = description.run(
name,
prepare=prepare,
- use_json=use_json,
- bench=bench,
- check=check,
go_test=go_test,
- go_test_ref=go_test_ref,
+ cadence_version=cadence_version,
+ flowgo_version=flowgo_version,
)
if not run_succeeded:
all_succeeded = False
- all_results.extend(results)
-
- return all_succeeded, all_results
+ return all_succeeded
if __name__ == "__main__":
diff --git a/compat/requirements.txt b/compat/requirements.txt
index c83c2d82a8..83eccf7636 100644
--- a/compat/requirements.txt
+++ b/compat/requirements.txt
@@ -3,4 +3,3 @@ coloredlogs==14.0
dacite==1.5.1
PyYAML==5.4
typing-extensions==3.7.4.3
-tabulate==0.8.7
diff --git a/compat/suite/flow-core-contracts.yaml b/compat/suite/flow-core-contracts.yaml
index e7607d8573..2b3cdcaa10 100644
--- a/compat/suite/flow-core-contracts.yaml
+++ b/compat/suite/flow-core-contracts.yaml
@@ -7,133 +7,3 @@ branch: master
go_tests:
- path: lib/go/test
command: make test
-files:
-- path: contracts/FlowToken.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
-
-- path: contracts/FlowFees.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
-
-- path: contracts/FlowIDTableStaking.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
-
-- path: contracts/FlowStorageFees.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
-
-- path: contracts/FlowServiceAccount.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowFees from 0xFLOWFEESADDRESS',
- f'import FlowFees from "{Path("FlowFees.cdc").resolve()}"'
- )
- replace(
- 'import FlowStorageFees from 0xFLOWSTORAGEFEESADDRESS',
- f'import FlowStorageFees from "{Path("FlowStorageFees.cdc").resolve()}"'
- )
-
-- path: contracts/StakingProxy.cdc
-
-- path: contracts/LockedTokens.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowIDTableStaking from 0xFLOWIDTABLESTAKINGADDRESS',
- f'import FlowIDTableStaking from "{Path("FlowIDTableStaking.cdc").resolve()}"'
- )
- replace(
- 'import FlowStorageFees from 0xFLOWSTORAGEFEESADDRESS',
- f'import FlowStorageFees from "{Path("FlowStorageFees.cdc").resolve()}"'
- )
- replace(
- 'import StakingProxy from 0xSTAKINGPROXYADDRESS',
- f'import StakingProxy from "{Path("StakingProxy.cdc").resolve()}"'
- )
-
-- path: contracts/FlowStakingCollection.cdc
- member_account_access:
- - 'LockedTokens.cdc'
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowToken from 0xFLOWTOKENADDRESS',
- f'import FlowToken from "{Path("FlowToken.cdc").resolve()}"'
- )
- replace(
- 'import FlowIDTableStaking from 0xFLOWIDTABLESTAKINGADDRESS',
- f'import FlowIDTableStaking from "{Path("FlowIDTableStaking.cdc").resolve()}"'
- )
- replace(
- 'import LockedTokens from 0xLOCKEDTOKENSADDRESS',
- f'import LockedTokens from "{Path("LockedTokens.cdc").resolve()}"'
- )
- replace(
- 'import FlowStorageFees from 0xFLOWSTORAGEFEESADDRESS',
- f'import FlowStorageFees from "{Path("FlowStorageFees.cdc").resolve()}"'
- )
diff --git a/compat/suite/flow-ft.yaml b/compat/suite/flow-ft.yaml
index 1fd621a3d5..3b872d692d 100644
--- a/compat/suite/flow-ft.yaml
+++ b/compat/suite/flow-ft.yaml
@@ -7,82 +7,3 @@ branch: master
go_tests:
- path: lib/go/test
command: make test
-files:
-- path: contracts/FungibleToken.cdc
-- path: contracts/utilityContracts/TokenForwarding.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../FungibleToken.cdc").resolve()}"'
- )
-
-- path: contracts/ExampleToken.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("FungibleToken.cdc").resolve()}"'
- )
-
-- path: transactions/transfer_tokens.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleToken from 0xTOKENADDRESS',
- f'import ExampleToken from "{Path("../contracts/ExampleToken.cdc").resolve()}"'
- )
-
-- path: transactions/setup_account.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleToken from 0xTOKENADDRESS',
- f'import ExampleToken from "{Path("../contracts/ExampleToken.cdc").resolve()}"'
- )
-
-- path: transactions/mint_tokens.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleToken from 0xTOKENADDRESS',
- f'import ExampleToken from "{Path("../contracts/ExampleToken.cdc").resolve()}"'
- )
-
-
-- path: transactions/burn_tokens.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../contracts/FungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleToken from 0xTOKENADDRESS',
- f'import ExampleToken from "{Path("../contracts/ExampleToken.cdc").resolve()}"'
- )
-
diff --git a/compat/suite/flow-nft.yaml b/compat/suite/flow-nft.yaml
index c6d93cc7bd..958f72f5bb 100644
--- a/compat/suite/flow-nft.yaml
+++ b/compat/suite/flow-nft.yaml
@@ -7,57 +7,3 @@ branch: master
go_tests:
- path: lib/go/test
command: make test
-files:
-- path: contracts/NonFungibleToken.cdc
-- path: contracts/ExampleNFT.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0x02',
- f'import NonFungibleToken from "{Path("NonFungibleToken.cdc").resolve()}"'
- )
-
-
-- path: transactions/mint_nft.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../contracts/NonFungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleNFT from 0xNFTCONTRACTADDRESS',
- f'import ExampleNFT from "{Path("../contracts/ExampleNFT.cdc").resolve()}"'
- )
-
-- path: transactions/setup_account.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../contracts/NonFungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleNFT from 0xNFTCONTRACTADDRESS',
- f'import ExampleNFT from "{Path("../contracts/ExampleNFT.cdc").resolve()}"'
- )
-
-- path: transactions/transfer_nft.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../contracts/NonFungibleToken.cdc").resolve()}"'
- )
- replace(
- 'import ExampleNFT from 0xNFTCONTRACTADDRESS',
- f'import ExampleNFT from "{Path("../contracts/ExampleNFT.cdc").resolve()}"'
- )
\ No newline at end of file
diff --git a/compat/suite/nba-smart-contracts.yaml b/compat/suite/nba-smart-contracts.yaml
index f56ebbfcee..8e44b443f3 100644
--- a/compat/suite/nba-smart-contracts.yaml
+++ b/compat/suite/nba-smart-contracts.yaml
@@ -7,84 +7,3 @@ branch: master
go_tests:
- path: lib/go/test
command: make test
-files:
-- path: contracts/TopShot.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../../flow-nft/contracts/NonFungibleToken.cdc").resolve()}"'
- )
-
-- path: contracts/MarketTopShot.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../../flow-nft/contracts/NonFungibleToken.cdc").resolve()}"'
- )
-
- replace(
- 'import TopShot from 0xTOPSHOTADDRESS',
- f'import TopShot from "{Path("TopShot.cdc").resolve()}"'
- )
-
-- path: contracts/TopShotMarketV2.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import FungibleToken from 0xFUNGIBLETOKENADDRESS',
- f'import FungibleToken from "{Path("../../flow-ft/contracts/FungibleToken.cdc").resolve()}"'
- )
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../../flow-nft/contracts/NonFungibleToken.cdc").resolve()}"'
- )
-
- replace(
- 'import TopShot from 0xTOPSHOTADDRESS',
- f'import TopShot from "{Path("TopShot.cdc").resolve()}"'
- )
-
-- path: contracts/TopShotShardedCollection.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import NonFungibleToken from 0xNFTADDRESS',
- f'import NonFungibleToken from "{Path("../../flow-nft/contracts/NonFungibleToken.cdc").resolve()}"'
- )
-
- replace(
- 'import TopShot from 0xTOPSHOTADDRESS',
- f'import TopShot from "{Path("TopShot.cdc").resolve()}"'
- )
-
-- path: contracts/TopshotAdminReceiver.cdc
- # language=Python prefix="replace: Callable[[str, str], None]\n"
- prepare: |
- from pathlib import Path
-
- replace(
- 'import TopShotShardedCollection from 0xSHARDEDADDRESS',
- f'import TopShotShardedCollection from "{Path("TopShotShardedCollection.cdc").resolve()}"'
- )
-
- replace(
- 'import TopShot from 0xTOPSHOTADDRESS',
- f'import TopShot from "{Path("TopShot.cdc").resolve()}"'
- )
-