Reformatting due to go fmt
This commit is contained in:
parent
8578fc20a3
commit
4d4c229594
@ -20,20 +20,19 @@
|
|||||||
package builder_test
|
package builder_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/onsi/ginkgo"
|
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
|
||||||
"github.com/ethereum/go-ethereum/params"
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/consensus/ethash"
|
"github.com/ethereum/go-ethereum/consensus/ethash"
|
||||||
"math/big"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
"github.com/onsi/gomega"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
b "github.com/ethereum/go-ethereum/statediff/builder"
|
b "github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
|
"github.com/onsi/ginkgo"
|
||||||
|
"github.com/onsi/gomega"
|
||||||
|
"math/big"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
testdb = ethdb.NewMemDatabase()
|
testdb = ethdb.NewMemDatabase()
|
||||||
|
|
||||||
@ -53,6 +52,7 @@ var (
|
|||||||
emptyAccountDiffEventualMap = make(map[common.Address]b.AccountDiffEventual)
|
emptyAccountDiffEventualMap = make(map[common.Address]b.AccountDiffEventual)
|
||||||
emptyAccountDiffIncrementalMap = make(map[common.Address]b.AccountDiffIncremental)
|
emptyAccountDiffIncrementalMap = make(map[common.Address]b.AccountDiffIncremental)
|
||||||
)
|
)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
contract test {
|
contract test {
|
||||||
|
|
||||||
@ -68,7 +68,6 @@ contract test {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
// makeChain creates a chain of n blocks starting at and including parent.
|
// makeChain creates a chain of n blocks starting at and including parent.
|
||||||
// the returned hash chain is ordered head->parent. In addition, every 3rd block
|
// the returned hash chain is ordered head->parent. In addition, every 3rd block
|
||||||
// contains a transaction and every 5th an uncle to allow testing correct block
|
// contains a transaction and every 5th an uncle to allow testing correct block
|
||||||
@ -86,7 +85,6 @@ func makeChain(n int, seed byte, parent *types.Block) ([]common.Hash, map[common
|
|||||||
return hashes, blockm
|
return hashes, blockm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func testChainGen(i int, block *core.BlockGen) {
|
func testChainGen(i int, block *core.BlockGen) {
|
||||||
signer := types.HomesteadSigner{}
|
signer := types.HomesteadSigner{}
|
||||||
switch i {
|
switch i {
|
||||||
@ -117,6 +115,7 @@ func testChainGen(i int, block *core.BlockGen) {
|
|||||||
block.AddTx(tx)
|
block.AddTx(tx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ = ginkgo.FDescribe("", func() {
|
var _ = ginkgo.FDescribe("", func() {
|
||||||
var (
|
var (
|
||||||
block0Hash, block1Hash, block2Hash, block3Hash common.Hash
|
block0Hash, block1Hash, block2Hash, block3Hash common.Hash
|
||||||
|
@ -20,15 +20,16 @@
|
|||||||
package extractor_test
|
package extractor_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
|
b "github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
|
e "github.com/ethereum/go-ethereum/statediff/extractor"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff/testhelpers"
|
||||||
"github.com/onsi/ginkgo"
|
"github.com/onsi/ginkgo"
|
||||||
"github.com/onsi/gomega"
|
"github.com/onsi/gomega"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
|
||||||
"math/rand"
|
|
||||||
"github.com/ethereum/go-ethereum/statediff/testhelpers"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
e "github.com/ethereum/go-ethereum/statediff/extractor"
|
"math/rand"
|
||||||
b "github.com/ethereum/go-ethereum/statediff/builder"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = ginkgo.Describe("Extractor", func() {
|
var _ = ginkgo.Describe("Extractor", func() {
|
||||||
var publisher testhelpers.MockPublisher
|
var publisher testhelpers.MockPublisher
|
||||||
var builder testhelpers.MockBuilder
|
var builder testhelpers.MockBuilder
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
package publisher
|
package publisher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/statediff/builder"
|
|
||||||
"time"
|
|
||||||
"os"
|
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"path/filepath"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -59,7 +59,7 @@ func (p *publisher) publishStateDiffToCSV(sd builder.StateDiff) error {
|
|||||||
data = append(data, row)
|
data = append(data, row)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, value := range data{
|
for _, value := range data {
|
||||||
err := writer.Write(value)
|
err := writer.Write(value)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -149,4 +149,3 @@ func formatAccountDiffIncremental(accountDiff builder.AccountDiffIncremental, sd
|
|||||||
}
|
}
|
||||||
return formattedAccountData
|
return formattedAccountData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
package publisher
|
package publisher
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/statediff/builder"
|
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
|
"github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Publisher interface {
|
type Publisher interface {
|
||||||
|
@ -1,17 +1,17 @@
|
|||||||
package publisher_test
|
package publisher_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/onsi/ginkgo"
|
|
||||||
"github.com/onsi/gomega"
|
|
||||||
"os"
|
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
"path/filepath"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
"strconv"
|
"github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
p "github.com/ethereum/go-ethereum/statediff/publisher"
|
p "github.com/ethereum/go-ethereum/statediff/publisher"
|
||||||
"github.com/ethereum/go-ethereum/statediff/testhelpers"
|
"github.com/ethereum/go-ethereum/statediff/testhelpers"
|
||||||
|
"github.com/onsi/ginkgo"
|
||||||
|
"github.com/onsi/gomega"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"github.com/ethereum/go-ethereum/statediff/builder"
|
"os"
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ = ginkgo.Describe("Publisher", func() {
|
var _ = ginkgo.Describe("Publisher", func() {
|
||||||
|
@ -3,14 +3,14 @@ package service
|
|||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/ethdb"
|
"github.com/ethereum/go-ethereum/ethdb"
|
||||||
|
"github.com/ethereum/go-ethereum/event"
|
||||||
"github.com/ethereum/go-ethereum/p2p"
|
"github.com/ethereum/go-ethereum/p2p"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
"github.com/ethereum/go-ethereum/event"
|
|
||||||
"log"
|
|
||||||
e "github.com/ethereum/go-ethereum/statediff/extractor"
|
|
||||||
b "github.com/ethereum/go-ethereum/statediff/builder"
|
|
||||||
"github.com/ethereum/go-ethereum/statediff"
|
"github.com/ethereum/go-ethereum/statediff"
|
||||||
|
b "github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
|
e "github.com/ethereum/go-ethereum/statediff/extractor"
|
||||||
p "github.com/ethereum/go-ethereum/statediff/publisher"
|
p "github.com/ethereum/go-ethereum/statediff/publisher"
|
||||||
|
"log"
|
||||||
)
|
)
|
||||||
|
|
||||||
type StateDiffService struct {
|
type StateDiffService struct {
|
||||||
@ -43,7 +43,7 @@ func (StateDiffService) APIs() []rpc.API {
|
|||||||
return []rpc.API{}
|
return []rpc.API{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sds *StateDiffService) loop (sub event.Subscription, events chan core.ChainHeadEvent) {
|
func (sds *StateDiffService) loop(sub event.Subscription, events chan core.ChainHeadEvent) {
|
||||||
defer sub.Unsubscribe()
|
defer sub.Unsubscribe()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package testhelpers
|
package testhelpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"errors"
|
"errors"
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/statediff/builder"
|
"github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ func (builder *MockBuilder) SetBuilderError(err error) {
|
|||||||
builder.builderError = err
|
builder.builderError = err
|
||||||
}
|
}
|
||||||
|
|
||||||
type MockPublisher struct{
|
type MockPublisher struct {
|
||||||
StateDiff *builder.StateDiff
|
StateDiff *builder.StateDiff
|
||||||
publisherError error
|
publisherError error
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package testhelpers
|
package testhelpers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/statediff/builder"
|
"github.com/ethereum/go-ethereum/statediff/builder"
|
||||||
"math/big"
|
"math/big"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
"math/rand"
|
"math/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user