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

deps: update wasm-clients to sdk50 #4616

Closed
wants to merge 70 commits into from

Conversation

faddat
Copy link
Contributor

@faddat faddat commented Sep 10, 2023

NOTE

This is probably not going to be merged. I've opened a PR to make it easy for others to reference the work.

Commits

Description

This PR updates wasm-clients to sdk v0.50.x and is targeted at main to test another strategy. Currently everything works except for misbehaviour tests.

Commit Message / Changelog Entry

deps: update wasm-clients to sdk v0.50.x

see the guidelines for commit messages. (view raw markdown for examples)


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md).
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards and Go style guide.
  • Wrote unit and integration tests.
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/).
  • Added relevant godoc comments.
  • Provide a commit message to be used for the changelog entry in the PR description for review.
  • Re-reviewed Files changed in the Github PR explorer.
  • Review Codecov Report in the comment section below once CI passes.

misko9 and others added 30 commits July 6, 2023 08:34
…s#3486)

Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com>
Co-authored-by: antstalepresh <stalepresh121@outlook.com>
Co-authored-by: Vladislav Markushin <negigic@gmail.com>
Co-authored-by: Blas Rodriguez Irizar <rodrigblas@gmail.com>
Co-authored-by: Jacob Gadikian <jacobgadikian@gmail.com>
Co-authored-by: vuong <nguyenvuong1122000@gmail.com>
Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
* new error

* changed all the errors

* feat: Changed some more erros from sdkerrors to errorsmod

* added ibcerrors

* fixes and linting

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
* imp: add separate go.mod for 08-wasm

* fix e2e build

* remove import

* lint

* Amend CI testing to not build on arm, correctly cross compile on arm64. (cosmos#4065)

* Use alpine for building simd in docker. Link statically. (cosmos#4066)

---------

Co-authored-by: Charly <charly@interchain.berlin>
Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
* remove code ID key from genesis type

* address review comment
* bump wasmvm to v1.2.4

* go mod tidy e2e

* Update Dockerfile

* update libwasm sha

* more go mod tidy

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
* build and test wasm-client on pull request

* add arm64 for wasm build only
* merge functions

* address review comment
* pin code to the wasm VM cache

* follow ibc-go error wrapping standards

* Update modules/light-clients/08-wasm/keeper/keeper.go

Co-authored-by: Reece Williams <31943163+Reecepbcups@users.noreply.github.com>

---------

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
* renaming to align with x/wasm naming

* fix typo

* Update docs/architecture/adr-027-ibc-wasm.md

Co-authored-by: Damian Nolan <damiannolan@gmail.com>

* address review comments

* review comment

---------

Co-authored-by: Damian Nolan <damiannolan@gmail.com>
* disallow submessage execution

* fix error code

* alignment

* fix
# Conflicts:
#	Dockerfile
#	testing/chain.go
* Add linting for 08-wasm.

* Go mod tidy.

* Please the linter.
* add 08-wasm global store key

* Update client_state.go

* Update modules/light-clients/08-wasm/types/vm.go

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
…n `initialize` to contract (cosmos#4033)

* remove calls to set client state and consensus state from initialize

* linting

* Update contracts

* use errorsmod

---------

Co-authored-by: Vladislav Markushin <negigic@gmail.com>
…etrieve it (cosmos#4034)

* imp: remove timestamp from consensus state

* more linting

* make types unexported

* make proto-all

* code hash for code id

* Use hasConsensusState instead of GetConsensusState (cosmos#4171)

* Use hasConsensusState instead of GetConsensusState.

* Use wasmQuery for the rest of the query functions. (cosmos#4176)

* Use wasmQuery for the rest of the query functions.

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

* review comments

* Remove check for consensus state.

* Add linting for 08-wasm module (cosmos#4206)

* Add linting for 08-wasm.

* Go mod tidy.

* Please the linter.

* add 08-wasm global store key (cosmos#4185)

* add 08-wasm global store key

* Update client_state.go

* Update modules/light-clients/08-wasm/types/vm.go

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>

* solve conflicts

* review comments/fix linter warnings

* address comments

* add missing check

* remove check that was wrong

---------

Co-authored-by: Jim Fasarakis-Hilliard <d.f.hilliard@gmail.com>
…our` (cosmos#4049)

* imp: merge header and misbehaviour types

* remove unused code
…calls (cosmos#4133)

* defined query and sudo message types to encapsulate all variants for calls

* pass client message

* add ClientMessage from cosmos#4049

* address review comments

* linter

* gofumpt

* review comment

* more gofumpt
…ce (cosmos#4109)

* add constructor that accepts pointer to Wasm VM instance

* typo

* add functions that returns wasm config with default values

* review comment

* Apply suggestions from code review

Co-authored-by: Cian Hatton <cian@interchain.io>

* review comments

* rename constructor function

* address review comments

* set contract debug mode to false

---------

Co-authored-by: Cian Hatton <cian@interchain.io>
TestInitializeTendermint(), remove unnecessary test from
TestConsensusStateValidateBasic(), change the update state result's
height type.
* Rename from call to wasmCall.

* Move wasmQuery, wasmCall into vm.

* Add wasmInit, mirroring wasmCall and wasmQuery.

* Directly return after wasmInit.
crodriguezvega and others added 26 commits September 1, 2023 23:28
# Conflicts:
#	.github/dependabot.yml
#	e2e/go.mod
#	e2e/go.sum
#	go.sum
* Add new cmd to store code via a gov proposal.

* Address feedback.

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>

---------

Co-authored-by: Carlos Rodriguez <carlos@interchain.io>
TestInitializeTendermint(), remove unnecessary test from
TestConsensusStateValidateBasic(), change the update state result's
height type.
TestStatusGrandpa, and TestExportGenesisGrandpa working again
TestUpdateStateGrandpa, TestVerifyUpgradeGrandpa working again
@codecov-commenter
Copy link

codecov-commenter commented Sep 10, 2023

Codecov Report

Merging #4616 (64e1d98) into main (e192899) will decrease coverage by 0.09%.
Report is 2 commits behind head on main.
The diff coverage is 30.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #4616      +/-   ##
==========================================
- Coverage   79.27%   79.18%   -0.09%     
==========================================
  Files         188      188              
  Lines       13046    13061      +15     
==========================================
+ Hits        10342    10343       +1     
- Misses       2270     2282      +12     
- Partials      434      436       +2     
Files Changed Coverage Δ
modules/apps/29-fee/keeper/msg_server.go 97.14% <ø> (ø)
modules/core/02-client/types/params.go 100.00% <ø> (ø)
modules/core/keeper/keeper.go 91.48% <ø> (-0.18%) ⬇️
modules/core/02-client/keeper/keeper.go 78.57% <22.22%> (-4.01%) ⬇️
modules/core/03-connection/keeper/handshake.go 88.58% <100.00%> (ø)

ExportMetadata: &exportMetadataMsg{},
}

ctx := sdk.NewContext(nil, tmproto.Header{Height: 1, Time: time.Now()}, true, nil) // context with infinite gas meter

Check warning

Code scanning / CodeQL

Calling the system time Warning

Calling the system time may be a possible source of non-determinism
// newStoreAdapter constructor
func newStoreAdapter(s storetypes.KVStore) *storeAdapter {
if s == nil {
panic("store must not be nil")

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt

// safety checks before casting below
if height < 0 {
panic("Block height must never be negative")

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
}
nsec := ctx.BlockTime().UnixNano()
if nsec < 0 {
panic("Block (unix) time must never be negative ")

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (cs ClientState) UpdateState(ctx sdk.Context, cdc codec.BinaryCodec, clientStore storetypes.KVStore, clientMsg exported.ClientMessage) []exported.Height {
clientMessage, ok := clientMsg.(*ClientMessage)
if !ok {
panic(fmt.Errorf("expected type %T, got %T", &ClientMessage{}, clientMsg))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
// InstantiateContractCosts costs when interacting with a wasm contract
func (g WasmGasRegister) InstantiateContractCosts(msgLen int) storetypes.Gas {
if msgLen < 0 {
panic(errorsmod.Wrap(ErrInvalid, "negative length"))

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
func (g WasmGasRegister) ToWasmVMGas(source storetypes.Gas) uint64 {
x := source * g.c.GasMultiplier
if x < source {
panic(storetypes.ErrorOutOfGas{Descriptor: "overflow"})

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
ctx.GasMeter().ConsumeGas(consumed, "wasm contract")
// throw OutOfGas error if we ran out (got exactly to zero due to better limit enforcing)
if ctx.GasMeter().IsOutOfGas() {
panic(storetypes.ErrorOutOfGas{Descriptor: "Wasmer function execution"})

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt

result, err := wasmCall[updateStateResult](ctx, clientStore, &cs, payload)
if err != nil {
panic(err)

Check warning

Code scanning / CodeQL

Panic in BeginBock or EndBlock consensus methods Warning

Possible panics in BeginBock- or EndBlock-related consensus methods could cause a chain halt
"crypto/sha256"
"encoding/hex"
"fmt"
"reflect"

Check notice

Code scanning / CodeQL

Sensitive package import Note

Certain system packages contain functions which may be a possible source of non-determinism
@faddat faddat closed this Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants