From 399c171f0356e2c2515d6f522248acf8d3831ae2 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Wed, 15 Jul 2020 21:21:53 +0200 Subject: [PATCH] Update gas limits, update storage-fsm Signed-off-by: Jakub Sztandera --- build/params_shared_vals.go | 2 +- go.mod | 2 +- go.sum | 6 ++---- markets/storageadapter/client.go | 2 +- markets/storageadapter/provider.go | 4 ++-- miner/miner_test.go | 19 +++++++++---------- node/impl/full/mpool.go | 6 ++++++ 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/build/params_shared_vals.go b/build/params_shared_vals.go index a0633987d..e770f8c69 100644 --- a/build/params_shared_vals.go +++ b/build/params_shared_vals.go @@ -91,7 +91,7 @@ const VerifSigCacheSize = 32000 // TODO: If this is gonna stay, it should move to specs-actors const BlockMessageLimit = 512 -const BlockGasLimit = 100_000_000_000 +const BlockGasLimit = 7_500_000_000 var DrandConfig = dtypes.DrandConfig{ Servers: []string{ diff --git a/go.mod b/go.mod index 288d1079b..8345a047c 100644 --- a/go.mod +++ b/go.mod @@ -32,7 +32,7 @@ require ( github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15 github.com/filecoin-project/specs-actors v0.7.2 github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea - github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080 + github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 github.com/go-kit/kit v0.10.0 github.com/go-ole/go-ole v1.2.4 // indirect diff --git a/go.sum b/go.sum index 35e47e461..8d2bb74f0 100644 --- a/go.sum +++ b/go.sum @@ -258,8 +258,6 @@ github.com/filecoin-project/go-statestore v0.1.0/go.mod h1:LFc9hD+fRxPqiHiaqUEZO github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b h1:fkRZSPrYpk42PV3/lIXiL0LHetxde7vyYYvSsttQtfg= github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b/go.mod h1:Q0GQOBtKf1oE10eSXSlhN45kDBdGvEcVOqMiffqX+N8= github.com/filecoin-project/sector-storage v0.0.0-20200615154852-728a47ab99d6/go.mod h1:M59QnAeA/oV+Z8oHFLoNpGMv0LZ8Rll+vHVXX7GirPM= -github.com/filecoin-project/sector-storage v0.0.0-20200625154333-98ef8e4ef246 h1:NfYQRmVRe0LzlNbK5Ket3vbBOwFD5TvtcNtfo/Sd8mg= -github.com/filecoin-project/sector-storage v0.0.0-20200625154333-98ef8e4ef246/go.mod h1:8f0hWDzzIi1hKs4IVKH9RnDsO4LEHVz8BNat0okDOuY= github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15 h1:miw6hiusb/MkV1ryoqUKKWnvHhPW00AYtyeCj0L8pqo= github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15/go.mod h1:salgVdX7qeXFo/xaiEQE29J4pPkjn71T0kt0n+VDBzo= github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.mod h1:xtDZUB6pe4Pksa/bAJbJ693OilaC5Wbot9jMhLm3cZA= @@ -274,8 +272,8 @@ github.com/filecoin-project/specs-storage v0.1.0 h1:PkDgTOT5W5Ao7752onjDl4QSv+sg github.com/filecoin-project/specs-storage v0.1.0/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k= github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea h1:iixjULRQFPn7Q9KlIqfwLJnlAXO10bbkI+xy5GKGdLY= github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k= -github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080 h1:WZonjI7/GFLi4NxziBCefS9x7bm8S405RWkmFuDfRLA= -github.com/filecoin-project/storage-fsm v0.0.0-20200712045002-6e92d6a6f080/go.mod h1:SXO4VnXG056B/lXHL8HZv54eMqlsyynm+v93BlLwlOY= +github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41 h1:K2DI5+IKuY0cOjX/r1Agy6rYcAhU89LVNOjutCUib4g= +github.com/filecoin-project/storage-fsm v0.0.0-20200715191202-7e92e888bf41/go.mod h1:TDNjb0HYG2fppxWH5EsiNCZu97iJZNuPYmivSK13Ao0= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6 h1:u/UEqS66A5ckRmS4yNpjmVH56sVtS/RfclBAYocb4as= github.com/flynn/noise v0.0.0-20180327030543-2492fe189ae6/go.mod h1:1i71OnUq3iUe1ma7Lr6yG6/rjvM3emb6yoL7xLFzcVQ= diff --git a/markets/storageadapter/client.go b/markets/storageadapter/client.go index 4844ba514..2bb762e28 100644 --- a/markets/storageadapter/client.go +++ b/markets/storageadapter/client.go @@ -138,7 +138,7 @@ func (c *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, From: addr, Value: amount, GasPrice: types.NewInt(0), - GasLimit: 100_000_000, + GasLimit: 200_000_000, Method: builtin.MethodsMarket.AddBalance, }) if err != nil { diff --git a/markets/storageadapter/provider.go b/markets/storageadapter/provider.go index b5ed247f4..9e1a101cc 100644 --- a/markets/storageadapter/provider.go +++ b/markets/storageadapter/provider.go @@ -78,7 +78,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark From: mi.Worker, Value: types.NewInt(0), GasPrice: types.NewInt(0), - GasLimit: 100_000_000, + GasLimit: 600_000_000, Method: builtin.MethodsMarket.PublishStorageDeals, Params: params, }) @@ -175,7 +175,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address From: addr, Value: amount, GasPrice: types.NewInt(0), - GasLimit: 100_000_000, + GasLimit: 200_000_000, Method: builtin.MethodsMarket.AddBalance, }) if err != nil { diff --git a/miner/miner_test.go b/miner/miner_test.go index 7ae07644e..b600ff136 100644 --- a/miner/miner_test.go +++ b/miner/miner_test.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/lotus/chain/types" + "github.com/stretchr/testify/assert" ) func mustIDAddr(i uint64) address.Address { @@ -26,11 +27,11 @@ func TestMessageFiltering(t *testing.T) { actors := map[address.Address]*types.Actor{ a1: { Nonce: 3, - Balance: types.NewInt(1200), + Balance: types.FromFil(1200), }, a2: { Nonce: 1, - Balance: types.NewInt(1000), + Balance: types.FromFil(1000), }, } @@ -43,7 +44,7 @@ func TestMessageFiltering(t *testing.T) { From: a1, To: a1, Nonce: 3, - Value: types.NewInt(500), + Value: types.FromFil(500), GasLimit: 100_000_000, GasPrice: types.NewInt(1), }, @@ -51,7 +52,7 @@ func TestMessageFiltering(t *testing.T) { From: a1, To: a1, Nonce: 4, - Value: types.NewInt(500), + Value: types.FromFil(500), GasLimit: 100_000_000, GasPrice: types.NewInt(1), }, @@ -59,7 +60,7 @@ func TestMessageFiltering(t *testing.T) { From: a2, To: a1, Nonce: 1, - Value: types.NewInt(800), + Value: types.FromFil(800), GasLimit: 100_000_000, GasPrice: types.NewInt(1), }, @@ -67,7 +68,7 @@ func TestMessageFiltering(t *testing.T) { From: a2, To: a1, Nonce: 0, - Value: types.NewInt(800), + Value: types.FromFil(800), GasLimit: 100_000_000, GasPrice: types.NewInt(1), }, @@ -75,7 +76,7 @@ func TestMessageFiltering(t *testing.T) { From: a2, To: a1, Nonce: 2, - Value: types.NewInt(150), + Value: types.FromFil(150), GasLimit: 100, GasPrice: types.NewInt(1), }, @@ -86,9 +87,7 @@ func TestMessageFiltering(t *testing.T) { t.Fatal(err) } - if len(outmsgs) != 3 { - t.Fatal("filtering didnt work as expected") - } + assert.Len(t, outmsgs, 3, "filtering didnt work as expected") was, expected := outmsgs[0].Message, msgs[2] if was.From != expected.From || was.Nonce != expected.Nonce { diff --git a/node/impl/full/mpool.go b/node/impl/full/mpool.go index 79e6d30be..d5b77b0bb 100644 --- a/node/impl/full/mpool.go +++ b/node/impl/full/mpool.go @@ -90,6 +90,12 @@ func (a *MpoolAPI) MpoolPushMessage(ctx context.Context, msg *types.Message) (*t if msg.Nonce != 0 { return nil, xerrors.Errorf("MpoolPushMessage expects message nonce to be 0, was %d", msg.Nonce) } + if msg.GasLimit == 0 { + msg.GasLimit = 100_000_000 // TODO: gas limit estimation + } + if types.BigCmp(msg.GasPrice, types.NewInt(0)) == 0 { + msg.GasPrice = types.NewInt(1) // TODO: gas price estimation + } return a.Mpool.PushWithNonce(ctx, msg.From, func(from address.Address, nonce uint64) (*types.SignedMessage, error) { msg.Nonce = nonce