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

test(evm): Add tests for bank wrapper #65

Merged
merged 12 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
This changelog was created using the `clu` binary
(https://github.com/MalteHerrmann/changelog-utils).
-->

# Changelog

## Unreleased
Expand Down Expand Up @@ -30,3 +31,4 @@ This changelog was created using the `clu` binary
- (proto) [#14](https://github.com/evmos/os/pull/14) Add Protobufs and adjust scripts.
- (eip-712) [#13](https://github.com/evmos/os/pull/13) Add EIP-712 package.
- (ci) [#12](https://github.com/evmos/os/pull/12) Add CI workflows, configurations, Makefile, License, etc.
- (tests) [#65](https://github.com/evmos/os/pull/65) Add tests for bank wrapper in EVM module with mock.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ require (
github.com/dop251/goja v0.0.0-20220405120441-9037c2b61cbf
github.com/ethereum/go-ethereum v1.11.5
github.com/evmos/os/example_chain v0.0.0-20240924163020-b2a4187dad50
github.com/golang/mock v1.6.0
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
github.com/gorilla/websocket v1.5.3
Expand All @@ -48,6 +47,7 @@ require (
github.com/tidwall/sjson v1.2.5
github.com/tyler-smith/go-bip39 v1.1.0
github.com/zondax/hid v0.9.2
go.uber.org/mock v0.5.0
golang.org/x/crypto v0.29.0
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
golang.org/x/net v0.31.0
Expand Down Expand Up @@ -135,6 +135,7 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v1.2.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/mock v1.6.0 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.3 // indirect
github.com/google/flatbuffers v23.5.26+incompatible // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1194,6 +1194,8 @@ go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/mock v0.5.0 h1:KAMbZvZPyBPWgD14IrIQ38QCyjwpvVVV6K/bHl1IwQU=
go.uber.org/mock v0.5.0/go.mod h1:ge71pBPLYDk7QIi1LupWxdAykm7KIEFchiOqd6z7qMM=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
Expand Down
2 changes: 1 addition & 1 deletion x/erc20/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
erc20mocks "github.com/evmos/os/x/erc20/types/mocks"
"github.com/evmos/os/x/evm/statedb"
evmtypes "github.com/evmos/os/x/evm/types"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/mock"
gomock "go.uber.org/mock/gomock"
)

func (suite *KeeperTestSuite) TestConvertERC20NativeERC20() {
Expand Down
2 changes: 1 addition & 1 deletion x/erc20/types/mocks/BankKeeper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions x/evm/types/scaling.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (
// MustConvertEvmCoinTo18Decimals converts the coin's Amount from its original
// representation into a 18 decimals. The function panics if coin denom is
// not the evm denom or in case of overflow.
//
// CONTRACT: The function should only be called when the coin denom is the EVM. This means that
// should be called only when the code forces the denom to be the expected one.
func MustConvertEvmCoinTo18Decimals(coin sdk.Coin) sdk.Coin {
if coin.Denom != GetEVMCoinDenom() {
panic(fmt.Sprintf("expected evm denom %s, received %s", GetEVMCoinDenom(), coin.Denom))
Expand Down
Loading
Loading