Skip to content

Commit

Permalink
Switch from dep to modules
Browse files Browse the repository at this point in the history
Signed-off-by: Kostas Christidis <[email protected]>
  • Loading branch information
kchristidis committed Jan 3, 2020
1 parent e404758 commit a23d614
Show file tree
Hide file tree
Showing 18 changed files with 416 additions and 551 deletions.
502 changes: 0 additions & 502 deletions Gopkg.lock

This file was deleted.

6 changes: 0 additions & 6 deletions Gopkg.toml

This file was deleted.

17 changes: 5 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@ A simulator for blockchain-based local energy markets.

## Dependencies

* go
* dep
* vagrant
* go >= 1.13
* vagrant >= 2.0
* vagrant-disksize
* virtualbox
* virtualbox >= 6.0

If you use [Homebrew](https://brew.sh/), pick up the latest versions of all of the above like so:

```bash
brew install go dep
brew install go
brew cask install virtualbox vagrant
vagrant plugin install vagrant-disksize
```
Expand All @@ -29,13 +28,7 @@ git clone [email protected]:kchristidis/island.git

We assume that the `fabric` repo cloned above lives in `$GOPATH/src/github.com/hyperledger/fabric`, and `island` lives in `$GOPATH/src/github.com/kchristidis/island`. If that is not the case, [edit the Vagrantfile accordingly](https://github.com/kchristidis/fabric/blob/901b8db0bb46a90cf9eb9fbb2e7cbd2fc9fcada3/devenv/Vagrantfile#L19..L20).

Then cd into the `island` directory and:

```bash
dep ensure
```

cd into the `trace` directory within `island`, and download `04-final-trace-2013.csv` ([link](https://drive.google.com/open?id=1snADVFVuzFOE52M9ynVvKXVvif5AJakV)) there.
cd into the `trace` directory within the `island` repo, and download `04-final-trace-2013.csv` ([link](https://drive.google.com/open?id=1snADVFVuzFOE52M9ynVvKXVvif5AJakV)) there.

Finally, cd into the `fabric` directory and:

Expand Down
4 changes: 2 additions & 2 deletions bidder/bidder.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ type RecentBidKeysKV struct {
WriteKeyAttrs []string // Used in Exp3
}

//go:generate counterfeiter . Invoker
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Invoker

// Invoker is an interface that encapsulates the
// peer calls that are relevant to the bidder.
type Invoker interface {
Invoke(args schema.OpContextInput) ([]byte, error)
}

//go:generate counterfeiter . Notifier
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Notifier

// Notifier is an interface that encapsulates the slot
// notifier calls that are relevant to the bidder.
Expand Down
3 changes: 1 addition & 2 deletions bidder/bidder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ func TestBidder(t *testing.T) {

b := bidder.New(invoker, slotnotifier0, slotnotifier1, trace.IDs[0], privkeybytes, m[trace.IDs[0]], slotc, transactionc, bfr, donec)

// var err error
deadc := make(chan struct{})
go func() {
err = b.Run()
Expand All @@ -111,7 +110,7 @@ func TestBidder(t *testing.T) {
invoker.InvokeReturns(nil, nil)
b.SlotQueues[0] <- slot

g.Eventually(bfr, "1s", "50ms").Should(gbytes.Say(fmt.Sprintf("slot:%012d • new slot", slot)))
g.Eventually(bfr, "1s", "50ms").Should(gbytes.Say(fmt.Sprintf("slot:%012d", slot)))

close(donec)
<-deadc
Expand Down
6 changes: 3 additions & 3 deletions bidder/bidderfakes/fake_invoker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions bidder/bidderfakes/fake_notifier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions blocknotifier/blocknotifierfakes/fake_invoker.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions blocknotifier/blocknotifierfakes/fake_querier.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions blocknotifier/notifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ import (
"time"

"github.com/golang/protobuf/proto"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/hyperledger/fabric-sdk-go/pkg/client/ledger"
"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
"github.com/kchristidis/island/chaincode/schema"
"github.com/kchristidis/island/stats"
)

// BufferLen sets the buffer length for the block channel.
const BufferLen = 100

//go:generate counterfeiter . Invoker
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Invoker

// Invoker is an interface that encapsulates the
// peer calls that are relevant to the notifier.
type Invoker interface {
Invoke(args schema.OpContextInput) ([]byte, error)
}

//go:generate counterfeiter . Querier
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Querier

// Querier is an interface that encapsulates the
// ledger calls that are relevant to the notifier.
Expand Down
2 changes: 1 addition & 1 deletion blocknotifier/notifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"time"

"github.com/hyperledger/fabric-sdk-go/pkg/common/providers/fab"
"github.com/hyperledger/fabric-sdk-go/third_party/github.com/hyperledger/fabric/protos/common"
"github.com/hyperledger/fabric-protos-go/common"
"github.com/kchristidis/island/blocknotifier"
"github.com/kchristidis/island/blocknotifier/blocknotifierfakes"
"github.com/kchristidis/island/stats"
Expand Down
6 changes: 3 additions & 3 deletions chaincode/schema/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const (
TraceLength = 35036 // Used to size the metrics variable.
EnableEvents = false // Used to enable/disable the emission of chaincode events.

StagingLevel = Prod // Identifies the staging level for the experiment.
DebugTraceLength = 35 // If in debugging mode, process only the first DebugTraceLength slots.
DebugBidderIDsCount = 5 // If in debugging mode, work only with the first DebugBidderIDsCount bidders in our set.
StagingLevel = Debug // Identifies the staging level for the experiment.
DebugTraceLength = 35 // If in debugging mode, process only the first DebugTraceLength slots.
DebugBidderIDsCount = 5 // If in debugging mode, work only with the first DebugBidderIDsCount bidders in our set.
)

// Level identifies a staging level.
Expand Down
30 changes: 30 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module github.com/kchristidis/island

go 1.13

require (
github.com/Shopify/sarama v1.24.1 // indirect
github.com/cloudflare/cfssl v0.0.0-20180323000720-5d63dbd981b5 // indirect
github.com/fsouza/go-dockerclient v1.6.0 // indirect
github.com/golang/protobuf v1.3.2
github.com/google/certificate-transparency-go v1.0.10-0.20180222191210-5ab67e519c93 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0 // indirect
github.com/hashicorp/go-version v1.2.0 // indirect
github.com/hyperledger/fabric v1.4.4
github.com/hyperledger/fabric-amcl v0.0.0-20191220121445-72160e2d5195 // indirect
github.com/hyperledger/fabric-protos-go v0.0.0-20190821180310-6b6ac9042dfd
github.com/hyperledger/fabric-sdk-go v1.0.0-beta1
github.com/klauspost/cpuid v1.2.2 // indirect
github.com/magiconair/properties v1.8.0 // indirect
github.com/maxbrunsfeld/counterfeiter/v6 v6.2.2
github.com/miekg/pkcs11 v1.0.3 // indirect
github.com/mitchellh/mapstructure v0.0.0-20180511142126-bb74f1db0675 // indirect
github.com/onsi/gomega v1.5.0
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 // indirect
github.com/pelletier/go-toml v1.2.0 // indirect
github.com/spf13/afero v1.1.1 // indirect
github.com/spf13/viper v1.0.3-0.20180507071007-15738813a09d // indirect
github.com/stretchr/testify v1.4.0
github.com/sykesm/zap-logfmt v0.0.3 // indirect
go.uber.org/zap v1.13.0 // indirect
)
Loading

0 comments on commit a23d614

Please sign in to comment.