From a0e7d6a78130a3b339ba91005f7089dde199ac8d Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 30 Jul 2020 14:30:47 +0200 Subject: [PATCH 1/4] Lint in relation to next Signed-off-by: Jakub Sztandera --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7e34184c3..8b304da90 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -320,7 +320,7 @@ workflows: ci: jobs: - lint-changes: - args: "--new-from-rev origin/master" + args: "--new-from-rev origin/next" - mod-tidy-check - gofmt - test: From 7f722623caa95281b22e66f5f09c3d0faf198d16 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 30 Jul 2020 16:23:30 +0200 Subject: [PATCH 2/4] Allow messages with not enough funds for transfer to apply Signed-off-by: Jakub Sztandera --- chain/types/message.go | 5 +---- chain/vm/runtime.go | 5 ++++- chain/vm/vm.go | 6 ++---- go.mod | 2 +- go.sum | 2 ++ 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/chain/types/message.go b/chain/types/message.go index 1956950ad..9dc3dbd26 100644 --- a/chain/types/message.go +++ b/chain/types/message.go @@ -106,10 +106,7 @@ func (m *Message) Cid() cid.Cid { } func (m *Message) RequiredFunds() BigInt { - return BigAdd( - m.Value, - BigMul(m.GasPrice, NewInt(uint64(m.GasLimit))), - ) + return BigMul(m.GasPrice, NewInt(uint64(m.GasLimit))) } func (m *Message) VMMessage() *Message { diff --git a/chain/vm/runtime.go b/chain/vm/runtime.go index b4f6c6b9a..8b5cfaa27 100644 --- a/chain/vm/runtime.go +++ b/chain/vm/runtime.go @@ -5,10 +5,11 @@ import ( "context" "encoding/binary" "fmt" - samarket "github.com/filecoin-project/specs-actors/actors/builtin/market" gruntime "runtime" "time" + samarket "github.com/filecoin-project/specs-actors/actors/builtin/market" + "github.com/filecoin-project/go-address" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" @@ -170,6 +171,8 @@ func (rt *Runtime) shimCall(f func() interface{}) (rval []byte, aerr aerrors.Act aerr = ar return } + //log.Desugar().WithOptions(zap.AddStacktrace(zapcore.ErrorLevel)). + //Sugar().Errorf("spec actors failure: %s", r) log.Errorf("spec actors failure: %s", r) aerr = aerrors.Newf(1, "spec actors failure: %s", r) } diff --git a/chain/vm/vm.go b/chain/vm/vm.go index da33a825e..e1e165b08 100644 --- a/chain/vm/vm.go +++ b/chain/vm/vm.go @@ -371,7 +371,6 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, }, nil } - // TODO: We should remove this, we might punish miners for no fault of their own if msg.Nonce != fromActor.Nonce { return &ApplyRet{ MessageReceipt: types.MessageReceipt{ @@ -386,15 +385,14 @@ func (vm *VM) ApplyMessage(ctx context.Context, cmsg types.ChainMsg) (*ApplyRet, } gascost := types.BigMul(types.NewInt(uint64(msg.GasLimit)), msg.GasPrice) - totalCost := types.BigAdd(gascost, msg.Value) - if fromActor.Balance.LessThan(totalCost) { + if fromActor.Balance.LessThan(gascost) { return &ApplyRet{ MessageReceipt: types.MessageReceipt{ ExitCode: exitcode.SysErrSenderStateInvalid, GasUsed: 0, }, ActorErr: aerrors.Newf(exitcode.SysErrSenderStateInvalid, - "actor balance less than needed: %s < %s", types.FIL(fromActor.Balance), types.FIL(totalCost)), + "actor balance less than needed: %s < %s", types.FIL(fromActor.Balance), types.FIL(gascost)), Penalty: minerPenaltyAmount, Duration: time.Since(start), }, nil diff --git a/go.mod b/go.mod index 30ce41e35..183890ca7 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/drand/drand v1.0.3-0.20200714175734-29705eaf09d4 github.com/drand/kyber v1.1.1 github.com/fatih/color v1.8.0 - github.com/filecoin-project/chain-validation v0.0.6-0.20200728204507-037308fa7af2 + github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8 github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200716204036-cddc56607e1d github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef github.com/filecoin-project/go-bitfield v0.1.1 diff --git a/go.sum b/go.sum index d653c940a..86662d553 100644 --- a/go.sum +++ b/go.sum @@ -218,6 +218,8 @@ github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGj github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E= github.com/filecoin-project/chain-validation v0.0.6-0.20200728204507-037308fa7af2 h1:N2mMgz9JdEMMZfNu+5jTV0KqnqKDDw+rWiAS+K6mbiU= github.com/filecoin-project/chain-validation v0.0.6-0.20200728204507-037308fa7af2/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= +github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8 h1:hIw+kON38iV+bYqgukwnv4vF84Ystp+IpdxpbolDIFM= +github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef h1:Wi5E+P1QfHP8IF27eUiTx5vYfqQZwfPxzq3oFEq8w8U= From 14460d397a03d5f62d7e2b210025144a1a74341b Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 30 Jul 2020 16:25:57 +0200 Subject: [PATCH 3/4] go mod tidy Signed-off-by: Jakub Sztandera --- go.sum | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.sum b/go.sum index 86662d553..9c737312f 100644 --- a/go.sum +++ b/go.sum @@ -216,8 +216,6 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY= github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8= github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E= -github.com/filecoin-project/chain-validation v0.0.6-0.20200728204507-037308fa7af2 h1:N2mMgz9JdEMMZfNu+5jTV0KqnqKDDw+rWiAS+K6mbiU= -github.com/filecoin-project/chain-validation v0.0.6-0.20200728204507-037308fa7af2/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8 h1:hIw+kON38iV+bYqgukwnv4vF84Ystp+IpdxpbolDIFM= github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= From 97009c8f0a8bd9b2c95dcacb702a0a9d27022416 Mon Sep 17 00:00:00 2001 From: Jakub Sztandera Date: Thu, 30 Jul 2020 16:49:17 +0200 Subject: [PATCH 4/4] Update to chain-val master Signed-off-by: Jakub Sztandera --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 183890ca7..6cbf7d487 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/drand/drand v1.0.3-0.20200714175734-29705eaf09d4 github.com/drand/kyber v1.1.1 github.com/fatih/color v1.8.0 - github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8 + github.com/filecoin-project/chain-validation v0.0.6-0.20200730144717-360111e740bd github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200716204036-cddc56607e1d github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef github.com/filecoin-project/go-bitfield v0.1.1 diff --git a/go.sum b/go.sum index 9c737312f..db8289632 100644 --- a/go.sum +++ b/go.sum @@ -216,8 +216,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY= github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8= github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E= -github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8 h1:hIw+kON38iV+bYqgukwnv4vF84Ystp+IpdxpbolDIFM= -github.com/filecoin-project/chain-validation v0.0.6-0.20200730141604-310cd51ea8e8/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= +github.com/filecoin-project/chain-validation v0.0.6-0.20200730144717-360111e740bd h1:XCZ50NipKQGYoyNwmt4QiCqXm72ePHhgzKtxZ5ziTUE= +github.com/filecoin-project/chain-validation v0.0.6-0.20200730144717-360111e740bd/go.mod h1:bcpE1fm7OlH1gak8hfSy7+IM/OaT3GW/XFsbDVp4Dfo= github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0= github.com/filecoin-project/go-address v0.0.2-0.20200504173055-8b6f2fb2b3ef h1:Wi5E+P1QfHP8IF27eUiTx5vYfqQZwfPxzq3oFEq8w8U=