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

WeightsV2 support for contracts pallet #8538

Merged
merged 7 commits into from
Mar 29, 2023
Merged

Conversation

niklabh
Copy link
Contributor

@niklabh niklabh commented Dec 14, 2022

Fixes: #8364

@jacogr
Copy link
Member

jacogr commented Dec 14, 2022

Brilliant! Will take a peek in the morning.

@niklabh
Copy link
Contributor Author

niklabh commented Dec 21, 2022

Please review.

@niklabh
Copy link
Contributor Author

niklabh commented Jan 2, 2023

Hey @jacogr Can you please review. This is high priority for WASM Networks.

@forgetso
Copy link

forgetso commented Jan 6, 2023

I'm working with this PR locally and have spotted that the tool tips need updated for proofSize and refTime. They both currently have the same tooltip:

'The maximum amount of gas to use for this contract call. If the call requires more, it will fail.'

@honne23
Copy link

honne23 commented Feb 1, 2023

bumping because this is really needed for dev

@zabuxx
Copy link

zabuxx commented Feb 4, 2023

Bump 🤗

@akorchyn
Copy link

akorchyn commented Feb 7, 2023

Any updates on it?

@andrii-kl
Copy link

+1

3 similar comments
@abhijeetbhagat
Copy link
Contributor

+1

@PierreOssun
Copy link

+1

@KennethVrb
Copy link

+1

@forgetso
Copy link

forgetso commented Mar 2, 2023

Thanks for the update @niklabh. I also noticed that weight is mentioned on the block pages.

image

However, it's hard to work out what % of a block is populated based on refTime and proofSize without some official guidance. Maybe it's still the refTime divided by the maxBlock.refTime. Anyway, the above is calculated using ? weight.v1Weight.mul(BN_TEN_THOUSAND).div(maxBlockWeight).toNumber() / 100 currently.

@adamdossa
Copy link
Contributor

Bumping as we'd also like this! @jacogr any idea when this might be merged?

jacogr
jacogr previously approved these changes Mar 20, 2023
Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

Thank you. Appreciate it.

Could you please merge in master, there are a lot of conflicts.

@niklabh
Copy link
Contributor Author

niklabh commented Mar 27, 2023

Thank you. Appreciate it.

Could you please merge in master, there are a lot of conflicts.

Done

@forgetso
Copy link

forgetso commented Mar 27, 2023

A slight modification is needed to allow uploading contracts via .wasm and .json. When a .contract is uploaded the wasm is in Raw format. When the wasm is uploaded separately, it is a UInt8Array and the deploy fails with contracts.StorageDepositLimitExhausted. This can be fixed by modifying the dryRun function in Upload.tsx.

Change

              { Upload: wasm },

to

              { Upload: api.registry.createType('Raw', wasm) },

here

https://github.com/niklabh/apps/blob/0f6639ebac89c8c0ed6b79afd5b6cd770d03248d/packages/page-contracts/src/Codes/Upload.tsx#L99

Thanks for the PR @niklabh.

@jacogr jacogr dismissed their stale review March 28, 2023 11:04

Stale.

jacogr
jacogr previously requested changes Mar 28, 2023
Copy link
Member

@jacogr jacogr left a comment

Choose a reason for hiding this comment

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

@niklabh
Copy link
Contributor Author

niklabh commented Mar 28, 2023

A slight modification is needed to allow uploading contracts via .wasm and .json. When a .contract is uploaded the wasm is in Raw format. When the wasm is uploaded separately, it is a UInt8Array and the deploy fails with contracts.StorageDepositLimitExhausted. This can be fixed by modifying the dryRun function in Upload.tsx.

Change

              { Upload: wasm },

to

              { Upload: api.registry.createType('Raw', wasm) },

here

https://github.com/niklabh/apps/blob/0f6639ebac89c8c0ed6b79afd5b6cd770d03248d/packages/page-contracts/src/Codes/Upload.tsx#L99

Thanks for the PR @niklabh.

Done

@niklabh
Copy link
Contributor Author

niklabh commented Mar 28, 2023

@niklabh niklabh requested a review from jacogr March 28, 2023 12:12
@jacogr jacogr dismissed their stale review March 29, 2023 12:16

Stale.

@jacogr jacogr merged commit d317ee8 into polkadot-js:master Mar 29, 2023
@polkadot-js-bot
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators Apr 4, 2023
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.

Contracts: Weights V2 support