Skip to content

Commit

Permalink
Bytes() => Encode()
Browse files Browse the repository at this point in the history
  • Loading branch information
DeividasK committed Aug 7, 2024
1 parent 47c4eea commit 318d2c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
6 changes: 2 additions & 4 deletions core/capabilities/targets/write_target.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type ReportV1Metadata struct {
ReportID [2]byte
}

func (rm ReportV1Metadata) Bytes() ([]byte, error) {
func (rm ReportV1Metadata) Encode() ([]byte, error) {
buf := new(bytes.Buffer)
err := binary.Write(buf, binary.BigEndian, rm)
if err != nil {
Expand All @@ -95,7 +95,7 @@ func (rm ReportV1Metadata) Bytes() ([]byte, error) {
}

func (rm ReportV1Metadata) Length() int {
bytes, err := rm.Bytes()
bytes, err := rm.Encode()
if err != nil {
return 0
}
Expand Down Expand Up @@ -161,8 +161,6 @@ func decodeReportMetadata(reportPayload []byte) (ReportV1Metadata, error) {
return metadata, nil
}

// TODO: Encode

type Config struct {
// Address of the contract that will get the forwarded report
Address string
Expand Down
2 changes: 1 addition & 1 deletion core/capabilities/targets/write_target_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func TestWriteTarget(t *testing.T) {
ReportID: [2]byte{1, 2},
}

reportMetadataBytes, err := reportMetadata.Bytes()
reportMetadataBytes, err := reportMetadata.Encode()
require.NoError(t, err)

validInputs, err := values.NewMap(map[string]any{
Expand Down

0 comments on commit 318d2c6

Please sign in to comment.