From 265f9545e9c6b689ece06e8e55cb3b83e641706a Mon Sep 17 00:00:00 2001 From: Thomas E Lackey Date: Fri, 21 Jul 2023 21:38:37 -0500 Subject: [PATCH] Use diff --- pkg/graphql/graphql_test.go | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/pkg/graphql/graphql_test.go b/pkg/graphql/graphql_test.go index 92ca100d..bfd67d89 100644 --- a/pkg/graphql/graphql_test.go +++ b/pkg/graphql/graphql_test.go @@ -19,9 +19,6 @@ package graphql_test import ( "context" "fmt" - "math/big" - "strconv" - "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core" @@ -36,6 +33,8 @@ import ( "github.com/jmoiron/sqlx" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" + "math/big" + "strconv" "github.com/cerc-io/ipld-eth-server/v5/pkg/eth" "github.com/cerc-io/ipld-eth-server/v5/pkg/eth/test_helpers" @@ -134,11 +133,22 @@ var _ = BeforeSuite(func() { rcts = receipts[i-1] } - _, err = builder.BuildStateDiffObject(args, statediff.Params{}) - Expect(err).ToNot(HaveOccurred()) tx, err := indexer.PushBlock(block, rcts, mockTD) Expect(err).ToNot(HaveOccurred()) + diff, err := builder.BuildStateDiffObject(args, statediff.Params{}) + Expect(err).ToNot(HaveOccurred()) + + for _, node := range diff.Nodes { + err = indexer.PushStateNode(tx, node, block.Hash().String()) + Expect(err).ToNot(HaveOccurred()) + } + + for _, ipld := range diff.IPLDs { + err = indexer.PushIPLD(tx, ipld) + Expect(err).ToNot(HaveOccurred()) + } + err = tx.Submit(err) Expect(err).ToNot(HaveOccurred()) }