From 8e7a8d8c970a51706bbb03338115cbf975d7615b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 3 Sep 2020 22:54:19 +0100 Subject: [PATCH 1/3] conformance: tipset-class driver: allow actor msgs, dummy-sign secp msgs. --- conformance/driver.go | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/conformance/driver.go b/conformance/driver.go index b2a902a0cf8..41e1b67978d 100644 --- a/conformance/driver.go +++ b/conformance/driver.go @@ -2,7 +2,8 @@ package conformance import ( "context" - "fmt" + + "github.com/filecoin-project/specs-actors/actors/crypto" "github.com/filecoin-project/lotus/chain/stmgr" "github.com/filecoin-project/lotus/chain/store" @@ -80,11 +81,14 @@ func (d *Driver) ExecuteTipset(bs blockstore.Blockstore, ds ds.Batching, preroot } switch msg.From.Protocol() { case address.SECP256K1: - sb.SecpkMessages = append(sb.SecpkMessages, msg) + sb.SecpkMessages = append(sb.SecpkMessages, toChainMsg(msg)) case address.BLS: - sb.BlsMessages = append(sb.BlsMessages, msg) + sb.BlsMessages = append(sb.BlsMessages, toChainMsg(msg)) default: - return nil, fmt.Errorf("from account is not secpk nor bls: %s", msg.From) + // sneak in messages originating from other addresses as both kinds. + // these should fail, as they are actually invalid senders. + sb.SecpkMessages = append(sb.SecpkMessages, msg) + sb.BlsMessages = append(sb.BlsMessages, msg) } } blocks = append(blocks, sb) @@ -143,7 +147,7 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, preroot cid.Cid, epoch lvm.SetInvoker(invoker) - ret, err := lvm.ApplyMessage(d.ctx, msg) + ret, err := lvm.ApplyMessage(d.ctx, toChainMsg(msg)) if err != nil { return nil, cid.Undef, err } @@ -151,3 +155,22 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, preroot cid.Cid, epoch root, err := lvm.Flush(d.ctx) return ret, root, err } + +// toChainMsg injects a synthetic 0-filled signature of the right length to +// messages that originate from secp256k senders, leaving all +// others untouched. +// TODO: generate a signature in the DSL so that it's encoded in +// the test vector. +func toChainMsg(msg *types.Message) (ret types.ChainMsg) { + ret = msg + if msg.From.Protocol() == address.SECP256K1 { + ret = &types.SignedMessage{ + Message: *msg, + Signature: crypto.Signature{ + Type: crypto.SigTypeSecp256k1, + Data: make([]byte, 65), + }, + } + } + return ret +} From ada5e6ae68cf8c77726a0a7a1bdfaa4ac15f700e Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Wed, 2 Sep 2020 15:57:19 +0100 Subject: [PATCH 2/3] refactor: remove puppet actor from conformance tests The puppet actor has been subsumed into the chaos actor and test-vector tests no longer use it. --- conformance/driver.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/conformance/driver.go b/conformance/driver.go index 41e1b67978d..218198a05b2 100644 --- a/conformance/driver.go +++ b/conformance/driver.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/lotus/lib/blockstore" "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/puppet" "github.com/filecoin-project/test-vectors/chaos" "github.com/filecoin-project/test-vectors/schema" @@ -137,10 +136,7 @@ func (d *Driver) ExecuteMessage(bs blockstore.Blockstore, preroot cid.Cid, epoch invoker := vm.NewInvoker() - // add support for the puppet and chaos actors. - if puppetOn, ok := d.selector["puppet_actor"]; ok && puppetOn == "true" { - invoker.Register(puppet.PuppetActorCodeID, puppet.Actor{}, puppet.State{}) - } + // register the chaos actor if required by the vector. if chaosOn, ok := d.selector["chaos_actor"]; ok && chaosOn == "true" { invoker.Register(chaos.ChaosActorCodeCID, chaos.Actor{}, chaos.State{}) } From c723554d2e34fc126a649e25f2bab340571afd48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Kripalani?= Date: Thu, 3 Sep 2020 23:31:27 +0100 Subject: [PATCH 3/3] upgrade test-vectors deps. --- extern/test-vectors | 2 +- go.mod | 2 +- go.sum | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/extern/test-vectors b/extern/test-vectors index 9806d09b005..84da0a5ea12 160000 --- a/extern/test-vectors +++ b/extern/test-vectors @@ -1 +1 @@ -Subproject commit 9806d09b005dbaa0d08a6944aca67dd5ad2cd3b3 +Subproject commit 84da0a5ea1256a6e66bcbf73542c93e4916d6356 diff --git a/go.mod b/go.mod index 700d591a6af..49e07889709 100644 --- a/go.mod +++ b/go.mod @@ -39,7 +39,7 @@ require ( github.com/filecoin-project/specs-actors v0.9.3 github.com/filecoin-project/specs-storage v0.1.1-0.20200730063404-f7db367e9401 github.com/filecoin-project/statediff v0.0.1 - github.com/filecoin-project/test-vectors v0.0.0-20200902131127-9806d09b005d + github.com/filecoin-project/test-vectors v0.0.0-20200903223506-84da0a5ea125 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 github.com/go-kit/kit v0.10.0 github.com/google/uuid v1.1.1 diff --git a/go.sum b/go.sum index 54d85c99099..038121996e6 100644 --- a/go.sum +++ b/go.sum @@ -268,7 +268,7 @@ 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/lotus v0.4.3-0.20200820203717-d1718369a182/go.mod h1:biFZPQ/YyQGfkHUmHMiaNf2hnD6zm1+OAXPQYQ61Zkg= -github.com/filecoin-project/lotus v0.5.8-0.20200902130912-0962292f920e/go.mod h1:OkZ5aUqs+fFnJOq9243WJDsTa9c3/Ae67NIAwVhAB+0= +github.com/filecoin-project/lotus v0.5.8-0.20200903221953-ada5e6ae68cf/go.mod h1:wxuzS4ozpCFThia18G+J5P0Jp/DSiq9ezzJF1yvZuP4= github.com/filecoin-project/sector-storage v0.0.0-20200712023225-1d67dcfa3c15/go.mod h1:salgVdX7qeXFo/xaiEQE29J4pPkjn71T0kt0n+VDBzo= github.com/filecoin-project/sector-storage v0.0.0-20200730050024-3ee28c3b6d9a/go.mod h1:oOawOl9Yk+qeytLzzIryjI8iRbqo+qzS6EEeElP4PWA= github.com/filecoin-project/sector-storage v0.0.0-20200810171746-eac70842d8e0 h1:E1fZ27fhKK05bhZItfTwqr1i05vXnEZJznQFEYwEEUU=