CosmWasm / CosmWasm/cw-plus

Cosmwasm@V3

Open
#921 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
527
Forks
363
PR merge metrics
No merged PRs in 30d

Description

## Goal
With the latest release of the core Cosmwasm libraries, we can upgrade this library to the latest version.

## Context
Most changes to this major version upgrade are straightforward, however there are a few crucial design decisions to make in order to upgrade these crates. Specifically:

- `Coin` struct in cosmwasm now uses **Uint256** for its *amount* value. We must decide if we update all balance related objects in this library from Uint128 to Uint256, including contract message types and internal states.

I have a first pass at the migration with full passing test [here](https://github.com/permissionlessweb/cw-plus/pull/2),which do replace most Uint128 expectations with Uint256. NOTE: `cw4-stake` does not have Uint128 updated to Uint256 in this demo , due to the way the `calc_weight` function was implemented in this demo. This function expects to return a u64 value from division of a users stake and tokens per weight, and to prevent a scenario where the result of this arithmetic with Uint256 is > u64::MAX, this crate still uses Uint128.

I would love to hear how others view this migration should be implemented! This crate is heavily relied on in various contract in the ecosystem, so lets get this upgraded! ::)

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the migration described in the linked pull request and the balance-related types affected by the CosmWasm upgrade. Pay particular attention to the `cw4-stake` crate and its `calc_weight` function, which still uses Uint128. Done requires agreeing on the Uint128-to-Uint256 scope, including contract messages and internal state, then validating the migration with the project’s passing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
blockchain
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.