diff --git a/Makefile b/Makefile index d23cf6b..169fc42 100644 --- a/Makefile +++ b/Makefile @@ -43,7 +43,7 @@ gen-originator-account: } \ }' "${FLOW_JSON}" > flow.json.tmp && mv flow.json.tmp "${FLOW_JSON}" || { echo "Failed to update ${FLOW_JSON} with jq"; exit 1; }; \ jq --arg address "$$address" '.originators += [$$address]' "${ROSETTA_ENV}.json" > env.json.tmp && mv env.json.tmp "${ROSETTA_ENV}.json"; \ - echo "$(ACCOUNT_NAME),$$KEYS,0x$$address" >> $(ACCOUNT_KEYS_FILENAME); \ + echo "$(ACCOUNT_NAME),$$KEYS,0x$$address" >> $(ACCOUNT_KEYS_FILENAME); \ echo "Updated $(FLOW_JSON), $(ROSETTA_ENV).json and $(ACCOUNT_KEYS_FILENAME)"; .PHONY: fund-accounts @@ -67,22 +67,22 @@ create-originator-derived-account: ROOT_ORIGINATOR_PUBLIC_KEY=$$(grep '$(ORIGINATOR_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f2); \ ROOT_ORIGINATOR_PRIVATE_KEY=$$(grep '$(ORIGINATOR_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f4 ); \ ROOT_ORIGINATOR_ADDRESS=$$(grep '$(ORIGINATOR_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f5); \ - echo "Originator address: $$ROOT_ORIGINATOR_ADDRESS"; \ - TX_HASH=$$(python3 rosetta_handler.py rosetta-create-derived-account $(ROSETTA_HOST_URL) $$ROOT_ORIGINATOR_ADDRESS $$ROOT_ORIGINATOR_PUBLIC_KEY $$ROOT_ORIGINATOR_PRIVATE_KEY $$NEW_ACCOUNT_PUBLIC_ROSETTA_KEY); \ + echo "Originator address: $$ROOT_ORIGINATOR_ADDRESS"; \ + TX_HASH=$$(python3 rosetta_handler.py rosetta-create-derived-account $(ROSETTA_HOST_URL) $$ROOT_ORIGINATOR_ADDRESS $$ROOT_ORIGINATOR_PUBLIC_KEY $$ROOT_ORIGINATOR_PRIVATE_KEY $$NEW_ACCOUNT_PUBLIC_ROSETTA_KEY); \ ADDRESS=$$(flow transactions get $$TX_HASH -f $(FLOW_JSON) -n $(ROSETTA_ENV) -o json | jq -r '.events[] | select(.type == "flow.AccountCreated") | .values.value.fields[] | select(.name == "address") | .value.value'); \ echo "TX_HASH: $$TX_HASH , ADDRESS: $$ADDRESS"; \ - echo "$(NEW_ACCOUNT_NAME),$$NEW_ACCOUNT_PUBLIC_FLOW_KEY,$$NEW_ACCOUNT_PUBLIC_ROSETTA_KEY,$$NEW_ACCOUNT_PRIVATE_KEY,$$ADDRESS" >> $(ACCOUNT_KEYS_FILENAME); + echo "$(NEW_ACCOUNT_NAME),$$NEW_ACCOUNT_PUBLIC_FLOW_KEY,$$NEW_ACCOUNT_PUBLIC_ROSETTA_KEY,$$NEW_ACCOUNT_PRIVATE_KEY,$$ADDRESS" >> $(ACCOUNT_KEYS_FILENAME); .PHONY: rosetta-transfer-funds rosetta-transfer-funds: PAYER_PUBLIC_KEY=$$(grep '$(PAYER_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f2); \ PAYER_PRIVATE_KEY=$$(grep '$(PAYER_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f4 ); \ PAYER_ADDRESS=$$(grep '$(PAYER_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f5); \ - echo "Payer address: $$PAYER_ADDRESS"; \ + echo "Payer address: $$PAYER_ADDRESS"; \ RECIPIENT_ADDRESS=$$(grep '$(RECIPIENT_NAME)' $(ACCOUNT_KEYS_FILENAME) | cut -d ',' -f5); \ - echo "Recipient address: $$RECIPIENT_ADDRESS"; \ - TX_HASH=$$(python3 rosetta_handler.py rosetta-transfer-funds $(ROSETTA_HOST_URL) $$PAYER_ADDRESS $$PAYER_PUBLIC_KEY $$PAYER_PRIVATE_KEY $$RECIPIENT_ADDRESS $$AMOUNT); \ - echo "Funding sent: $$TX_HASH"; + echo "Recipient address: $$RECIPIENT_ADDRESS"; \ + TX_HASH=$$(python3 rosetta_handler.py rosetta-transfer-funds $(ROSETTA_HOST_URL) $$PAYER_ADDRESS $$PAYER_PUBLIC_KEY $$PAYER_PRIVATE_KEY $$RECIPIENT_ADDRESS $$AMOUNT); \ + echo "Funding sent: $$TX_HASH"; # Use this target to verify that the accounts configured in the Rosetta environment JSON have the specified contracts deployed .PHONY: verify-configured-contract-addresses @@ -92,22 +92,22 @@ verify-configured-contract-addresses: KEY=$$(echo $$contract | cut -d= -f1); \ VALUE=$$(echo $$contract | cut -d= -f2); \ if [ "$$VALUE" = "0000000000000000" ]; then \ - continue; \ - fi; \ + continue; \ + fi; \ CONTRACTS_FOUND=$$(flow accounts get $$VALUE -f $(FLOW_JSON) -n $(ROSETTA_ENV) -o json | \ jq -r '.contracts | join(",") '); \ found=false ; \ for contract in $$(echo $$CONTRACTS_FOUND | tr ',' ' '); do \ - lowercase_contract_name=$$(echo $$contract | tr '[:upper:]' '[:lower:]'); \ - if [ "$$KEY" = "$$lowercase_contract_name" ]; then \ - found=true ; \ - break; \ - fi; \ - done; \ - if [ "$$found" = "false" ]; then \ - echo "Contract $$KEY configured in $(ROSETTA_ENV).json is not deployed to configured address $$VALUE" ;\ + lowercase_contract_name=$$(echo $$contract | tr '[:upper:]' '[:lower:]'); \ + if [ "$$KEY" = "$$lowercase_contract_name" ]; then \ + found=true ; \ + break; \ + fi; \ + done; \ + if [ "$$found" = "false" ]; then \ + echo "Contract $$KEY configured in $(ROSETTA_ENV).json is not deployed to configured address $$VALUE" ;\ fi; \ - done ; \ + done ; .PHONY: build build: go-test go-build @@ -139,4 +139,4 @@ test-reset: test-cleanup: test-reset rm -f flow.json rm -f account-keys.csv - rm -rf flow-go \ No newline at end of file + rm -rf flow-go diff --git a/go.mod b/go.mod index 7ca0c0d..d773cee 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/coinbase/rosetta-sdk-go v0.8.9 github.com/coinbase/rosetta-sdk-go/types v1.0.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 - github.com/dgraph-io/badger/v2 v2.2007.4 github.com/dgraph-io/badger/v3 v3.2103.2 github.com/ethereum/go-ethereum v1.16.3 github.com/golang/protobuf v1.5.4 @@ -14,8 +13,8 @@ require ( github.com/libp2p/go-libp2p v0.38.2 github.com/onflow/cadence v1.7.0 github.com/onflow/crypto v0.25.3 - github.com/onflow/flow-go v0.43.0-dev-pebble.1.0.20250910132853-12699a150fd9 - github.com/onflow/flow/protobuf/go/flow v0.4.12 + github.com/onflow/flow-go v0.43.0-rc.2 + github.com/onflow/flow/protobuf/go/flow v0.4.15 github.com/rs/zerolog v1.29.0 github.com/stretchr/testify v1.11.1 go.opentelemetry.io/otel v1.37.0 @@ -49,6 +48,7 @@ require ( github.com/cockroachdb/swiss v0.0.0-20250624142022-d6e517c1d961 // indirect github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect github.com/crate-crypto/go-ipa v0.0.0-20240724233137-53bbb0ceb27a // indirect + github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect @@ -69,7 +69,7 @@ require ( github.com/onflow/fixed-point v0.1.1 // indirect github.com/onflow/flow-evm-bridge v0.1.0 // indirect github.com/onflow/flow-ft/lib/go/templates v1.0.1 // indirect - github.com/onflow/flow-nft/lib/go/templates v1.2.1 // indirect + github.com/onflow/flow-nft/lib/go/templates v1.3.0 // indirect github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 // indirect github.com/pion/datachannel v1.5.10 // indirect github.com/pion/dtls/v2 v2.2.12 // indirect @@ -203,7 +203,6 @@ require ( github.com/ipfs/go-cid v0.4.1 // indirect github.com/ipfs/go-cidutil v0.1.0 // indirect github.com/ipfs/go-datastore v0.8.2 // indirect - github.com/ipfs/go-ds-badger2 v0.1.4 // indirect github.com/ipfs/go-ipfs-delay v0.0.1 // indirect github.com/ipfs/go-ipfs-pq v0.0.3 // indirect github.com/ipfs/go-ipfs-util v0.0.3 // indirect @@ -263,11 +262,11 @@ require ( github.com/multiformats/go-varint v0.0.7 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect github.com/onflow/atree v0.10.1 // indirect - github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224 // indirect; v1.2.4-0.20230703193002-53362441b57d // indirect - github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224 // indirect; v1.2.3 // indirect + github.com/onflow/flow-core-contracts/lib/go/contracts v1.8.0 // indirect; v1.2.4-0.20230703193002-53362441b57d // indirect + github.com/onflow/flow-core-contracts/lib/go/templates v1.8.0 // indirect; v1.2.3 // indirect github.com/onflow/flow-ft/lib/go/contracts v1.0.1 // indirect github.com/onflow/flow-go-sdk v1.8.1 // indirect - github.com/onflow/flow-nft/lib/go/contracts v1.2.4 // indirect + github.com/onflow/flow-nft/lib/go/contracts v1.3.0 // indirect github.com/onflow/go-ethereum v1.16.2 // indirect github.com/onflow/sdks v0.6.0-preview.1 // indirect github.com/onflow/wal v1.0.2 // indirect diff --git a/go.sum b/go.sum index 54e82f5..1ac5021 100644 --- a/go.sum +++ b/go.sum @@ -540,8 +540,6 @@ github.com/ipfs/go-datastore v0.8.2 h1:Jy3wjqQR6sg/LhyY0NIePZC3Vux19nLtg7dx0TVqr github.com/ipfs/go-datastore v0.8.2/go.mod h1:W+pI1NsUsz3tcsAACMtfC+IZdnQTnC/7VfPoJBQuts0= github.com/ipfs/go-detect-race v0.0.1 h1:qX/xay2W3E4Q1U7d9lNs1sU9nvguX0a7319XbyQ6cOk= github.com/ipfs/go-detect-race v0.0.1/go.mod h1:8BNT7shDZPo99Q74BpGMK+4D8Mn4j46UU0LZ723meps= -github.com/ipfs/go-ds-badger2 v0.1.4 h1:4EDTEDV/Ft/zr5AaJXp2IojvApwevlUD9uahMDONWTE= -github.com/ipfs/go-ds-badger2 v0.1.4/go.mod h1:6WOt9PzJ98Tu7gizJ35NuXDORsYxQ3c4/3gjqF+kq0c= github.com/ipfs/go-ds-pebble v0.5.0 h1:lXffYCAKVD7nLLPqwJ9D8IxgO7Kz8woiX021tezdsIM= github.com/ipfs/go-ds-pebble v0.5.0/go.mod h1:aiCRVcj3K60sxc6k5C+HO9C6rouqiSkjR/WKnbTcMfQ= github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ= @@ -739,26 +737,26 @@ github.com/onflow/crypto v0.25.3 h1:XQ3HtLsw8h1+pBN+NQ1JYM9mS2mVXTyg55OldaAIF7U= github.com/onflow/crypto v0.25.3/go.mod h1:+1igaXiK6Tjm9wQOBD1EGwW7bYWMUGKtwKJ/2QL/OWs= github.com/onflow/fixed-point v0.1.1 h1:j0jYZVO8VGyk1476alGudEg7XqCkeTVxb5ElRJRKS90= github.com/onflow/fixed-point v0.1.1/go.mod h1:gJdoHqKtToKdOZbvryJvDZfcpzC7d2fyWuo3ZmLtcGY= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224 h1:YKdTSG+6uu+dZpKCB2fmNWOmKGLn7+0MxFbtUFZdBjc= -github.com/onflow/flow-core-contracts/lib/go/contracts v1.7.4-0.20250825173510-91e6f28b0224/go.mod h1:/Yne6g7V2Fy1sm/vE78us221bYvVvL5cA8cOzN/uTCI= -github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224 h1:6ZBTrqPQIbnek7mdtJwbQux87qcJPTz82DDgGhpsHzI= -github.com/onflow/flow-core-contracts/lib/go/templates v1.7.2-0.20250825173510-91e6f28b0224/go.mod h1:yBkysayvSKZ/yFO3fEX4YQ/FEZtV6Tnov8ix0lBeiqM= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.8.0 h1:Kq6MRKwmHfoTTDty/Ib7is1peaSMBQ2GHcnhDgsRH4c= +github.com/onflow/flow-core-contracts/lib/go/contracts v1.8.0/go.mod h1:h15J7unHnlTARjudbb0m5KO3EoHIucoBgShAqE6NoNA= +github.com/onflow/flow-core-contracts/lib/go/templates v1.8.0 h1:vcCIJP8vYuo0t77Hbxh2IEpGSZoEudB58Qpci11LSCE= +github.com/onflow/flow-core-contracts/lib/go/templates v1.8.0/go.mod h1:twSVyUt3rNrgzAmxtBX+1Gw64QlPemy17cyvnXYy1Ug= github.com/onflow/flow-evm-bridge v0.1.0 h1:7X2osvo4NnQgHj8aERUmbYtv9FateX8liotoLnPL9nM= github.com/onflow/flow-evm-bridge v0.1.0/go.mod h1:5UYwsnu6WcBNrwitGFxphCl5yq7fbWYGYuiCSTVF6pk= github.com/onflow/flow-ft/lib/go/contracts v1.0.1 h1:Ts5ob+CoCY2EjEd0W6vdLJ7hLL3SsEftzXG2JlmSe24= github.com/onflow/flow-ft/lib/go/contracts v1.0.1/go.mod h1:PwsL8fC81cjnUnTfmyL/HOIyHnyaw/JA474Wfj2tl6A= github.com/onflow/flow-ft/lib/go/templates v1.0.1 h1:FDYKAiGowABtoMNusLuRCILIZDtVqJ/5tYI4VkF5zfM= github.com/onflow/flow-ft/lib/go/templates v1.0.1/go.mod h1:uQ8XFqmMK2jxyBSVrmyuwdWjTEb+6zGjRYotfDJ5pAE= -github.com/onflow/flow-go v0.43.0-dev-pebble.1.0.20250910132853-12699a150fd9 h1:LzgHQI7A8rINyfzKEF6x2gsrzx7zGBQpmgdHJjJtQqM= -github.com/onflow/flow-go v0.43.0-dev-pebble.1.0.20250910132853-12699a150fd9/go.mod h1:VkvpX4p4imUpPR+FhL0Qw7Qx32zQ/QOQRz2Vl2uu50Y= +github.com/onflow/flow-go v0.43.0-rc.2 h1:U0yhR9asL/4tTIbGq7vrBEwUr6JFupNRySSRU4EM5jc= +github.com/onflow/flow-go v0.43.0-rc.2/go.mod h1:zz8rd/tod51kd33im9x6uDmGiyeb5qCZhKr7g01/wgI= github.com/onflow/flow-go-sdk v1.8.1 h1:BPp7p10RrpOdezQ3RJ+nheOqpalHlTB9bRocVkLsGNU= github.com/onflow/flow-go-sdk v1.8.1/go.mod h1:w6bxCznDhJJCDybn1jCUAz3rEO4/7XY9EgWRFrj0zoo= -github.com/onflow/flow-nft/lib/go/contracts v1.2.4 h1:gWJgSSgIGo0qWOqr90+khQ69VoYF9vNlqzF+Yh6YYy4= -github.com/onflow/flow-nft/lib/go/contracts v1.2.4/go.mod h1:eZ9VMMNfCq0ho6kV25xJn1kXeCfxnkhj3MwF3ed08gY= -github.com/onflow/flow-nft/lib/go/templates v1.2.1 h1:SAALMZPDw9Eb9p5kSLnmnFxjyig1MLiT4JUlLp0/bSE= -github.com/onflow/flow-nft/lib/go/templates v1.2.1/go.mod h1:W6hOWU0xltPqNpv9gQX8Pj8Jtf0OmRxc1XX2V0kzJaI= -github.com/onflow/flow/protobuf/go/flow v0.4.12 h1:nMJHVuz2iRQnzEwvmruCaMrQvm/dfdWtbKroi3o/42M= -github.com/onflow/flow/protobuf/go/flow v0.4.12/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= +github.com/onflow/flow-nft/lib/go/contracts v1.3.0 h1:DmNop+O0EMyicZvhgdWboFG57xz5t9Qp81FKlfKyqJc= +github.com/onflow/flow-nft/lib/go/contracts v1.3.0/go.mod h1:eZ9VMMNfCq0ho6kV25xJn1kXeCfxnkhj3MwF3ed08gY= +github.com/onflow/flow-nft/lib/go/templates v1.3.0 h1:uGIBy4GEY6Z9hKP7sm5nA5kwvbvLWW4nWx5NN9Wg0II= +github.com/onflow/flow-nft/lib/go/templates v1.3.0/go.mod h1:gVbb5fElaOwKhV5UEUjM+JQTjlsguHg2jwRupfM/nng= +github.com/onflow/flow/protobuf/go/flow v0.4.15 h1:7Xt7kkqeeygWMw/S327uKu11FPJghNm1pvam2HXbC7g= +github.com/onflow/flow/protobuf/go/flow v0.4.15/go.mod h1:NA2pX2nw8zuaxfKphhKsk00kWLwfd+tv8mS23YXO4Sk= github.com/onflow/go-ethereum v1.16.2 h1:yhC3DA5PTNmUmu7ziq8GmWyQ23KNjle4jCabxpKYyNk= github.com/onflow/go-ethereum v1.16.2/go.mod h1:1vsrG/9APHPqt+mVFni60hIXkqkVdU9WQayNjYi/Ah4= github.com/onflow/nft-storefront/lib/go/contracts v1.0.0 h1:sxyWLqGm/p4EKT6DUlQESDG1ZNMN9GjPCm1gTq7NGfc= diff --git a/rosetta_handler.py b/rosetta_handler.py index 50e7377..6250b10 100644 --- a/rosetta_handler.py +++ b/rosetta_handler.py @@ -11,6 +11,10 @@ def cli(): pass +network_identifier = { + "blockchain": "flow", + "network": "localnet", +} # Shared function used internally but not standalone from CLI @@ -24,10 +28,7 @@ def preprocess_transaction(rosetta_host_url, root_originator, operations, metada endpoint = "/construction/preprocess" target_url = rosetta_host_url + endpoint data = { - "network_identifier": { - "blockchain": "flow", - "network": "localnet" - }, + "network_identifier": network_identifier, "operations": operations, "metadata": { "payer": root_originator @@ -36,17 +37,17 @@ def preprocess_transaction(rosetta_host_url, root_originator, operations, metada if metadata: for key in metadata: data["metadata"][key] = metadata[key] - return request_router(target_url, data) + result = request_router(target_url, data) + if "options" not in result: + raise RuntimeError(result) + return result def metadata_transaction(rosetta_host_url, options): endpoint = "/construction/metadata" target_url = rosetta_host_url + endpoint data = { - "network_identifier": { - "blockchain": "flow", - "network": "localnet" - }, + "network_identifier": network_identifier, "options": options } return request_router(target_url, data) @@ -56,10 +57,7 @@ def payloads_transaction(rosetta_host_url, operations, protobuf): endpoint = "/construction/payloads" target_url = rosetta_host_url + endpoint data = { - "network_identifier": { - "blockchain": "flow", - "network": "localnet" - }, + "network_identifier": network_identifier, "operations": operations, "metadata": { "protobuf": protobuf @@ -72,10 +70,7 @@ def combine_transaction(rosetta_host_url, unsigned_tx, root_originator, hex_byte endpoint = "/construction/combine" target_url = rosetta_host_url + endpoint data = { - "network_identifier": { - "blockchain": "flow", - "network": "localnet" - }, + "network_identifier": network_identifier, "unsigned_transaction": unsigned_tx, "signatures": [ { @@ -103,10 +98,7 @@ def submit_transaction(rosetta_host_url, signed_tx): endpoint = "/construction/submit" target_url = rosetta_host_url + endpoint data = { - "network_identifier": { - "blockchain": "flow", - "network": "localnet" - }, + "network_identifier": network_identifier, "signed_transaction": signed_tx } return request_router(target_url, data) diff --git a/state/state.go b/state/state.go index c5e04bf..6019aa5 100644 --- a/state/state.go +++ b/state/state.go @@ -15,7 +15,6 @@ import ( "sync" "time" - "github.com/dgraph-io/badger/v2" flowcrypto "github.com/onflow/crypto" "github.com/onflow/flow-go/cmd/bootstrap/utils" hotstuff "github.com/onflow/flow-go/consensus/hotstuff/model" @@ -25,13 +24,15 @@ import ( "github.com/onflow/flow-go/module/compliance" "github.com/onflow/flow-go/storage" "github.com/onflow/flow-go/storage/operation" - "github.com/onflow/flow-go/storage/operation/badgerimpl" + "github.com/onflow/flow-go/storage/operation/pebbleimpl" + "github.com/onflow/flow-go/storage/pebble" "github.com/onflow/rosetta/cache" "github.com/onflow/rosetta/config" "github.com/onflow/rosetta/indexdb" "github.com/onflow/rosetta/log" "github.com/onflow/rosetta/model" "github.com/onflow/rosetta/process" + zerolog "github.com/rs/zerolog/log" "golang.org/x/crypto/openpgp" "golang.org/x/crypto/openpgp/armor" "google.golang.org/grpc/codes" @@ -636,12 +637,19 @@ func (i *Indexer) runConsensusFollower(ctx context.Context) { sporkDir := i.Chain.PathFor(spork.String()) i.downloadRootState(ctx, spork, sporkDir) dbDir := filepath.Join(sporkDir, "consensus") - opts := badger.DefaultOptions(dbDir).WithLogger(log.Badger{Prefix: "consensus"}) - db, err := badger.Open(opts) + + dbLog := zerolog.With().Str("pebbledb", "consensusFollower").Logger() + db, err := pebble.SafeOpen(dbLog, dbDir) if err != nil { log.Fatalf("Failed to open consensus database at %s: %s", dbDir, err) } - protocolDB := badgerimpl.ToDB(db) + process.SetExitHandler(func() { + log.Infof("Closing the consensus follower database") + if err := db.Close(); err != nil { + log.Errorf("Got error closing the consensus follower database: %s", err) + } + }) + protocolDB := pebbleimpl.ToDB(db) // Initialize a private key for joining the unstaked peer-to-peer network. // This can be ephemeral, so we generate a new one each time we start. seed := make([]byte, flowcrypto.KeyGenSeedMinLen) @@ -657,11 +665,11 @@ func (i *Indexer) runConsensusFollower(ctx context.Context) { for _, node := range spork.Consensus.SeedNodes { rawkey, err := hex.DecodeString(node.PublicKey) if err != nil { - log.Fatalf("Failed to hex decode the seed node key %q: %s", key, err) + log.Fatalf("Failed to hex decode the seed node key %q: %s", node.PublicKey, err) } pubkey, err := flowcrypto.DecodePublicKey(flowcrypto.ECDSAP256, rawkey) if err != nil { - log.Fatalf("Failed to decode the seed node key %q: %s", key, err) + log.Fatalf("Failed to decode the seed node key %q: %s", rawkey, err) } nodes = append(nodes, follower.BootstrapNodeInfo{ Host: node.Host,