Skip to content

Commit

Permalink
Moving to V2 APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
AnomalRoil committed Aug 19, 2024
1 parent 543b497 commit dbcc8c7
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 112 deletions.
2 changes: 1 addition & 1 deletion cmd/tle/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (

// =============================================================================

const usage = `tlock v1.1.1 -- github.com/drand/tlock
const usage = `tlock v1.2.0 -- github.com/drand/tlock
Usage:
tle [--encrypt] (-r round)... [--armor] [-o OUTPUT] [INPUT]
Expand Down
47 changes: 25 additions & 22 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,44 +1,47 @@
module github.com/drand/tlock

go 1.20
go 1.22

toolchain go1.22.4

require (
filippo.io/age v1.1.1
github.com/drand/drand v1.5.9
github.com/drand/kyber v1.2.0
github.com/drand/drand/v2 v2.0.2
github.com/drand/go-clients v0.2.0
github.com/drand/kyber v1.3.1
github.com/drand/kyber-bls12381 v0.3.1
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
gopkg.in/yaml.v3 v3.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240116215550-a9fa1716bcac // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
go.dedis.ch/fixbuf v1.0.3 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240723171418-e6d459c13d2a // indirect
)

require (
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/golang-lru v1.0.2 // indirect
github.com/kelseyhightower/envconfig v1.4.0
github.com/kilic/bls12-381 v0.1.0 // indirect
github.com/nikkolasg/hexjson v0.1.0 // indirect
github.com/prometheus/client_golang v1.18.0 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.46.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.18.0 // indirect
golang.org/x/net v0.20.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/grpc v1.65.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
)
185 changes: 110 additions & 75 deletions go.sum

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions networks/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ import (
"strings"
"time"

"github.com/drand/drand/chain"
"github.com/drand/drand/crypto"
chain "github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/crypto"

dclient "github.com/drand/drand/client"
dhttp "github.com/drand/drand/client/http"
dhttp "github.com/drand/go-clients/client/http"
dclient "github.com/drand/go-clients/drand"
"github.com/drand/kyber"
)

Expand Down Expand Up @@ -56,7 +56,7 @@ func NewNetwork(host string, chainHash string) (*Network, error) {
return nil, fmt.Errorf("decoding chain hash: %w", err)
}

client, err := dhttp.New(host, hash, transport())
client, err := dhttp.New(context.Background(), nil, host, hash, transport())
if err != nil {
return nil, fmt.Errorf("creating client: %w", err)
}
Expand Down Expand Up @@ -122,7 +122,7 @@ func (n *Network) Signature(roundNumber uint64) ([]byte, error) {
return nil, err
}

return result.Signature(), nil
return result.GetSignature(), nil
}

// RoundNumber will return the latest round of randomness that is available
Expand Down Expand Up @@ -156,6 +156,6 @@ func transport() *http.Transport {
MaxIdleConns: 2,
IdleConnTimeout: 5 * time.Second,
TLSHandshakeTimeout: 5 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ExpectContinueTimeout: 2 * time.Second,
}
}
4 changes: 2 additions & 2 deletions tlock.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"filippo.io/age"
"filippo.io/age/armor"
"github.com/drand/drand/chain"
"github.com/drand/drand/crypto"
chain "github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/crypto"
"github.com/drand/kyber"
bls "github.com/drand/kyber-bls12381"
"github.com/drand/kyber/encrypt/ibe"
Expand Down
2 changes: 1 addition & 1 deletion tlock_age.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"filippo.io/age"
"github.com/drand/drand/chain"
chain "github.com/drand/drand/v2/common"
)

var ErrWrongChainhash = errors.New("invalid chainhash")
Expand Down
8 changes: 4 additions & 4 deletions tlock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"testing"
"time"

"github.com/drand/drand/crypto"
chain "github.com/drand/drand/v2/common"
"github.com/drand/drand/v2/crypto"
bls "github.com/drand/kyber-bls12381"
"github.com/stretchr/testify/require"

"github.com/drand/drand/chain"
"github.com/drand/tlock"
"github.com/drand/tlock/networks/http"

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

var (
Expand Down

0 comments on commit dbcc8c7

Please sign in to comment.