Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

actors v7 and venus v2 #4658

Merged
merged 168 commits into from
Feb 25, 2022
Merged
Changes from 1 commit
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
313eea9
feat: add modules: venus-shared & venus-devtool
dtynn Nov 13, 2021
3e1c2b3
add simple test for blockHeader serializing & caching, fix test for b…
dtynn Nov 13, 2021
00e3100
feat: add doc: refactor notes for venus-v2
dtynn Nov 13, 2021
6288986
fix: newline in check item
dtynn Nov 13, 2021
554701d
refactor: remove cachedXXXX fields inside chain.BlockHeader, re-organize
dtynn Nov 15, 2021
deff16e
feat: add more types
dtynn Nov 16, 2021
b3ab9a4
feat: more types in venus-shared/chain
dtynn Nov 16, 2021
a84fb25
feat: add coverage stat for tests
dtynn Nov 16, 2021
4d4d89f
feat: impl value provider for testing
dtynn Nov 16, 2021
23573bc
feat: check for convertible provider, use int for all number types
dtynn Nov 16, 2021
27aa7e8
feat: test for invalid provider registration
dtynn Nov 16, 2021
4d94624
feat: show cbor-gened types in lotus
dtynn Nov 17, 2021
4be7f6f
feat: add value providers for chain-related types
dtynn Nov 17, 2021
7fa5590
chore: basic test util for cbor types
dtynn Nov 17, 2021
c37fa90
feat: move cborErBasic into testutil
dtynn Nov 18, 2021
f5a18c5
feat: add providers for +/- big.Ints
dtynn Nov 18, 2021
45c6a9d
feat: complete tests for BigInt
dtynn Nov 18, 2021
581e196
feat: add more tests for FIL
dtynn Nov 18, 2021
a262ec5
feat: add more tests for unit string
dtynn Nov 18, 2021
7a09cf2
feat: basic test for Ticket
dtynn Nov 18, 2021
c2961a4
feat: more basic tests for cbor.Er types
dtynn Nov 18, 2021
6ec2a3d
refactor: use require to replace assert
dtynn Nov 18, 2021
d70e822
feat: add more tests for TipSet / ElectionProof / Ticket
dtynn Nov 18, 2021
03703e5
feat: add tests for PaddedPieceSize / UnpaddedPieceSize
dtynn Nov 18, 2021
9af4007
feat: add tests for hello types
dtynn Nov 18, 2021
9043f28
fetch templates
dtynn Nov 19, 2021
0595271
feat: complete venus-shared/actors
dtynn Nov 19, 2021
3863ed7
feat: add FullBlock, FullTipSet in chain, add types in libp2p/exchange
dtynn Nov 19, 2021
9ca6c1f
feat: remove variables for implementations in libp2p/exchange
dtynn Nov 22, 2021
ef94da2
feat: add interfaces for libp2p components
dtynn Nov 22, 2021
6e9c2bc
init venus-component module
dtynn Nov 22, 2021
c5a3b65
duplicate pkg/chainsync/exchange into venus-componet/libp2p
dtynn Nov 22, 2021
4b2b6bb
restore pkg/chainsync/exchange
dtynn Nov 22, 2021
1ea167e
fix: stuffs required by venus-component/libp2p/exchange
dtynn Nov 22, 2021
11f364e
feat: duplicate chainsync/exchange, make it depend on venus-shared
dtynn Nov 22, 2021
fe56f5d
feat: add type Options for exchange protocol
dtynn Nov 23, 2021
c3736aa
feat: logger with context
dtynn Nov 23, 2021
e1f8a89
use *TaggedLogger
dtynn Nov 23, 2021
aaf8a13
add FilPeerEventType
dtynn Nov 23, 2021
1304989
impl: exchange Server
dtynn Nov 23, 2021
76a8f7a
impl: exchange Client
dtynn Nov 23, 2021
135acb5
move client side codes into separated pkg
dtynn Nov 23, 2021
1f26f90
feat: update exchange.Client.GetFullTipSet
dtynn Nov 23, 2021
5eb598c
feat: impl exchange.Client
dtynn Nov 23, 2021
1e7bdbd
impl & test Message.ValidForBlockInclusion
dtynn Nov 26, 2021
5afbb00
more types in venus-shared
dtynn Nov 29, 2021
52232e2
impl: typechecker
dtynn Nov 30, 2021
6b7bcdf
impl: typecheck.Similar & tests
dtynn Nov 30, 2021
4ab31d1
mv typecheck into venus-shared
dtynn Dec 1, 2021
d12882b
rename package
dtynn Dec 1, 2021
2cb097a
impl: similar-check reason info
dtynn Dec 1, 2021
accd85e
duplicate v0 apis
dtynn Dec 1, 2021
92cf2a6
checkout app/client/apiface
dtynn Dec 1, 2021
997c990
pick fullnode decl
dtynn Dec 1, 2021
61bccc2
feat: checksum for api.FullNode
dtynn Dec 1, 2021
a0d19c6
go mod tidy
dtynn Dec 1, 2021
cceb86b
add method group: chain for v0api of chain service
dtynn Dec 2, 2021
fbc8fb4
add subcmd: checksum for apis
dtynn Dec 2, 2021
1dc2054
add subcmd: diff for apis
dtynn Dec 2, 2021
d80aad2
mv v0 to v1
dtynn Dec 2, 2021
88d7860
introduce api/chain/v1
dtynn Dec 2, 2021
232ffb0
feat: api diff
dtynn Dec 2, 2021
4888084
add struct field check for Similar
dtynn Dec 3, 2021
ff822d8
add struct tag check for api-diff
dtynn Dec 3, 2021
1b57c32
fix: api diffs caused by chain.BlockHeader
dtynn Dec 3, 2021
bde43be
fix: api diffs caused by json.Marshaler impl of Message & SignedMessage
dtynn Dec 3, 2021
9158704
fix: api diffs caused by MessageReceipt.ReturnValue
dtynn Dec 3, 2021
71225ba
fix: add returned error for ChainNotify
dtynn Dec 3, 2021
d21d341
fix: api diffs caused by BlockTemplate
dtynn Dec 3, 2021
80eedbd
fix: api diffs caused by PaymentInfo cbor codec impl
dtynn Dec 3, 2021
d5241fa
show codec string in Similar reason
dtynn Dec 3, 2021
9a6e3dd
impl Similar: convertible, interface all methods, recursive
dtynn Dec 3, 2021
af98f3c
Feat/fix api permission (#4626)
simlecode Dec 20, 2021
0b80cc6
Feat/replica actos file (#4628)
simlecode Dec 20, 2021
1d419d5
Feat/replace actors (#4632)
simlecode Dec 21, 2021
7bea6cc
complex providers (#4634)
zl03jsj Dec 21, 2021
b92f36b
Feat/replace common type (#4636)
simlecode Dec 22, 2021
41532c3
venus-devtool add tools for venus-shared api generation, (#4638)
zl03jsj Dec 23, 2021
7a91e50
add v7 actor files (#4637)
simlecode Dec 23, 2021
de6377c
use the shared API (#4639)
simlecode Dec 24, 2021
d8f7ba0
tool for auto generate api document. (#4640)
zl03jsj Dec 24, 2021
b848969
provide esitimate-message type for doc generation (#4641)
zl03jsj Dec 24, 2021
c27b5c6
api mocks (#4654)
zl03jsj Dec 28, 2021
659b93b
Feat/simple api perm comment (#4655)
simlecode Dec 29, 2021
d4a911e
specactors: pull in lotus upgrade
ta0li Dec 6, 2021
178a210
specactors: Add code not generated by the template
ta0li Dec 7, 2021
d9470b2
upgrade vm @ network params for actor v7
ta0li Dec 7, 2021
cc0202f
specactors: Add code not generated by the template (#4657)
simlecode Dec 29, 2021
54e2bc1
shared remove go.mod (#4659)
simlecode Dec 30, 2021
5c93bea
VM: Circ supply should be constant per epoch (#4656)
simlecode Dec 31, 2021
2e07619
inline coed gen (#4663)
simlecode Dec 31, 2021
bf80697
fix method map (#4666)
simlecode Jan 4, 2022
d6da2ff
Feat/venus v2 snapdeal (#4664)
diwufeiwen Jan 4, 2022
513a533
fix func def for dsbackend
ta0li Jan 4, 2022
0b687b0
Unify the definition of MessageReceipt (#4667)
diwufeiwen Jan 4, 2022
88c096a
fix ci for select msg test (#4669)
diwufeiwen Jan 4, 2022
e54464d
disable mplex stream muxer (#4668)
simlecode Jan 4, 2022
22a9f7a
fix test (#4670)
simlecode Jan 5, 2022
740e3c1
close dht (#4672)
simlecode Jan 5, 2022
570b12f
refactor: (#4673)
zl03jsj Jan 5, 2022
c89f464
merge type pkg (#4674)
simlecode Jan 6, 2022
c2bed02
Feat/simplify storage interface (#4676)
simlecode Jan 6, 2022
878026a
chain notify return error (#4677)
simlecode Jan 6, 2022
e7d0e4b
fix un-consunsus api StateMinerPreCommitDepositForPower (#4678)
zl03jsj Jan 6, 2022
5499a39
fix (#4679)
zl03jsj Jan 7, 2022
60cf0d7
Feat/generate v0 api doc (#4685)
simlecode Jan 7, 2022
08d633e
circsuypply calc around null blocks (#4687)
simlecode Jan 7, 2022
70c69a2
remove the NtwkVersionGetter (#4690)
simlecode Jan 10, 2022
72ee5c6
more inline template (#4691)
simlecode Jan 10, 2022
97bf1fb
test vector runner fixes for v6 vectors (#4692)
simlecode Jan 11, 2022
eba7c82
add gas charge for VerifyReplicaUpdate (#4693)
simlecode Jan 11, 2022
2a45036
mod: update go-paramfetch (#4694)
simlecode Jan 11, 2022
09a81f6
add temp snap params (#4697)
simlecode Jan 12, 2022
049c87c
support snap deals (#4696)
diwufeiwen Jan 12, 2022
35256b9
fix sender and receiver are the same (#4703)
simlecode Jan 12, 2022
ea6b683
Integrate proof v11.0.0 (#4705)
simlecode Jan 13, 2022
b7ada76
support snapnet (#4702)
hunjixin Jan 13, 2022
7e5c468
Feat/migration autobatch (#4704)
hunjixin Jan 13, 2022
41c5da8
opt version cmd (#4707)
simlecode Jan 13, 2022
02a96fa
bump version to v1.2.0-rc1 (#4708)
simlecode Jan 13, 2022
ec8c224
use expresion pattern maching version
zl03jsj Jan 13, 2022
a0df25b
fix api client
simlecode Jan 13, 2022
5985b82
fix search msg
hunjixin Jan 13, 2022
dbb2f0b
update api version
simlecode Jan 13, 2022
f1ef793
bump version to v1.2.0-rc2
simlecode Jan 13, 2022
a12ac0b
vm: fix network version not correct (#4712)
simlecode Jan 18, 2022
96f29da
bump version to v1.2.0-rc3 (#4713)
simlecode Jan 18, 2022
a886f66
No need to compare from address and to address (#4716)
simlecode Jan 19, 2022
41f4ea7
Feat/dtynn/compatible check for api perms (#4730)
dtynn Jan 19, 2022
28b90df
add ci checks for type comtatilble, api/mock api generation, (#4731)
zl03jsj Jan 19, 2022
6aa06db
bump version to v1.2.0-rc4 (#4733)
simlecode Jan 20, 2022
8f0a0cf
Remove unused code (#4732)
simlecode Jan 20, 2022
347645a
Feat/dtynn/refactor parts of the api compatible checks (#4734)
dtynn Jan 20, 2022
cd70951
refactor: devtool: refactor api-gen & re-generate related codes (#4737)
dtynn Jan 22, 2022
371fc68
feat: venus-shared: pick types & api def from venus-messager (#4738)
dtynn Jan 24, 2022
3914774
feat: venus-shared: pick types & api def from venus-wallet (#4746)
simlecode Jan 25, 2022
002ee9b
feat: generate client constructor for apis in venus-shared (#4747)
dtynn Jan 26, 2022
6c31bf2
upgrade ffi (#4748)
simlecode Jan 26, 2022
644a6ac
fix wallet unlock failed (#4736)
simlecode Jan 28, 2022
4bc1e23
build: release: v1.2.0-rc5 (#4751)
simlecode Feb 8, 2022
a8d98c0
refactor: generate document for api (#4749)
simlecode Feb 9, 2022
a52156c
remove unrelated parmas (#4753)
simlecode Feb 9, 2022
e7b0678
fix json marshal/unmarshal for FIL type
hunjixin Jan 7, 2022
71c52bb
fix: venus-shared: Change the type of HeadChange.Type (#4755)
simlecode Feb 10, 2022
3417842
feat: venus-shared: Expose RPC client options (#4756)
simlecode Feb 11, 2022
94e15a3
migrate v7 version config (#4761)
simlecode Feb 11, 2022
7ba45e0
chore: dep: update ffi & go.mod (#4762)
simlecode Feb 11, 2022
9b3b33a
pick venus-gateway def & api (#4769)
diwufeiwen Feb 15, 2022
2bc87f4
feat: extend api & types from venus-gateway (#4770)
dtynn Feb 16, 2022
a05e936
feat: venus-shared: introduce apis & types from venus-market (#4776)
dtynn Feb 17, 2022
ebc5d82
feat: remove previous api def for gateway: with proof event related m…
dtynn Feb 17, 2022
631849c
type: venus-shared: add pad byte index (#4777)
simlecode Feb 17, 2022
a1df3e5
add v0 api for gateway (#4780)
simlecode Feb 17, 2022
500180b
feat: venus-shared: api version / namespaces & helper func for rpc en…
dtynn Feb 18, 2022
a3ca359
feat: config: migrate maxfee (#4783)
simlecode Feb 18, 2022
4f3a939
Feat/remove replace for ipfscmds (#4773)
hunjixin Feb 18, 2022
1515aa6
fix security dependency (#4784)
hunjixin Feb 18, 2022
81ff96a
build v1.2.0-rc6 (#4785)
simlecode Feb 18, 2022
50e20c4
fix: use DealProposal inside specs-actors (#4786)
dtynn Feb 18, 2022
8c1341e
fix comment (#4787)
simlecode Feb 21, 2022
ef8733a
split-gateway-interfaces-by-role (#4788)
zl03jsj Feb 21, 2022
67490ed
Merge branch 'master' of github.com:filecoin-project/venus into feat/…
simlecode Feb 21, 2022
d4d3865
remove unused api version info (#4795)
simlecode Feb 21, 2022
bd9851d
update version to v1.2.0 (#4796)
simlecode Feb 21, 2022
cd35470
update git workflow (#4799)
simlecode Feb 23, 2022
c798350
sync: fix inconsistent circ supply at the same epoch (#4802)
simlecode Feb 24, 2022
c69627b
bump version to v1.2.1 (#4803)
simlecode Feb 24, 2022
ed9c00d
Feat/dtynn/introduce dial args (#4804)
dtynn Feb 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add simple test for blockHeader serializing & caching, fix test for b…
…igint
  • Loading branch information
dtynn authored and ta0li committed Jan 4, 2022
commit 3e1c2b31fa241c93d619aafed95be149ffebcd4d
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
cborgen:
cd venus-devtool && go run ./cborgen/*.go

test-venus-shared:
cd venus-shared && go test -v ./...

test: test-venus-shared
5 changes: 2 additions & 3 deletions venus-devtool/go.sum
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw=
github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk=
github.com/filecoin-project/go-address v0.0.3 h1:eVfbdjEbpbzIrbiSa+PiGUY+oDK9HnUn+M1R/ggoHf8=
github.com/filecoin-project/go-address v0.0.3/go.mod h1:jr8JxKsYx+lQlQZmF5i2U0Z+cGQ59wMIps/8YW/lDj8=
@@ -111,8 +110,9 @@ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0=
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
@@ -122,7 +122,6 @@ github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W
github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200806213330-63aa96ca5488/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200810223238-211df3b9e24c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c h1:otRnI08JoahNBxUFqX3372Ab9GnTj8L5J9iP5ImyxGU=
github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/cbor-gen v0.0.0-20211110122933-f57984553008 h1:7WtW9D9VGpmRLuQmrPy2JobUNdka95z3MKEVpELtOjo=
github.com/whyrusleeping/cbor-gen v0.0.0-20211110122933-f57984553008/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
8 changes: 0 additions & 8 deletions venus-shared/bigint/bigint_test.go
Original file line number Diff line number Diff line change
@@ -2,15 +2,7 @@ package bigint

import (
"bytes"
"math/big"
"math/rand"
"strings"
"testing"
"time"

"github.com/docker/go-units"

"github.com/stretchr/testify/assert"
)

func TestBigIntSerializationRoundTrip(t *testing.T) {
2 changes: 2 additions & 0 deletions venus-shared/chain/block_header.go
Original file line number Diff line number Diff line change
@@ -150,6 +150,8 @@ func (b *BlockHeader) Equals(other *BlockHeader) bool {
func (b *BlockHeader) SignatureData() []byte {
tmp := *b
tmp.BlockSig = nil
tmp.cachedBytes = nil
tmp.cachedCid = cid.Undef
return tmp.ToNode().RawData()
}

48 changes: 48 additions & 0 deletions venus-shared/chain/block_header_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package chain

import (
"encoding/hex"
"testing"

"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/stretchr/testify/assert"
)

func TestBlockHeaderMarshal(t *testing.T) {
const mdata = "f021344"
const cdata = "bafy2bzaced35aqx5wnwp4ohegreumsheigitrhcqlr3lmz4phyzwikmi44sww"
const bdata = "904400e0a601815860b48541b503b47535334553bf0d1fc702d395133e28b48bbae7550e955025ee09f642cb82c79de036099c657b7efb78e10b685aa99d817f6e560805787c5df894ac6758b0d68c72fb498113a5e763ef65d5bff576cd7fc3a847684a410b89c63c82025860a233b638f28312f9014728cf42e2c353bbf2031506488fa3192d137881e8b9666a2d131218e96b51b701f826940ef6630ae13b20c7bf115155e349c88363949fd7704f8026c3c3b1f872d9085e912856d2b56b8ce8a6fb8cf4e996aaa8476e2c81821a001506545860a699f4d93c54d66d46a46cab8da059fbf7ef82e40dd19a67fc1c5a402422304e7b8eec5c2dc6107e0cf1be676f12ce9b05675160e1c66f0ae5ebcf056e303ca39aa813acd5403844604b51f1e3dd5fcd271978346b85cdfa6d75cb46e2c6609581820358c09095232420f9caff389c0709ace12897ad0b5734b104011849e0f008febf39d8c64079236d3e75c24c08a613bcd946538a4b966b3c5a79cf61832c673f2ec90d22d02c16e28073c20995f5259567736d6e6f2fee588c7c23ca1946d753a783fe14404c3f4684a0a7cf5ceadc8a7a2cd9ad0387b96608eca6d3604ed7beb948f7fa2e235f1d611114f66752c6c36ac9aeb17c2f36d70accbd7554678034381486a1a95ea36db4dc549ee152a00c1b454da4f47b33327609be8b055f14681a2edf84d82a5827000171a0e4022084da38b952ab5644c5418c3305b3c22b5eca92eab9e23cdb675163773a964c53d82a5827000171a0e402201ef87dc542d008d961a30a36935a06d28ef05e4ed5e22f7779c4f3f8002c451dd82a5827000171a0e4022079bfefc62c740cda4b0463ceba68e9613c5c47ef7bbed968b179763ae7978bf4d82a5827000171a0e402202f9becc403d7228035f153d9cba42db472ed3c1cb3f22c7ae02eaaabca53e80f460001d7dbb8171a00067680d82a5827000171a0e402204f2120d6581f3d69a5d62e25dd993d1825ce6a446ffa801a4092e7e3a28d4b73d82a5827000171a0e402204bc482ae9a6a1afd1a252264a4bcae9fb2150faf9910b80703e9fbb91ab041e3d82a5827000171a0e4022017d2c80f5b157b61e96ea4ef3888762fa81a9a853bffa624f4bfb9c388859a88586102b3f7f6dc71591af0a61bbcad978178fc123a6edbec959716c028ec976b997df83af557a5ad1d05544d5ce82e5461c562196ea998b437bf0ceb7965871bd6d9e16a2df9cfaaf50b627f5a406d344f1ae0d8e0eaa5835f9c092fe24681cbc7761d1a618f1680586102920f0a831f86073b12641e6c880ddc2823a9c7b1b14b56f7995eaafc35df9c8f3066cd3ab9693c53b388e4c46d7680b50dcd242471d763a5114274c475eeb7d6561e35f51db3b6ac46c4fb8f4218ddc6d6fae3c1cd09fa70c21e6e87bd94e33100420064"
const sdata = "904400e0a601815860b48541b503b47535334553bf0d1fc702d395133e28b48bbae7550e955025ee09f642cb82c79de036099c657b7efb78e10b685aa99d817f6e560805787c5df894ac6758b0d68c72fb498113a5e763ef65d5bff576cd7fc3a847684a410b89c63c82025860a233b638f28312f9014728cf42e2c353bbf2031506488fa3192d137881e8b9666a2d131218e96b51b701f826940ef6630ae13b20c7bf115155e349c88363949fd7704f8026c3c3b1f872d9085e912856d2b56b8ce8a6fb8cf4e996aaa8476e2c81821a001506545860a699f4d93c54d66d46a46cab8da059fbf7ef82e40dd19a67fc1c5a402422304e7b8eec5c2dc6107e0cf1be676f12ce9b05675160e1c66f0ae5ebcf056e303ca39aa813acd5403844604b51f1e3dd5fcd271978346b85cdfa6d75cb46e2c6609581820358c09095232420f9caff389c0709ace12897ad0b5734b104011849e0f008febf39d8c64079236d3e75c24c08a613bcd946538a4b966b3c5a79cf61832c673f2ec90d22d02c16e28073c20995f5259567736d6e6f2fee588c7c23ca1946d753a783fe14404c3f4684a0a7cf5ceadc8a7a2cd9ad0387b96608eca6d3604ed7beb948f7fa2e235f1d611114f66752c6c36ac9aeb17c2f36d70accbd7554678034381486a1a95ea36db4dc549ee152a00c1b454da4f47b33327609be8b055f14681a2edf84d82a5827000171a0e4022084da38b952ab5644c5418c3305b3c22b5eca92eab9e23cdb675163773a964c53d82a5827000171a0e402201ef87dc542d008d961a30a36935a06d28ef05e4ed5e22f7779c4f3f8002c451dd82a5827000171a0e4022079bfefc62c740cda4b0463ceba68e9613c5c47ef7bbed968b179763ae7978bf4d82a5827000171a0e402202f9becc403d7228035f153d9cba42db472ed3c1cb3f22c7ae02eaaabca53e80f460001d7dbb8171a00067680d82a5827000171a0e402204f2120d6581f3d69a5d62e25dd993d1825ce6a446ffa801a4092e7e3a28d4b73d82a5827000171a0e402204bc482ae9a6a1afd1a252264a4bcae9fb2150faf9910b80703e9fbb91ab041e3d82a5827000171a0e4022017d2c80f5b157b61e96ea4ef3888762fa81a9a853bffa624f4bfb9c388859a88586102b3f7f6dc71591af0a61bbcad978178fc123a6edbec959716c028ec976b997df83af557a5ad1d05544d5ce82e5461c562196ea998b437bf0ceb7965871bd6d9e16a2df9cfaaf50b627f5a406d344f1ae0d8e0eaa5835f9c092fe24681cbc7761d1a618f1680f600420064"

maddr, err := address.NewFromString(mdata)
assert.NoErrorf(t, err, "parse miner address %s", mdata)

c, err := cid.Decode(cdata)
assert.NoErrorf(t, err, "decode cid %s", cdata)

assert.NotEqual(t, bdata, sdata, "check raw sign bytes")

b, err := hex.DecodeString(bdata)
assert.NoError(t, err, "decode block header binary")

signb, err := hex.DecodeString(sdata)
assert.NoError(t, err, "decode sign bytes")

bh, err := DecodeBlock(b)
assert.NoError(t, err, "decode block header")
// make sure cached bytes during decoding will not influence the following tests
bh.cachedBytes = nil

assert.Equal(t, maddr, bh.Miner, "check for miner")
assert.Equal(t, signb, bh.SignatureData(), "check for signature data")

blk, err := bh.ToStorageBlock()
assert.NoError(t, err, "ToStorageBlock")

assert.Equal(t, c, bh.cachedCid, "check for cachedCid")
assert.Equal(t, b, bh.cachedBytes, "check for cachedBytes")

assert.Equal(t, c, blk.Cid(), "check for blk.Cid()")
assert.Equal(t, b, blk.RawData(), "check for blk.RawData()")
}
2 changes: 1 addition & 1 deletion venus-shared/go.mod
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ require (
github.com/ipfs/go-ipld-cbor v0.0.4
github.com/ipfs/go-ipld-format v0.0.2
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
github.com/stretchr/testify v1.6.1
github.com/stretchr/testify v1.7.0
github.com/whyrusleeping/cbor-gen v0.0.0-20200812213548-958ddffe352c
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1
)
2 changes: 2 additions & 0 deletions venus-shared/go.sum
Original file line number Diff line number Diff line change
@@ -115,6 +115,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0=
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=