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

Feat/wasm upgrade #49

Closed
wants to merge 14 commits into from
Closed

Feat/wasm upgrade #49

wants to merge 14 commits into from

Conversation

fragwuerdig
Copy link
Collaborator

Summary of changes

This is the WASM upgrade from the PR over here I cherry-picked the commits and based them on v1.0.4 release.

There is one odd thing I have. In order to complete go mod tidy I needed to remove the line from the replace section in go.mod

github.com/tecbot/gorocksdb => github.com/cosmos/gorocksdb v1.2.0

Otherwise, if I don't do it, the go mod tidy won't complete, rendereing go.sum useless and breaking the build. Can somebody please review on that one?

Report of required housekeeping

  • Github issue OR spec proposal link
  • Wrote tests
  • Updated API documentation (client/lcd/swagger-ui/swagger.yaml)
  • Added a relevant changelog entry: clog add [section] [stanza] [message]

(FOR ADMIN) Before merging

  • Added appropriate labels to PR
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)
  • Confirm added tests are consistent with the intended behavior of changes
  • Ensure all tests pass

app/app.go Show resolved Hide resolved
types/fork/height.go Show resolved Hide resolved
x/wasm/keeper/api.go Show resolved Hide resolved
@ZaradarBH ZaradarBH added enhancement New feature or request in scope Work approved by the community labels Jan 18, 2023
@ZaradarBH ZaradarBH added this to the v2.0.4 milestone Jan 18, 2023
@@ -8,7 +8,7 @@ import (

// Constant gas parameters
const (
GasMultiplier = uint64(100) // Please note that all gas prices returned to the wasmVM engine should have this multiplied
GasMultiplier = uint64(140_000_000) // Please note that all gas prices returned to the wasmVM engine should have this multiplied

Choose a reason for hiding this comment

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

why is this 140_000_000 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Please have a look at the wasmd reference implementation. The wasmvm gas calculations made a major step in the upgrade from 0.16 -> 1.0.0. wasmd v0.27.0 is the version that fully incorporates the new wasmvm. The final gas multiplier was set to 140,000,000 to convert sdk gas to wasmer gas and vice versa.

CosmWasm/wasmd#628
CosmWasm/wasmd#636

},
"recursion 1, no work": {
gasLimit: 400_000,
msg: Recurse{
Depth: 1,
},
expectedGas: 2*GasNoWork + GasReturnUnhashed,
expectedGas: 0x150f8,

Choose a reason for hiding this comment

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

it's changed the test logic. Can you tell me where this change come from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The new gas calculation strategy in wasmvm leads to different values in the expected gas. This also happened in the wasmd update to v0.27. They needed to tinker with the expected test values too. I simply took the values that the test would expect.

I couldn't take the test values from wasmd. Because, the thing with terrad and wasmd is that the gas cost for emitted events from a contract call are inherently different (terrad charges per byte, while wasmd charges per event). That's why I kinda figured the expected test values are more or less regression reassurances for updates that come after this one.

@nghuyenthevinh2000
Copy link
Contributor

nghuyenthevinh2000 commented Jan 25, 2023

I am comparing your work to this branch of wasmd: https://github.com/CosmWasm/wasmd/tree/v0.28.0/x/wasm

Originally, I think terra classic team just copy x/wasm into their repo

IBC feature will be missing from our wasm module version which I think is a really big hit for cross - chain smart contract

@nghuyenthevinh2000
Copy link
Contributor

nghuyenthevinh2000 commented Jan 25, 2023

@fragwuerdig
I see that you are upgrading wasm from v1.0.4 rather from main.
Perharps, we can do the wasm upgrade again from main? I think that it should be quick.

Trying to merge this one will override some changes in current main.

I make a branch from main here: #67

@nghuyenthevinh2000 nghuyenthevinh2000 mentioned this pull request Jan 25, 2023
8 tasks
@fragwuerdig
Copy link
Collaborator Author

@nghuyenthevinh2000: Should we close this one in favor of #67?

@nghuyenthevinh2000
Copy link
Contributor

@nghuyenthevinh2000: Should we close this one in favor of #67?

Yes, I think so. #67 will not override logic in main branch when merge

@fragwuerdig
Copy link
Collaborator Author

Closed in favor of #67

@inon-man inon-man deleted the feat/wasm-upgrade branch February 13, 2023 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in scope Work approved by the community
Projects
No open projects
Status: Abandoned
Development

Successfully merging this pull request may close these issues.

6 participants