Skip to content

chore: upgrade ucantone validator#26

Merged
alanshaw merged 8 commits into
ash/feat/proof-storefrom
ash/chore/upgrade-ucantone-validator
May 19, 2026
Merged

chore: upgrade ucantone validator#26
alanshaw merged 8 commits into
ash/feat/proof-storefrom
ash/chore/upgrade-ucantone-validator

Conversation

@alanshaw
Copy link
Copy Markdown
Member

@alanshaw alanshaw commented May 19, 2026

Renames capabilities to commands and renames capabilities.MustNew(...) to capabilities.MustParse(...).

depends on fil-forge/ucantone#14

@alanshaw alanshaw requested review from Peeja and frrist May 19, 2026 13:10
Comment thread ucan/retrieval/server_test.go Outdated

s := retrieval.NewServer(service)
s.Handle(contentRetrieveCapability, func(req execution.Request, res execution.Response) error {
s.Handle(ucan.Command(contentRetrieve), func(req execution.Request, res execution.Response) error {
Copy link
Copy Markdown
Member Author

@alanshaw alanshaw May 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Peeja This kinda sucks, bindcom.Command is a command.Command but you can't use it here without type asserting...

Notably you also don't get to call methods defined on command.Command.

A couple of options:

Define as a struct instead:

type Command[A] struct {
  command.Command
}

You get to call the command.Command methods directly but you'd still have to access .Command to pass it to server.Handler(...).

Define a Command() method:

func (c Command[A]) Command() command.Command {
  return command.Command(c)
}

Doesn't really get us anything other than it being slightly less verbose than type asserting...you can at least still use it in a map.

IDK, any ideas? Can also just leave it as is.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to:

type Command[A] struct {
  command.Command
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PRs for those proposals:

fil-forge/ucantone#15
fil-forge/ucantone#16

alanshaw added a commit to fil-forge/ucantone that referenced this pull request May 19, 2026
re: fil-forge/libforge#26 (comment)

Instead of:

```go
// content/retrieve.go

Retrieve := bindcom.Parse[*RetrieveArgs]("/content/retrieve")

// server.go

s := retrieval.NewServer(service)
s.Handle(ucan.Command(content.Retrieve), /* ... */)
```

You can do:

```go
s.Handle(content.Retrieve.Command, /* ... */)
```

Alternative to #15
@alanshaw alanshaw merged commit 5c66886 into ash/feat/proof-store May 19, 2026
4 checks passed
@alanshaw alanshaw deleted the ash/chore/upgrade-ucantone-validator branch May 19, 2026 19:37
alanshaw added a commit to fil-forge/go-ipni-tools that referenced this pull request May 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants