Skip to content

Commit

Permalink
Validation Already Happens in Compiler - Remove from Router (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
tzaffi committed Mar 16, 2023
1 parent e2ade2f commit d54e165
Showing 1 changed file with 1 addition and 33 deletions.
34 changes: 1 addition & 33 deletions pyteal/ast/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pyteal.config import METHOD_ARG_NUM_CUTOFF
from pyteal.errors import AlgodClientError, TealInputError, TealInternalError
from pyteal.ir.ops import Mode
from pyteal.stack_frame import NatalStackFrame, sourcemapping_off_context
from pyteal.stack_frame import NatalStackFrame
from pyteal.types import TealType
from pyteal.util import algod_with_assertion

Expand Down Expand Up @@ -1243,38 +1243,6 @@ def _build_impl(self, input: _RouterCompileInput) -> _RouterBundle:
annotate_teal_concise=input.annotate_teal_concise,
)

if input.with_sourcemaps:
# rerun the build and compilation without the source mapper
# and verify that the teal programs are the same
with self._cleaning_context(), sourcemapping_off_context():
assert NatalStackFrame.sourcemapping_is_off()

ap_wo, csp_wo, _ = self._build_program(
version=input.version, optimize=input.optimize
)
input_wo = _RouterCompileInput(
version=input.version,
assemble_constants=input.assemble_constants,
optimize=input.optimize,
with_sourcemaps=False,
)
abundle_wo = input_wo.get_compilation(ap_wo)._compile_impl(
with_sourcemap=False
)
csbundle_wo = input_wo.get_compilation(csp_wo)._compile_impl(
with_sourcemap=False
)
_PyTealSourceMapper._validate_teal_identical(
abundle.teal,
abundle_wo.teal,
msg="FATAL ERROR. Approval Program without sourcemaps (LEFT) differs from Approval Program with (RIGHT)",
)
_PyTealSourceMapper._validate_teal_identical(
csbundle.teal,
csbundle_wo.teal,
msg="FATAL ERROR. Clear Program without sourcemaps (LEFT) differs from Clear Program with (RIGHT)",
)

return _RouterBundle(
approval_program=ap,
clear_program=csp,
Expand Down

0 comments on commit d54e165

Please sign in to comment.