Skip to content

Commit

Permalink
Update post and API
Browse files Browse the repository at this point in the history
  • Loading branch information
fasmat committed Oct 17, 2023
1 parent d34465d commit 5995f25
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Makefile-libs.Inc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ else
endif
endif

POSTRS_SETUP_REV = 0.5.0-alpha2
POSTRS_SETUP_REV = 0.5.0-alpha4
POSTRS_SETUP_ZIP = libpost-$(platform)-v$(POSTRS_SETUP_REV).zip
POSTRS_SETUP_URL_ZIP ?= https://github.com/spacemeshos/post-rs/releases/download/v$(POSTRS_SETUP_REV)/$(POSTRS_SETUP_ZIP)
POSTRS_PROFILER_ZIP = profiler-$(platform)-v$(POSTRS_SETUP_REV).zip
Expand Down
16 changes: 10 additions & 6 deletions api/grpcserver/post_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,23 @@ func (pc *postClient) Proof(ctx context.Context, challenge []byte) (*types.Post,
}
}

meta := proofResp.GetMetadata()
if !bytes.Equal(meta.GetChallenge(), challenge) {
return nil, nil, fmt.Errorf("unexpected challenge: %x", meta.GetChallenge())
proof := proofResp.GetProof()
proofMeta := proofResp.GetMetadata()
if proofMeta == nil {
return nil, nil, fmt.Errorf("proof metadata is nil")
}

if !bytes.Equal(proofMeta.GetChallenge(), challenge) {
return nil, nil, fmt.Errorf("unexpected challenge: %x", proofMeta.GetChallenge())
}

proof := proofResp.GetProof()
return &types.Post{
Nonce: proof.GetNonce(),
Indices: proof.GetIndices(),
Pow: proof.GetPow(),
}, &types.PostMetadata{
Challenge: meta.GetChallenge(),
LabelsPerUnit: meta.GetLabelsPerUnit(),
Challenge: proofMeta.GetChallenge(),
LabelsPerUnit: proofMeta.GetLabelsPerUnit(),

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / coverage

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / lint

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit) (compile)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / lint

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit) (compile)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / unittests (ubuntu-latest)

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / unittests (self-hosted, linux, arm64)

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / unittests (self-hosted, linux, arm64)

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / unittests (macos-latest)

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)

Check failure on line 94 in api/grpcserver/post_client.go

View workflow job for this annotation

GitHub Actions / unittests (self-hosted, macos, arm64)

proofMeta.GetLabelsPerUnit undefined (type *spacemeshv1.ProofMetadata has no field or method GetLabelsPerUnit)
}, nil
case pb.GenProofStatus_GEN_PROOF_STATUS_ERROR:
return nil, nil, fmt.Errorf("error generating proof: %s", proofResp)
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.21.3
require (
cloud.google.com/go/storage v1.33.0
github.com/ALTree/bigfloat v0.2.0
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20230921024434-5dc1c2e7b958
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20231016140705-13ea12f85a58
github.com/cosmos/btcutil v1.0.5
github.com/go-llsqlite/crawshaw v0.4.0
github.com/gofrs/flock v0.8.1
Expand Down Expand Up @@ -33,13 +33,13 @@ require (
github.com/prometheus/common v0.44.0
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1
github.com/seehuhn/mt19937 v1.0.0
github.com/spacemeshos/api/release/go v1.21.1-0.20231004094005-50f3a79535bf
github.com/spacemeshos/api/release/go v1.21.1-0.20231013090942-0dc2114b2613
github.com/spacemeshos/economics v0.1.1
github.com/spacemeshos/fixed v0.1.1
github.com/spacemeshos/go-scale v1.1.12
github.com/spacemeshos/merkle-tree v0.2.3
github.com/spacemeshos/poet v0.9.7
github.com/spacemeshos/post v0.9.5
github.com/spacemeshos/post v0.9.6-0.20231017175317-72409b68a176
github.com/spf13/afero v1.10.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
Expand All @@ -50,9 +50,9 @@ require (
go.uber.org/atomic v1.11.0
go.uber.org/mock v0.3.0
go.uber.org/zap v1.26.0
golang.org/x/exp v0.0.0-20230905200255-921286631fa9
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/sync v0.4.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
k8s.io/api v0.28.2
Expand Down Expand Up @@ -207,14 +207,14 @@ require (
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
gonum.org/v1/gonum v0.13.0 // indirect
google.golang.org/api v0.143.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 // indirect
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
Expand Down
32 changes: 16 additions & 16 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/c0mm4nd/go-ripemd v0.0.0-20200326052756-bd1759ad7d10/go.mod h1:mYPR+a
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44=
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20230921024434-5dc1c2e7b958 h1:ZbUxM01X+rNdowNAY0V+pEmPwClZ3Yk3jeEXZnlBIsQ=
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20230921024434-5dc1c2e7b958/go.mod h1:D0MCl3VJDwy+kjliAbf/RIBk1aeE5fOsvjzNSmZHF6E=
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20231016140705-13ea12f85a58 h1:RC50yuqq3d3APo7l67UXLdNXTcNrEwSbmWzZ5ESjD7I=
github.com/chaos-mesh/chaos-mesh/api v0.0.0-20231016140705-13ea12f85a58/go.mod h1:D0MCl3VJDwy+kjliAbf/RIBk1aeE5fOsvjzNSmZHF6E=
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
Expand Down Expand Up @@ -641,8 +641,8 @@ github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:Udh
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/sourcegraph/syntaxhighlight v0.0.0-20170531221838-bd320f5d308e/go.mod h1:HuIsMU8RRBOtsCgI77wP899iHVBQpCmg4ErYMZB+2IA=
github.com/spacemeshos/api/release/go v1.21.1-0.20231004094005-50f3a79535bf h1:V28Dks9MHBCHtikkSIms07labbSlGjd29CILPqV3LCw=
github.com/spacemeshos/api/release/go v1.21.1-0.20231004094005-50f3a79535bf/go.mod h1:FevAAtamzj+f/PkXdAyLVB0yHG5CG5rp/TPmutmj2GA=
github.com/spacemeshos/api/release/go v1.21.1-0.20231013090942-0dc2114b2613 h1:ifyLf+9ipe4vR+aJRzcPoj7o09BXMesE56IeAGDeR2o=
github.com/spacemeshos/api/release/go v1.21.1-0.20231013090942-0dc2114b2613/go.mod h1:FevAAtamzj+f/PkXdAyLVB0yHG5CG5rp/TPmutmj2GA=
github.com/spacemeshos/economics v0.1.1 h1:BPgMoTaeQ05ME6wEA1+MvXMp+wvXr51bIuN23thrCAk=
github.com/spacemeshos/economics v0.1.1/go.mod h1:76nTjugYRiQ5/eD/DQs2dXPPilp28URMswUKncfdanY=
github.com/spacemeshos/fixed v0.1.1 h1:N1y4SUpq1EV+IdJrWJwUCt1oBFzeru/VKVcBsvPc2Fk=
Expand All @@ -653,8 +653,8 @@ github.com/spacemeshos/merkle-tree v0.2.3 h1:zGEgOR9nxAzJr0EWjD39QFngwFEOxfxMloE
github.com/spacemeshos/merkle-tree v0.2.3/go.mod h1:VomOcQ5pCBXz7goiWMP5hReyqOfDXGSKbrH2GB9Htww=
github.com/spacemeshos/poet v0.9.7 h1:FmKhgUKj//8Tzn8czWSIrn6+FVUFZbvLh8zqLfB8dfE=
github.com/spacemeshos/poet v0.9.7/go.mod h1:wGCdhs2jnfQ52Amcmygv9uEEwYpdHAPjbiPg0Uf6cNQ=
github.com/spacemeshos/post v0.9.5 h1:seIRBKt22Y2C6k/grRPl9KgR7XmTMwp+kIuBY/c7VQM=
github.com/spacemeshos/post v0.9.5/go.mod h1:jGwvAiJAnThEx1eNCvHszgoIpiXiWHxjEv4YIcjBhLQ=
github.com/spacemeshos/post v0.9.6-0.20231017175317-72409b68a176 h1:94lI8u5nIJHPynfChWISlDEVjzjVbYVIuQ6TVcd2CiM=
github.com/spacemeshos/post v0.9.6-0.20231017175317-72409b68a176/go.mod h1:FPa130ioHforcqca0vqJrYjgUsYzTBwivy6lyLy7sKA=
github.com/spacemeshos/sha256-simd v0.1.0 h1:G7Mfu5RYdQiuE+wu4ZyJ7I0TI74uqLhFnKblEnSpjYI=
github.com/spacemeshos/sha256-simd v0.1.0/go.mod h1:O8CClVIilId7RtuCMV2+YzMj6qjVn75JsxOxaE8vcfM=
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
Expand Down Expand Up @@ -779,8 +779,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down Expand Up @@ -1016,8 +1016,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ=
golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -1104,12 +1104,12 @@ google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 h1:vlzZttNJGVqTsRFU9AmdnrcO1Znh8Ew9kCD//yjigk0=
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:CCviP9RmpZ1mxVr8MUjCnSiY09IbAXZxhLE6EhHIdPU=
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13 h1:U7+wNaVuSTaUqNvK2+osJ9ejEZxbjHHk8F2b6Hpx0AE=
google.golang.org/genproto/googleapis/api v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:RdyHbowztCGQySiCvQPgWQWgWhGnouTdCflKoDBt32U=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM=
google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA=
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a h1:fwgW9j3vHirt4ObdHoYNwuO24BEZjSzbh+zPaNWoiY8=
google.golang.org/genproto v0.0.0-20231012201019-e917dd12ba7a/go.mod h1:EMfReVxb80Dq1hhioy0sOsY9jCE46YDgHlJ7fWVUWRE=
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 h1:W18sezcAYs+3tDZX4F80yctqa12jcP1PUS2gQu1zTPU=
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97/go.mod h1:iargEX0SFPm3xcfMI0d1domjg0ZF4Aa0p2awqyxhvF0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b h1:ZlWIi1wSK56/8hn4QcBp/j9M7Gt3U/3hZw3mC7vDICo=
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b/go.mod h1:swOH3j0KzcDDgGUWr+SNpyTen5YrXjS3eyPzFYKc6lc=
google.golang.org/grpc v1.14.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.16.0/go.mod h1:0JHn/cJsOMiMfNA9+DeHDlAU7KAAB5GDlYFpa9MZMio=
google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs=
Expand Down

0 comments on commit 5995f25

Please sign in to comment.