Skip to content

Commit

Permalink
test(evm): Add tests for bank wrapper (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xstepit authored Jan 6, 2025
1 parent aa55561 commit a5e96b2
Show file tree
Hide file tree
Showing 8 changed files with 1,019 additions and 3 deletions.
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

0 comments on commit a5e96b2

Please sign in to comment.