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

update to provenance 1.19.0 #156

Merged
merged 43 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
b485476
set provenance version to 1.19.0-rc2
kwtalley Jul 9, 2024
8a652e7
update list of provenance types to generate
kwtalley Jul 9, 2024
c713f34
add oracle message types to generator
kwtalley Jul 9, 2024
3359d49
update provenance version in generate script and COMMIT file
kwtalley Jul 9, 2024
312dfeb
add ibchooks types
kwtalley Jul 9, 2024
00b8c1a
add ibcratelimit types
kwtalley Jul 9, 2024
d17f984
add oracle types
kwtalley Jul 9, 2024
6930857
qualify TryFrom/Into Result in CosmwasmExt macro
kwtalley Jul 10, 2024
4c884da
correct the mod path in exclusions for generation
kwtalley Jul 10, 2024
36ac461
set excludes paths for generating types
kwtalley Jul 10, 2024
da45a8b
generate all types instead of whitelisting types
kwtalley Jul 10, 2024
41bd41c
remove serde alias transform and add custom as_str_bytes transform fo…
kwtalley Jul 12, 2024
f2603e3
remove dead code and add custom as_str_bytes_vec transform for specif…
kwtalley Jul 12, 2024
b5554b3
add serde vec<u8> as base64 encoded str or str bytes
kwtalley Jul 12, 2024
19757be
add transformer that adds serde emun_as_i32 to enumerated types
kwtalley Jul 12, 2024
e638886
fix enum_as_i32 transformer and add implementation
kwtalley Jul 12, 2024
db2f2f3
allow clippy::large_enum_variant on generated types
kwtalley Jul 12, 2024
047a272
add generated capability types
kwtalley Jul 12, 2024
ae3788c
add generated cosmos types
kwtalley Jul 12, 2024
97cc1d6
add generated cosmwasm types
kwtalley Jul 12, 2024
e2f0254
add generated ibc types
kwtalley Jul 12, 2024
5b6ba2f
add generated provenance types
kwtalley Jul 12, 2024
ceba81c
add generated tendermint types
kwtalley Jul 12, 2024
ecd0585
add types mod
kwtalley Jul 12, 2024
1edee55
update to cosmwasm 2.1
kwtalley Jul 12, 2024
55799cf
cleanup transformers
kwtalley Jul 12, 2024
5481fc6
add ability to exclude specific structure types from generation
kwtalley Jul 12, 2024
31b3575
add code generator for root modules as feature flags
kwtalley Jul 12, 2024
4d8946d
generated feature flags and update cargo.toml
kwtalley Jul 12, 2024
3db2ed0
update contract schemas
kwtalley Jul 12, 2024
244e630
update changelog
kwtalley Jul 12, 2024
4642934
update migration doc
kwtalley Jul 12, 2024
5bc7620
update to optimizer 0.16.0
kwtalley Jul 12, 2024
0d3631d
update to provenance v1.19.0-rc3
kwtalley Jul 12, 2024
8e591be
fix serde of i32 or vec<i32> as str or enum string
kwtalley Jul 13, 2024
61fc94b
fix format
kwtalley Jul 13, 2024
ad9d18b
regenerate types with latest fix
kwtalley Jul 13, 2024
2f9c3ae
set 64 & 128 bit int types to string serialization
kwtalley Jul 13, 2024
56f4f78
regenerate types with latest fix
kwtalley Jul 13, 2024
288fe60
update changelog, readme, migration docs
kwtalley Jul 13, 2024
74a576e
remove module feature. will wait for grpc
kwtalley Jul 13, 2024
3074eb9
update to provenance v1.19.0-rc5
kwtalley Jul 13, 2024
a173549
add default features since they are still used internally to the code
scirner22 Jul 15, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-rc3"
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-rc3"
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-rc3"
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-rc3"
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-rc3"
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-rc3"
# 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-rc3"
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
Loading