Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
onikonychev committed Jan 20, 2025
1 parent d9e34c6 commit 16f47a4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
18 changes: 7 additions & 11 deletions eth/rpc/backend/gas_used_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ func (s *BackendSuite) TestGasUsedFunTokens() {
erc20Addr, err := eth.NewEIP55AddrFromStr(testContractAddress.String())
s.Require().NoError(err)

_, err = s.backend.GetTransactionCount(s.fundedAccEthAddr, rpc.EthPendingBlockNumber)
s.Require().NoError(err)
nonce := s.getCurrentNonce(s.node.EthAddress)
balanceBefore := s.getUnibiBalance(s.fundedAccEthAddr)

txResp, err := s.network.BroadcastMsgs(s.node.Address, &evm.MsgCreateFunToken{
txResp, err := s.network.BroadcastMsgs(s.node.Address, &nonce, &evm.MsgCreateFunToken{
Sender: s.node.Address.String(),
FromErc20: &erc20Addr,
})
Expand All @@ -96,15 +96,11 @@ func (s *BackendSuite) TestGasUsedFunTokens() {
)
s.Require().NoError(err)

nonce, err := s.backend.GetTransactionCount(s.fundedAccEthAddr, rpc.EthPendingBlockNumber)
s.Require().NoError(err)

balanceBefore := s.getUnibiBalance(s.fundedAccEthAddr)

nonce = s.getCurrentNonce(s.fundedAccEthAddr)
txHash1 := SendTransaction(
s,
&gethcore.LegacyTx{
Nonce: uint64(*nonce),
Nonce: nonce,
To: &precompile.PrecompileAddr_FunToken,
Data: packedArgsPass,
Gas: 1_500_000,
Expand All @@ -123,7 +119,7 @@ func (s *BackendSuite) TestGasUsedFunTokens() {
txHash2 := SendTransaction( // should fail due to invalid recipient address
s,
&gethcore.LegacyTx{
Nonce: uint64(*nonce + 1),
Nonce: nonce + 1,
To: &precompile.PrecompileAddr_FunToken,
Data: packedArgsFail,
Gas: 1_500_000,
Expand All @@ -134,7 +130,7 @@ func (s *BackendSuite) TestGasUsedFunTokens() {
txHash3 := SendTransaction(
s,
&gethcore.LegacyTx{
Nonce: uint64(*nonce + 2),
Nonce: nonce + 2,
To: &precompile.PrecompileAddr_FunToken,
Data: packedArgsPass,
Gas: 1_500_000,
Expand Down
2 changes: 1 addition & 1 deletion eth/rpc/backend/tx_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (s *BackendSuite) TestLogs() {

s.T().Log("TX4: Create FunToken from unibi coin")
nonce++
erc20FromCoinAddr := crypto.CreateAddress(evm.EVM_MODULE_ADDRESS, s.getCurrentNonce(evm.EVM_MODULE_ADDRESS))
erc20FromCoinAddr := crypto.CreateAddress(evm.EVM_MODULE_ADDRESS, s.getCurrentNonce(evm.EVM_MODULE_ADDRESS)+1)

txResp, err = s.network.BroadcastMsgs(s.node.Address, &nonce, &evm.MsgCreateFunToken{
Sender: s.node.Address.String(),
Expand Down
2 changes: 1 addition & 1 deletion x/evm/keeper/call_contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (k Keeper) CallContractWithInput(

err = k.EmitLogEvents(ctx, evmResp)
if err != nil {
return nil, nil, errors.Wrap(err, "error emitting tx logs")
return nil, errors.Wrap(err, "error emitting tx logs")
}

Check warning on line 91 in x/evm/keeper/call_contract.go

View check run for this annotation

Codecov / codecov/patch

x/evm/keeper/call_contract.go#L90-L91

Added lines #L90 - L91 were not covered by tests
}
return evmResp, nil
Expand Down

0 comments on commit 16f47a4

Please sign in to comment.