forked from cerc-io/laconicd-deprecated
fix: increase nonce in ante handler for contract creation tx (#809)
Closes: #808 Solution: - move nonce increment to ante handler - revert nonce increment in apply message build(deps): bump github.com/spf13/viper from 1.9.0 to 1.10.0 (#833) Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.9.0 to 1.10.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.9.0...v1.10.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> fix: remove unused code (#834) Co-authored-by: Marko Baricevic <markobaricevic3778@gmail.com> Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> rm rm pkg Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
This commit is contained in:
co-authored by
dependabot[bot]
Marko Baricevic
Federico Kunze Küllmer
parent
514785bd89
commit
e437c4331d
@@ -678,6 +678,8 @@ func (suite *KeeperTestSuite) TestTraceTx() {
|
||||
malleate: func() {
|
||||
txIndex = 1
|
||||
traceConfig = nil
|
||||
// increase nonce to avoid address collision
|
||||
suite.app.EvmKeeper.SetNonce(suite.address, suite.app.EvmKeeper.GetNonce(suite.address)+1)
|
||||
|
||||
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
||||
suite.Commit()
|
||||
@@ -803,6 +805,8 @@ func (suite *KeeperTestSuite) TestTraceBlock() {
|
||||
msg: "tracer with multiple transactions",
|
||||
malleate: func() {
|
||||
traceConfig = nil
|
||||
// increase nonce to avoid address collision
|
||||
suite.app.EvmKeeper.SetNonce(suite.address, suite.app.EvmKeeper.GetNonce(suite.address)+1)
|
||||
contractAddr := suite.DeployTestContract(suite.T(), suite.address, sdk.NewIntWithDecimal(1000, 18).BigInt())
|
||||
suite.Commit()
|
||||
// create multiple transactions in the same block
|
||||
|
||||
@@ -343,7 +343,10 @@ func (k *Keeper) ApplyMessageWithConfig(msg core.Message, tracer vm.Tracer, comm
|
||||
}
|
||||
|
||||
if contractCreation {
|
||||
nonce := k.GetNonce(sender.Address())
|
||||
ret, _, leftoverGas, vmErr = evm.Create(sender, msg.Data(), leftoverGas, msg.Value())
|
||||
// revert nonce increment, because it's increased in ante handler
|
||||
k.SetNonce(sender.Address(), nonce)
|
||||
} else {
|
||||
ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user