From 6af5ac0321242584bb839f8e989dcdf204081161 Mon Sep 17 00:00:00 2001 From: samuerio <853713419@qq.com> Date: Fri, 13 Jan 2023 14:38:46 +0800 Subject: [PATCH 1/2] extended to support test vectors from ethereum --- schema.json | 47 +++++++++++++++++++++++++++++++++++++++++++++++ schema/schema.go | 14 ++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/schema.json b/schema.json index 0ec349aa..64217050 100644 --- a/schema.json +++ b/schema.json @@ -332,6 +332,25 @@ } } } + }, + "tipset_cids": { + "type": "array", + "items": { + "type": "object", + "additionalProperties": false, + "required": [ + "epoch", + "cid" + ], + "properties": { + "epoch": { + "type": "integer" + }, + "cid": { + "$ref": "#/definitions/cid" + } + } + } } }, "required": [ @@ -386,6 +405,10 @@ "description": "the gzipped, base64 CAR containing the pre- and post-condition state trees for this test vector", "$ref": "#/definitions/base64" }, + "chain_id": { + "title": "the chain id of the network", + "type": "number" + }, "randomness": { "title": "randomness to be replayed during the execution of the test vector", "$ref": "#/definitions/randomness" @@ -395,6 +418,30 @@ }, "postconditions": { "$ref": "#/definitions/postconditions" + }, + "skip_compare_gas_used": { + "type": "boolean" + }, + "skip_compare_addresses": { + "type": "array", + "items": { + "type": "string" + } + }, + "skip_compare_actor_ids": { + "type": "array", + "items": { + "type": "number" + } + }, + "additional_compare_addresses": { + "type": "array", + "items": { + "type": "string" + } + }, + "tipset_cids": { + "$ref": "#/definitions/tipset_cids" } }, "allOf": [ diff --git a/schema/schema.go b/schema/schema.go index 7d1b15ec..2f3e1a66 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -169,6 +169,11 @@ type Diagnostics struct { Data Base64EncodedBytes `json:"data"` } +type TipsetCid struct { + Epoch int64 `json:"epoch"` + Cid cid.Cid `json:"cid"` +} + // TestVector is a single, faceted test case. The test case can be run against // the multiple facets expressed in the preconditions field. type TestVector struct { @@ -186,6 +191,8 @@ type TestVector struct { Meta *Metadata `json:"_meta"` + ChainId uint64 `json:"chain_id"` + // CAR binary data to be loaded into the test environment, usually a CAR // containing multiple state trees, addressed by root CID from the relevant // objects. @@ -202,6 +209,13 @@ type TestVector struct { Post *Postconditions `json:"postconditions"` Diagnostics *Diagnostics `json:"diagnostics,omitempty"` + + SkipCompareGasUsed bool `json:"skip_compare_gas_used"` + SkipCompareAddresses []address.Address `json:"skip_compare_addresses,omitempty"` + SkipCompareActorIds []uint64 `json:"skip_compare_actor_ids,omitempty"` + AdditionalCompareAddresses []address.Address `json:"additional_compare_addresses,omitempty"` + + TipsetCids []TipsetCid `json:"tipset_cids,omitempty"` } type Message struct { From 34c1700cf6c8a001075dc57fa5c2b63cdc37a805 Mon Sep 17 00:00:00 2001 From: samuerio <853713419@qq.com> Date: Sun, 15 Jan 2023 21:00:40 +0800 Subject: [PATCH 2/2] update TestVector struct, add debug field --- schema.json | 4 ++++ schema/schema.go | 1 + 2 files changed, 5 insertions(+) diff --git a/schema.json b/schema.json index 64217050..1fdc1458 100644 --- a/schema.json +++ b/schema.json @@ -50,6 +50,10 @@ "items": { "type": "string" } + }, + "_debug":{ + "title": "any kind of debug information", + "type": "string" } } }, diff --git a/schema/schema.go b/schema/schema.go index 2f3e1a66..9fa47ec1 100644 --- a/schema/schema.go +++ b/schema/schema.go @@ -66,6 +66,7 @@ type Metadata struct { Comment string `json:"comment,omitempty"` Gen []GenerationData `json:"gen"` Tags []string `json:"tags,omitempty"` + Debug string `json:"_debug,omitempty"` } // GenerationData tags the source of this test case.