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

chore!: refactor predicate and script deployment #3389

Merged
merged 8 commits into from
Nov 14, 2024

Conversation

nedsalk
Copy link
Contributor

@nedsalk nedsalk commented Nov 12, 2024

Summary

Moves predicate and script deployment from ContractFactory to their respective classes as a deploy instance method.

Breaking Changes

ContractFactory.deployAsBlobTxForScript has been removed in favor of Predicate.deploy and Script.deploy:

// before
const factory = new ContractFactory(scriptBytecode, scriptAbi, wallet);
const { waitForResult } = await factory.deployAsBlobTxForScript();
const { loaderBytecode, configurableOffsetDiff } = await waitForResult();

// after
const script = new Script(scriptBytecode, scriptAbi, wallet);
const { blobId, waitForResult } = await script.deploy(deployerWallet);
const loaderScript = await waitForResult();

const predicate = new Predicate({ bytecode, abi, provider });
const { blobId, waitForResult } = await predicate.deploy(deployerWallet);
const loaderPredicate = await waitForResult();

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

@nedsalk nedsalk added the chore Issue is a chore label Nov 12, 2024
@nedsalk nedsalk self-assigned this Nov 12, 2024
Copy link

vercel bot commented Nov 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuels-template ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 14, 2024 5:09am
ts-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 14, 2024 5:09am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
ts-docs-api ⬜️ Ignored (Inspect) Nov 14, 2024 5:09am

Copy link

codspeed-hq bot commented Nov 12, 2024

CodSpeed Performance Report

Merging #3389 will not alter performance

Comparing ns/chore/refactor-blob-deployment (fbad45f) with master (5dee7ff)

Summary

✅ 18 untouched benchmarks

Torres-ssf
Torres-ssf previously approved these changes Nov 13, 2024
Copy link
Contributor

@Torres-ssf Torres-ssf left a comment

Choose a reason for hiding this comment

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

Great job on this @nedsalk 👏

packages/script/src/script.ts Outdated Show resolved Hide resolved
Torres-ssf
Torres-ssf previously approved these changes Nov 13, 2024
@Dhaiwat10
Copy link
Member

Great work @nedsalk, looks like there is a signficant drop in the coverage for some of the files - specifically adjustOffsets.ts. Maybe worth considering?

@nedsalk
Copy link
Contributor Author

nedsalk commented Nov 13, 2024

@Dhaiwat10 good catch! It's because the file is not used anymore given that the logic was moved to another place. I have removed it in 3504151.

@nedsalk nedsalk enabled auto-merge (squash) November 13, 2024 14:40
@nedsalk nedsalk disabled auto-merge November 13, 2024 15:14
Copy link
Contributor

Coverage Report:

Lines Branches Functions Statements
64.28%(-0.07%) 69.74%(+0.11%) 73.11%(-0.21%) 64.72%(-0.07%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/predicate/predicate.ts 22.58%
(+0.96%)
28.57%
(-0.46%)
10.52%
(-0.59%)
21.21%
(+0.7%)
🔴 ✨ packages/account/src/utils/deployScriptOrPredicate.ts 0%
(+0%)
0%
(+0%)
0%
(+0%)
0%
(+0%)
🔴 ✨ packages/account/src/utils/predicate-script-loader-instructions.ts 12.82%
(+12.82%)
0%
(+0%)
0%
(+0%)
12.19%
(+12.19%)
🔴 packages/contract/src/contract-factory.ts 32.6%
(+5.82%)
26.66%
(+3.81%)
34.78%
(+4.02%)
31.91%
(+5.6%)
packages/fuels/src/cli/commands/deploy/deployPredicates.ts 100%
(+0%)
100%
(+50%)
100%
(+0%)
100%
(+0%)
packages/fuels/src/cli/commands/deploy/deployScripts.ts 100%
(+0%)
100%
(+50%)
100%
(+0%)
100%
(+0%)
🔴 packages/script/src/script.ts 65%
(-7.22%)
75%
(+0%)
50%
(-25%)
65%
(-7.22%)

@nedsalk nedsalk merged commit b0e9c84 into master Nov 14, 2024
25 checks passed
@nedsalk nedsalk deleted the ns/chore/refactor-blob-deployment branch November 14, 2024 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move script and predicate blob deployment logic away from ContractFactory
5 participants