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

✨ Feature ➾ Improve SmartPy Workflow in relation to contract and storage compilations and added native SmartPy test #1551

Merged
merged 48 commits into from
Dec 1, 2022

Conversation

jchenche
Copy link
Contributor

@jchenche jchenche commented Nov 25, 2022

🌮 Taqueria PR

Fixes #1475

🪁 Description

Provide a smooth SmartPy workflow for our SmartPy plugin by making it easier to compile and deploy. E.g. taq compile my_contract.py then taq deploy my_contract.tz (or taq deploy my_contract.tz --env testing to deploy to ghostnet) and that's it.

Users will define all compilation and expression compilation targets in their main SmartPy contract file and we will compile them all and copy the relevant artifacts (contract, storage, and expression files) to the /artifacts folder. All other artifacts will be hidden under /artifacts/.smartpy.

Compilation targets in SmartPy produce both the contract and its storage Michelson files. We will name them using the following naming convention: <CONTRACT_NAME>.storage.<COMPILATION_TARGET_NAME>.tz. But the first of these is special and will be called: <CONTRACT_NAME>.default_storage.tz (the Taquito deploy task will deem this as the default initial storage value).

Expression compilation targets in SmartPy produce only the expression Michelson file. We will name them using the following naming convention: <CONTRACT_NAME>.expression.<COMPILATION_TARGET_NAME>.tz.

Native SmartPy testing can now be done with taq test my_contract.py.

In SmartPy and LIGO's compile task, --json can be specified to emit JSON-encoded Michelson instead of pure Michelson expressions.

🪂 Pre-Merge Checklist (Definition of Done)

🚦 Required to merge:

  • ⛱️ I have completed this PR template in full and updated the title appropriately
  • ⛵ My code builds cleanly, and I have manually tested the changes
  • 🏄‍♂️ Another team member has built this branch and done manual testing on the change
  • 🏖️ New and existing unit tests pass locally and in CI
  • 🦀 Automated tests have been written and added to this PR
  • 🐬 I have commented my code, particularly in hard-to-understand areas
  • 🤿 Corresponding changes have been made to all documentation
  • 🚢 The release checklist has been completed

🛩️ Summary of Changes

Please include a summary of the changes to the codebase. Please also include relevant motivation and context for the change
(e.g. what was the existing behaviour, why did it break, etc.)

🎢 Test Plan

Please describe the testing strategy and plan for this PR. Keep this lightweight and anticipate any testing challenges

🛸 Type of Change

  • 🧽 Chore ➾
  • 🛠️ Fix ➾
  • ✨ Feature ➾
  • 👷 Refactor ➾
  • 🧪 Pre-Release ➾
  • 🚀 Release ➾

@jchenche jchenche self-assigned this Nov 25, 2022
@jchenche jchenche requested a review from a team November 25, 2022 08:46
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 25, 2022

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0c2f887
Status: ✅  Deploy successful!
Preview URL: https://58d656d8.taqueria.pages.dev
Branch Preview URL: https://1475-smartpy-jcc.taqueria.pages.dev

View logs

@github-actions
Copy link
Contributor

github-actions bot commented Nov 25, 2022

Latest Commit 0c2f887
Taq Binaries

Linux
MacOS
Windows

npm Packages

npm i @taqueria/plugin-archetype@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-contract-types@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-core@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-flextesa@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-ipfs-pinata@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-jest@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-ligo@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-metadata@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-smartpy@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-taquito@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/plugin-tezos-client@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/protocol@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/node-sdk@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/state@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @taqueria/toolkit@0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com
npm i @0.22.2-1551.0c2f887f --registry https://npm.ecadinfra.com

VSCode Extension VSIX

taqueria-vscode-1475_smartpy_JCC-ubuntu-latest

@jchenche jchenche marked this pull request as draft November 25, 2022 08:59
@jchenche jchenche marked this pull request as ready for review November 25, 2022 22:10
@jchenche jchenche changed the title ✨ Feature ➾ Provide a smooth SmartPy workflow similar to our LIGO workflow ✨ Feature ➾ Improve SmartPy Workflow in relation to contract and storage compilations and added native SmartPy test Nov 25, 2022
@jchenche jchenche requested a review from a team as a code owner November 26, 2022 15:46
@jchenche jchenche force-pushed the 1475_smartpy_JCC branch 3 times, most recently from c349495 to 9107072 Compare November 26, 2022 15:58
Stop publishing our flextesa image on every PR and just use the one that ECAD devs use when building locally
@github-actions
Copy link
Contributor

The docker image has been published and is avaiable here. Look for the image with the tag pr-1551-40875fb. The image is available for the following platforms: linux/amd64 and linux/arm64/v8.

@github-actions
Copy link
Contributor

The docker image has been published and is avaiable here. Look for the image with the tag pr-1551-18cf978. The image is available for the following platforms: linux/amd64 and linux/arm64/v8.

Copy link
Collaborator

@mweichert mweichert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There was just one missing await statement in the test suite. Other than that, looks good.

Side note, although it doesn't impact the test results when they run correctly, wrapping your test in a try/catch block is unnecessary and actually makes it harder to see where the failure occurred , as the line number of what assertion isn't present.

E.g.:

test('Verify that taqueria SmartPy plugin will output proper error message running taq test <sourceFile> command against invalid test file', async () => {
		try {
			// 1. Copy contract from data folder to taqueria project folder
			await exec(`cp e2e/data/hello-tacos-failed-tests.py ${taqueriaProjectPath}/contracts`);

			// 2. Run taq test ${testFileName}
			const { stdout } = await exec(`taq test hello-tacos-failed-tests.py`, {
				cwd: `./${taqueriaProjectPath}`,
			});
			expect(stdout).toContain('Some tests failed');
		} catch (error) {
			throw new Error(`error: ${error}`);
		}
	});

Should be:

test('Verify that taqueria SmartPy plugin will output proper error message running taq test <sourceFile> command against invalid test file', async () => {
	// 1. Copy contract from data folder to taqueria project folder
	await exec(`cp e2e/data/hello-tacos-failed-tests.py ${taqueriaProjectPath}/contracts`);

	// 2. Run taq test ${testFileName}
	const { stdout } = await exec(`taq test hello-tacos-failed-tests.py`, {
		cwd: `./${taqueriaProjectPath}`,
	});
	expect(stdout).toContain('Some tests failed');
});

This is something I had talked to Alex, and I've been removing them as I come across them. But what I think would be better is to create an issue that involves going through each test suite and removing those try/catch wrappers.

@jchenche jchenche requested a review from mweichert November 30, 2022 18:28
@hu3man hu3man merged commit 7a7d9fd into main Dec 1, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2022
@jchenche jchenche deleted the 1475_smartpy_JCC branch December 8, 2022 00:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

🚧 Dev ➾ Bring SmartPy Plugin up to Par with Ligo Plugin Functionality
5 participants