From 9b2722d7538bedb56bad6ea682a8cc2c8267c680 Mon Sep 17 00:00:00 2001 From: egonspace Date: Thu, 7 Oct 2021 11:08:28 +0900 Subject: [PATCH 1/3] chore: increate default valid_sig_block_period --- x/auth/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/auth/types/params.go b/x/auth/types/params.go index e188f3487d..2946e91773 100644 --- a/x/auth/types/params.go +++ b/x/auth/types/params.go @@ -15,7 +15,7 @@ const ( DefaultTxSizeCostPerByte uint64 = 10 DefaultSigVerifyCostED25519 uint64 = 590 DefaultSigVerifyCostSecp256k1 uint64 = 1000 - DefaultValidSigBlockPeriod uint64 = 100 + DefaultValidSigBlockPeriod uint64 = 10000 ) // Parameter keys From ece76e080c63f1c69a812ce9f3aa53a2cf0c0ba3 Mon Sep 17 00:00:00 2001 From: egonspace Date: Thu, 7 Oct 2021 15:33:36 +0900 Subject: [PATCH 2/3] fix: fix test failure --- x/auth/ante/ante_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index cb189bc675..c90e285675 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -160,7 +160,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { suite.SetupTest(false) // reset - suite.ctx = suite.ctx.WithBlockHeight(200) // init block height is 200 + suite.ctx = suite.ctx.WithBlockHeight(20000) // init block height is 200 // Same data for every test cases accounts := suite.CreateTestAccounts(2) @@ -182,7 +182,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { msg := testdata.NewTestMsg(accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{100}, []uint64{0} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{10000}, []uint64{0} }, false, true, @@ -200,7 +200,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { { "new tx from correct sig block height", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{100}, []uint64{1} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{10000}, []uint64{1} }, false, true, @@ -221,7 +221,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { { "new tx with correct sig block height", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{100, 101}, []uint64{2, 0} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{10000, 10001}, []uint64{2, 0} }, false, true, From af42800f2a8921b878ed6c0d0228b07010aa5b9d Mon Sep 17 00:00:00 2001 From: egonspace Date: Thu, 14 Oct 2021 15:52:20 +0900 Subject: [PATCH 3/3] fix: apply comment --- x/auth/ante/ante_test.go | 8 ++++---- x/auth/types/params.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/x/auth/ante/ante_test.go b/x/auth/ante/ante_test.go index c90e285675..e1996ea624 100644 --- a/x/auth/ante/ante_test.go +++ b/x/auth/ante/ante_test.go @@ -160,7 +160,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigErrors() { func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { suite.SetupTest(false) // reset - suite.ctx = suite.ctx.WithBlockHeight(20000) // init block height is 200 + suite.ctx = suite.ctx.WithBlockHeight(5000) // init block height is 5000 // Same data for every test cases accounts := suite.CreateTestAccounts(2) @@ -182,7 +182,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { msg := testdata.NewTestMsg(accounts[0].acc.GetAddress()) msgs = []sdk.Msg{msg} - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{10000}, []uint64{0} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{3600}, []uint64{0} }, false, true, @@ -200,7 +200,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { { "new tx from correct sig block height", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{10000}, []uint64{1} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv}, []uint64{3600}, []uint64{1} }, false, true, @@ -221,7 +221,7 @@ func (suite *AnteTestSuite) TestAnteHandlerSigBlockHeight() { { "new tx with correct sig block height", func() { - privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{10000, 10001}, []uint64{2, 0} + privs, sbh, accSeqs = []cryptotypes.PrivKey{accounts[0].priv, accounts[1].priv}, []uint64{3600, 3601}, []uint64{2, 0} }, false, true, diff --git a/x/auth/types/params.go b/x/auth/types/params.go index 2946e91773..271189854b 100644 --- a/x/auth/types/params.go +++ b/x/auth/types/params.go @@ -15,7 +15,7 @@ const ( DefaultTxSizeCostPerByte uint64 = 10 DefaultSigVerifyCostED25519 uint64 = 590 DefaultSigVerifyCostSecp256k1 uint64 = 1000 - DefaultValidSigBlockPeriod uint64 = 10000 + DefaultValidSigBlockPeriod uint64 = 3600 // 1 hour for 1 second block interval ) // Parameter keys