Skip to content

Commit

Permalink
multi: rename raw_proof to raw_proof_file
Browse files Browse the repository at this point in the history
  • Loading branch information
guggero committed Sep 8, 2023
1 parent 2be6917 commit d89392d
Show file tree
Hide file tree
Showing 8 changed files with 285 additions and 285 deletions.
4 changes: 2 additions & 2 deletions cmd/tapcli/proofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func verifyProof(ctx *cli.Context) error {
defer cleanUp()

resp, err := client.VerifyProof(ctxc, &taprpc.ProofFile{
RawProof: rawFile,
RawProofFile: rawFile,
})
if err != nil {
return fmt.Errorf("unable to verify proof file: %w", err)
Expand Down Expand Up @@ -273,7 +273,7 @@ func exportProof(ctx *cli.Context) error {
// JSON format.
if ctx.String(proofPathName) != "" {
filePath := lncfg.CleanAndExpandPath(ctx.String(proofPathName))
return writeToFile(filePath, resp.RawProof)
return writeToFile(filePath, resp.RawProofFile)
}

printRespJSON(resp)
Expand Down
4 changes: 2 additions & 2 deletions itest/addrs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ func sendProof(t *harnessTest, src, dst *tapdHarness, scriptKey []byte,
}, defaultWaitTimeout)
require.NoError(t.t, waitErr)

t.Logf("Importing proof %x", proofResp.RawProof)
t.Logf("Importing proof %x", proofResp.RawProofFile)

importResp, err := dst.ImportProof(ctxb, &tapdevrpc.ImportProofRequest{
ProofFile: proofResp.RawProof,
ProofFile: proofResp.RawProofFile,
GenesisPoint: genInfo.GenesisPoint,
})
require.NoError(t.t, err)
Expand Down
12 changes: 6 additions & 6 deletions itest/assertions.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func WaitForProofUpdate(t *testing.T, client taprpc.TaprootAssetsClient,

f := &proof.File{}
require.NoError(
t, f.Decode(bytes.NewReader(exportResp.RawProof)),
t, f.Decode(bytes.NewReader(exportResp.RawProofFile)),
)
lastProof, err := f.LastProof()
require.NoError(t, err)
Expand Down Expand Up @@ -255,7 +255,7 @@ func AssertAssetProofs(t *testing.T, tapClient taprpc.TaprootAssetsClient,
require.NoError(t, err)

file, snapshot := verifyProofBlob(
t, tapClient, chainClient, a, exportResp.RawProof,
t, tapClient, chainClient, a, exportResp.RawProofFile,
)

assetJSON, err := formatProtoJSON(a)
Expand All @@ -268,7 +268,7 @@ func AssertAssetProofs(t *testing.T, tapClient taprpc.TaprootAssetsClient,
t, CommitmentKey(t, a), snapshot.Asset.AssetCommitmentKey(),
)

return exportResp.RawProof
return exportResp.RawProofFile
}

// assertAssetProofsInvalid makes sure the proofs for the given asset can be
Expand All @@ -289,11 +289,11 @@ func assertAssetProofsInvalid(t *testing.T, tapd *tapdHarness,
require.NoError(t, err)

f := &proof.File{}
require.NoError(t, f.Decode(bytes.NewReader(exportResp.RawProof)))
require.NoError(t, f.Decode(bytes.NewReader(exportResp.RawProofFile)))

// Also make sure that the RPC can verify the proof as well.
verifyResp, err := tapd.VerifyProof(ctxt, &taprpc.ProofFile{
RawProof: exportResp.RawProof,
RawProofFile: exportResp.RawProofFile,
})
require.NoError(t, err)
require.False(t, verifyResp.Valid)
Expand All @@ -314,7 +314,7 @@ func verifyProofBlob(t *testing.T, tapClient taprpc.TaprootAssetsClient,

// Also make sure that the RPC can verify the proof as well.
verifyResp, err := tapClient.VerifyProof(ctxt, &taprpc.ProofFile{
RawProof: blob,
RawProofFile: blob,
})
require.NoError(t, err)
require.True(t, verifyResp.Valid)
Expand Down
4 changes: 2 additions & 2 deletions itest/send_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,11 +861,11 @@ func addProofTestVectorFromFile(t *testing.T, testName string,
require.NoError(t, waitErr)

if binaryFileName != "" {
test.WriteTestFileHex(t, binaryFileName, proofResp.RawProof)
test.WriteTestFileHex(t, binaryFileName, proofResp.RawProofFile)
}

var f proof.File
err := f.Decode(bytes.NewReader(proofResp.RawProof))
err := f.Decode(bytes.NewReader(proofResp.RawProofFile))
require.NoError(t, err)

if f.NumProofs() <= fileIndex {
Expand Down
6 changes: 3 additions & 3 deletions rpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1136,13 +1136,13 @@ func (r *rpcServer) DecodeAddr(_ context.Context,
func (r *rpcServer) VerifyProof(ctx context.Context,
req *taprpc.ProofFile) (*taprpc.VerifyProofResponse, error) {

if !proof.IsProofFile(req.RawProof) {
if !proof.IsProofFile(req.RawProofFile) {
return nil, fmt.Errorf("invalid raw proof, expect single " +
"encoded mint or transition proof")
}

var proofFile proof.File
err := proofFile.Decode(bytes.NewReader(req.RawProof))
err := proofFile.Decode(bytes.NewReader(req.RawProofFile))
if err != nil {
return nil, fmt.Errorf("unable to decode proof file: %w", err)
}
Expand Down Expand Up @@ -1392,7 +1392,7 @@ func (r *rpcServer) ExportProof(ctx context.Context,
}

return &taprpc.ProofFile{
RawProof: proofBlob,
RawProofFile: proofBlob,
}, nil
}

Expand Down
536 changes: 268 additions & 268 deletions taprpc/taprootassets.pb.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion taprpc/taprootassets.proto
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ message DecodeAddrRequest {
message ProofFile {
// The raw proof file encoded as bytes. Must be a file and not just an
// individual mint/transfer proof.
bytes raw_proof = 1;
bytes raw_proof_file = 1;

string genesis_point = 2;
}
Expand Down
2 changes: 1 addition & 1 deletion taprpc/taprootassets.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,7 @@
"taprpcProofFile": {
"type": "object",
"properties": {
"raw_proof": {
"raw_proof_file": {
"type": "string",
"format": "byte",
"description": "The raw proof file encoded as bytes. Must be a file and not just an\nindividual mint/transfer proof."
Expand Down

0 comments on commit d89392d

Please sign in to comment.