Skip to content

Commit

Permalink
update to provenance 1.19.0 (#156)
Browse files Browse the repository at this point in the history
* set provenance version to 1.19.0-rc2

* update list of provenance types to generate

* add oracle message types to generator

* update provenance version in generate script and COMMIT file

* add ibchooks types

* add ibcratelimit types

* add oracle types

* qualify TryFrom/Into Result in CosmwasmExt macro

* correct the mod path in exclusions for generation

* set excludes paths for generating types

* generate all types instead of whitelisting types

* remove serde alias transform and add custom as_str_bytes transform for specific metadata field types

* remove dead code and add custom as_str_bytes_vec transform for specific metadata field types

* add serde vec<u8> as base64 encoded str or str bytes

* add transformer that adds serde emun_as_i32 to enumerated types

* fix enum_as_i32 transformer and add implementation

* allow clippy::large_enum_variant on generated types

* add generated capability types

* add generated cosmos types

* add generated cosmwasm types

* add generated ibc types

* add generated provenance types

* add generated tendermint types

* add types mod

* update to cosmwasm 2.1

* cleanup transformers

* add ability to exclude specific structure types from generation

* add code generator for root modules as feature flags

* generated feature flags and update cargo.toml

* update contract schemas

* update changelog

* update migration doc

* update to optimizer 0.16.0

* update to provenance v1.19.0-rc3

* fix serde of i32 or vec<i32> as str or enum string

* fix format

* regenerate types with latest fix

* set 64 & 128 bit int types to string serialization

* regenerate types with latest fix

* update changelog, readme, migration docs

* remove module feature. will wait for grpc

* update to provenance v1.19.0-rc5

* add default features since they are still used internally to the code

---------

Co-authored-by: Stephen Cirner <[email protected]>
  • Loading branch information
kwtalley and scirner22 authored Jul 15, 2024
1 parent 056d401 commit 40ffc8f
Show file tree
Hide file tree
Showing 236 changed files with 41,776 additions and 3,561 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
test_script: "./scripts/gh-action-test/tutorial_test.sh"

test_attrs_smart_contract:
Expand All @@ -55,7 +55,7 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
smart_contract_action_version: "latest"
test_script: "./scripts/gh-action-test/attrs_test.sh"

Expand All @@ -76,7 +76,7 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
smart_contract_action_version: "latest"
test_script: "./scripts/gh-action-test/marker_test.sh"

Expand All @@ -97,7 +97,7 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
smart_contract_action_version: "latest"
test_script: "./scripts/gh-action-test/msgfees_test.sh"

Expand All @@ -118,7 +118,7 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
smart_contract_action_version: "latest"
test_script: "./scripts/gh-action-test/name_test.sh"

Expand All @@ -139,7 +139,7 @@ jobs:
# uses: provenance-io/[email protected]
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# provenance_version: "v1.19.0-rc2"
# provenance_version: "v1.19.0-rc5"
# smart_contract_action_version: "latest"
# test_script: "./scripts/gh-action-test/scope_test.sh"

Expand All @@ -160,6 +160,6 @@ jobs:
uses: provenance-io/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
provenance_version: "v1.19.0-rc2"
provenance_version: "v1.19.0-rc5"
smart_contract_action_version: "latest"
test_script: "./scripts/gh-action-test/trigger_test.sh"
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* fix code generation ([#150](https://github.com/provenance-io/provwasm/issues/150))
* refactor `Any` to support Trigger messages ([#123](https://github.com/provenance-io/provwasm/issues/123))
* Update to cosmwasm 2.x ([#141](https://github.com/provenance-io/provwasm/issues/141))
* minimize generated types ([#152](https://github.com/provenance-io/provwasm/issues/152))
* update to provenance 1.19.0-rc5 ([#155](https://github.com/provenance-io/provwasm/issues/155))

## Releases

Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ license = "Apache-2.0"
### CosmWasm

cosmwasm-schema = { version = "2.0.4" }
cosmwasm-std = { version = "2.0.4", default-features = false, features = ["cosmwasm_2_0", "stargate", "std"] }
cosmwasm-std = { version = "2.1.0", default-features = false, features = ["cosmwasm_2_1", "stargate", "std"] }
cw-storage-plus = { version = "2.0.0" }

### ProvWasm
Expand Down
29 changes: 21 additions & 8 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
# Migrating Contracts

This guide provides information to assist in migrating contracts over major releases.
This guide provides information to assist in migrating contracts over major releases.

___There are also example [contracts](./contracts) that provide concrete examples using the current release.___

## v2.1.0/v2.2.0 -> 2.3.0

Cosmwasm is upgraded to 2.0.4 and Provenance to 1.19.0. These major upgrades are mostly handled within the library:

- The encoding for `Any` types has changed. This means if your contract has a query that expects a `MarkerAccount` in
its response, it will fail as of `Provenance 1.19.0`. This is an internal change and only requires bumping the
provwasm-std dependency.
- Provwasm now provides all provenance messages and queries.
**There are 2 caveats**: not all queries will return valid responses (
see [allowed queries](https://github.com/provenance-io/provenance/blob/7d6c507cab780bb6f0bdeef1e895c870cf4c7465/internal/provwasm/stargate_whitelist.go#L56)),
and `provwasm-std` takes longer to build than before. This will improve with Grpc support.
- Follow the common [Cosmwasm migration path](https://github.com/cosmos/cosmos-rust). It is likely that your contract
will not require many changes. `QueryRequest::Grpc` is not supported.

## v1.x.x -> 2.0.0

This major upgrade changes the message base type from `CosmosMsg::Custom<ProvenanceMsg>` to `CosmosMsg::Stargate`. This
allows all message types to be generated from the actual proto definitions in Provenance, making it much easier to add
and deprecate types. It will require updating all `provwasm` messages and queries. You will notice a `Deprecated` warning until
you replace the older types.
allows all message types to be generated from the actual proto definitions in Provenance, making it much easier to add
and deprecate types. It will require updating all `provwasm` messages and queries. You will notice a `Deprecated`
warning until you replace the older types.

---

Expand Down Expand Up @@ -65,7 +78,7 @@ you replace the older types.
required_attributes: vec![],
}
```

---

- Message:
Expand Down Expand Up @@ -103,10 +116,10 @@ you replace the older types.
return MarkerAccount::try_from(marker)
}
```
***`MarkerAccount` is the only special type that requires `::try_from()` since it is of type `Any`. Normally query

***`MarkerAccount` is the only special type that requires `::try_from()` since it is of type `Any`. Normally query
responses are typed like the following:***

```rust
let querier = NameQuerier::new(&deps.querier);
let query_response = querier.resolve(name)?; // query_response is of type QueryResolveResponse
Expand Down
105 changes: 23 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The following table shows provwasm version compatibility for smart contract deve

| provwasm | wasmd | cosmos | provenance | module support |
|----------|---------|---------|-------------------|---------------------------------------------------------------------|
| v2.3.0 | v0.51.X | v0.50.X | v1.19.X | all Provenance and most built-in third-party |
| v2.2.0 | v0.30.X | v0.46.X | v1.18.X | attribute,exchange,hold,marker,metadata,msgfees,name,reward,trigger |
| v2.1.0 | v0.30.X | v0.46.X | v1.17.X | attribute,exchange,hold,marker,metadata,msgfees,name,reward,trigger |
| v2.0.0 | v0.30.X | v0.46.X | v1.15.X | attribute,marker,metadata,msgfees,name,reward |
Expand All @@ -36,94 +37,34 @@ IBC project.

## Contents

In addition to the core CosmWasm functionality, the provenance bindings include
In addition to the core CosmWasm functionality, the Provenance bindings include:

### Query Support

Queries are available for these Provenance modules:

- [Attribute](./packages/provwasm-std/src/types/provenance/attribute)
- provenance.attribute.v1.QueryParamsRequest
- provenance.attribute.v1.QueryAttributeRequest
- provenance.attribute.v1.QueryAttributesRequest
- provenance.attribute.v1.QueryScanRequest
- [Exchange](./packages/provwasm-std/src/types/provenance/exchange)
- provenance.exchange.v1.QueryOrderFeeCalcRequest
- provenance.exchange.v1.QueryGetOrderRequest
- provenance.exchange.v1.QueryGetOrderByExternalIDRequest
- provenance.exchange.v1.QueryGetMarketOrdersRequest
- provenance.exchange.v1.QueryGetOwnerOrdersRequest
- provenance.exchange.v1.QueryGetAssetOrdersRequest
- provenance.exchange.v1.QueryGetAllOrdersRequest
- provenance.exchange.v1.QueryGetMarketRequest
- provenance.exchange.v1.QueryGetAllMarketsRequest
- provenance.exchange.v1.QueryParamsRequest
- provenance.exchange.v1.QueryValidateCreateMarketRequest
- provenance.exchange.v1.QueryValidateMarketRequest
- provenance.exchange.v1.QueryValidateManageFeesRequest
- [Hold](./packages/provwasm-std/src/types/provenance/hold)
- provenance.hold.v1.GetHoldsRequest
- provenance.hold.v1.GetAllHoldsRequest
- [Marker](./packages/provwasm-std/src/types/provenance/marker)
- provenance.marker.v1.QueryParamsRequest
- provenance.marker.v1.QueryMarkerRequest
- provenance.marker.v1.QueryHoldingRequest
- provenance.marker.v1.QuerySupplyRequest
- provenance.marker.v1.QueryEscrowRequest
- provenance.marker.v1.QueryAccessRequest
- provenance.marker.v1.QueryDenomMetadataRequest
- [Metadata](./packages/provwasm-std/src/types/provenance/metadata)
- provenance.metadata.v1.QueryParamsRequest
- provenance.metadata.v1.ScopeRequest
- provenance.metadata.v1.SessionsRequest
- provenance.metadata.v1.RecordsRequest
- provenance.metadata.v1.OwnershipRequest
- provenance.metadata.v1.ValueOwnershipRequest
- provenance.metadata.v1.ScopeSpecificationRequest
- provenance.metadata.v1.ContractSpecificationRequest
- provenance.metadata.v1.RecordSpecificationsForContractSpecificationRequest
- provenance.metadata.v1.RecordSpecificationRequest
- provenance.metadata.v1.OSLocatorParamsRequest
- provenance.metadata.v1.OSLocatorRequest
- provenance.metadata.v1.OSLocatorsByURIRequest
- provenance.metadata.v1.OSLocatorsByScopeRequest
- The following has deserialization issues and will be `None` until fixed (
see [this issue](https://github.com/provenance-io/provwasm/issues/132):
- `ContractSpecification.source`
- `InputSpecification.source`
- `Process.process_id`
- `SessionIdComponents.scope_identifier`
- [MsgFees](./packages/provwasm-std/src/types/provenance/msgfees)
- provenance.msgfees.v1.QueryParamsRequest
- [Name](./packages/provwasm-std/src/types/provenance/name)
- provenance.name.v1.QueryParamsRequest
- provenance.name.v1.QueryResolveRequest
- provenance.name.v1.QueryReverseLookupRequest
- [Reward](./packages/provwasm-std/src/types/provenance/reward)
- provenance.reward.v1.QueryRewardProgramByIDRequest
- provenance.reward.v1.QueryRewardProgramsRequest
- provenance.reward.v1.QueryClaimPeriodRewardDistributionsRequest
- provenance.reward.v1.QueryClaimPeriodRewardDistributionsByIDRequest
- provenance.reward.v1.QueryRewardDistributionsByAddressRequest
- The following has deserialization issues and will be `None` until fixed (
see [this issue](https://github.com/provenance-io/provwasm/issues/132):
- `QualifyingAction.type`
- [Trigger](./packages/provwasm-std/src/types/provenance/trigger)
- Query support unavailable until [#123](https://github.com/provenance-io/provwasm/issues/123) is resolved
Since migrating to Stargate queries, only a subset of queries are responded to.
The [list](https://github.com/provenance-io/provenance/blob/7d6c507cab780bb6f0bdeef1e895c870cf4c7465/internal/provwasm/stargate_whitelist.go#L56)
is maintained
in [Provenance](https://github.com/provenance-io/provenance/).

__The following are known to have deserialization issues and will be `None` until upstream is fixed__ (
see [this issue](https://github.com/provenance-io/provwasm/issues/132)):

- `ContractSpecification.source`
- `InputSpecification.source`
- `Process.process_id`
- `SessionIdComponents.scope_identifier`
- `QualifyingAction.type`

### Message Encoding

All messages are available for these Provenance modules:

- [Attribute](./packages/provwasm-std/src/types/provenance/attribute)
- [Exchange](./packages/provwasm-std/src/types/provenance/exchange)
- [Hold](./packages/provwasm-std/src/types/provenance/hold)
- [Marker](./packages/provwasm-std/src/types/provenance/marker)
- [Metadata](./packages/provwasm-std/src/types/provenance/metadata)
- [MsgFees](./packages/provwasm-std/src/types/provenance/msgfees)
- [Name](./packages/provwasm-std/src/types/provenance/name)
- [Reward](./packages/provwasm-std/src/types/provenance/reward)
- [Trigger](./packages/provwasm-std/src/types/provenance/trigger)
_Provenance includes third-party protobuf definitions to maintain compatibility_

- [provenance](packages/provwasm-std/src/types/provenance)
- [capability](packages/provwasm-std/src/types/capability)
- [cosmos](packages/provwasm-std/src/types/cosmos)
- [cosmwasm](packages/provwasm-std/src/types/cosmwasm)
- [ibc](packages/provwasm-std/src/types/ibc)
- [tendermint](packages/provwasm-std/src/types/tendermint)

## Migration

Expand Down
2 changes: 1 addition & 1 deletion contracts/attrs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ optimize:
docker run --rm -v $(CURDIR)/../../:/code:Z --workdir /code/contracts/attrs \
--mount type=volume,source=attrs_cache,target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
$$image:0.15.0
$$image:0.16.0

.PHONY: install
install:
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc/local/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ optimize:
docker run --rm -v $(CURDIR)/../../../:/code:Z --workdir /code/contracts/ibc/local \
--mount type=volume,source=ibc_local_cache,target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
$$image:0.15.0
$$image:0.16.0

.PHONY: install
install:
Expand Down
2 changes: 1 addition & 1 deletion contracts/ibc/remote/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ optimize:
docker run --rm -v $(CURDIR)/../../../:/code:Z --workdir /code/contracts/ibc/remote \
--mount type=volume,source=ibc_remote_cache,target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
$$image:0.15.0
$$image:0.16.0

.PHONY: install
install:
Expand Down
2 changes: 1 addition & 1 deletion contracts/marker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ optimize:
docker run --rm -v $(CURDIR)/../../:/code:Z --workdir /code/contracts/marker \
--mount type=volume,source=marker_cache,target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
$$image:0.15.0
$$image:0.16.0

.PHONY: install
install:
Expand Down
Loading

0 comments on commit 40ffc8f

Please sign in to comment.