-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switched out originator account creation from python script to Makefi…
…le to make it more CI friendly and implement less code
- Loading branch information
1 parent
f51c5d0
commit a0979fb
Showing
4 changed files
with
150 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,76 @@ | ||
.PHONY: all build | ||
# Set default values | ||
ACCOUNT_KEYS_FILENAME = "./account-keys.csv" | ||
FLOW_JSON = "script/flow.json" | ||
FLOW_JSON_NETWORK = "emulator" | ||
FLOW_JSON_SIGNER = emulator-account | ||
FLOW_CLI_FLAGS = -n $(FLOW_JSON_NETWORK) -f $(FLOW_JSON) --signer $(FLOW_JSON_SIGNER) | ||
ROSETTA_NETWORK = "localnet" | ||
ROSETTA_HOST_URL = "http://127.0.0.1:8080" | ||
COMPILER_FLAGS := CGO_CFLAGS="-O2 -D__BLST_PORTABLE__" | ||
|
||
.PHONY: all build | ||
all: build | ||
|
||
.PHONY: go-build | ||
go-build: | ||
go build -o server cmd/server/server.go | ||
${COMPILER_FLAGS} go build -o server cmd/server/server.go | ||
|
||
|
||
.PHONY: gen-originator-account | ||
gen-originator-account: | ||
set -e; \ | ||
KEYS=$$(go run ./cmd/genkey/genkey.go -csv); \ | ||
PUBLIC_FLOW_KEY=$$(echo $$KEYS | cut -d',' -f1); \ | ||
PUBLIC_ROSETTA_KEY=$$(echo $$KEYS | cut -d',' -f2); \ | ||
PRIVATE_KEY=$$(echo $$KEYS | cut -d',' -f3); \ | ||
echo "Created keys:"; \ | ||
echo "Flow Key: $$PUBLIC_FLOW_KEY"; \ | ||
echo "Rosetta Key: $$PUBLIC_ROSETTA_KEY"; \ | ||
echo "Private Key: $$PRIVATE_KEY"; \ | ||
address=$$(flow accounts create --sig-algo ECDSA_secp256k1 --key $$PUBLIC_FLOW_KEY $(FLOW_CLI_FLAGS) | grep "Address" | cut -d' ' -f2 | cut -c3-);\ | ||
echo "Address created: $$address"; \ | ||
jq --arg account_name "$(ACCOUNT_NAME)" '.accounts[$$account_name] = { \ | ||
"address": "'$$address'", \ | ||
"key": { \ | ||
"type": "hex", \ | ||
"index": 0, \ | ||
"signatureAlgorithm": "ECDSA_secp256k1", \ | ||
"hashAlgorithm": "SHA3_256", \ | ||
"privateKey": "'$$PRIVATE_KEY'" \ | ||
} \ | ||
}' "${FLOW_JSON}" > flow.json.tmp && mv flow.json.tmp "${FLOW_JSON}" || { echo "Failed to update flow.json with jq"; exit 1; }; \ | ||
echo "$(ACCOUNT_NAME),$$KEYS,$$address" >> $(ACCOUNT_KEYS_FILENAME); \ | ||
echo "Updated $(FLOW_JSON) and $(ACCOUNT_KEYS_FILENAME)"; | ||
|
||
.PHONY: build | ||
build: go-build | ||
|
||
.PHONY: deps | ||
deps: | ||
go mod download -x | ||
|
||
.PHONY: fix-lint | ||
fix-lint: | ||
golangci-lint run -v --fix ./... | ||
|
||
.PHONY: lint | ||
lint: | ||
@go mod tidy | ||
@staticcheck ./... | ||
|
||
.PHONY: proto | ||
proto: | ||
@echo ">> Generating model/model.pb.go" | ||
@protoc --proto_path=model --go_out=model \ | ||
--go_opt=paths=source_relative model/model.proto | ||
|
||
.PHONY: integration-test-cleanup | ||
integration-test-cleanup: | ||
rm -f flow.json | ||
rm -f account-keys.csv | ||
rm -rf data | ||
rm -rf flow-go | ||
|
||
.PHONY: integration-test | ||
integration-test: | ||
python3 integration_test.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,59 @@ | ||
{ | ||
"emulators": { | ||
"default": { | ||
"port": 3569, | ||
"serviceAccount": "emulator-account" | ||
} | ||
}, | ||
"contracts": {}, | ||
"networks": { | ||
"emulator": "127.0.0.1:3569", | ||
"mainnet": "access.mainnet.nodes.onflow.org:9000", | ||
"testnet": "access.devnet.nodes.onflow.org:9000" | ||
}, | ||
"accounts": { | ||
"emulator-account": { | ||
"address": "f8d6e0586b0a20c7", | ||
"key": "91a22fbd87392b019fbe332c32695c14cf2ba5b6521476a8540228bdf1987068" | ||
} | ||
}, | ||
"deployments": {} | ||
} | ||
"emulators": { | ||
"default": { | ||
"port": 3569, | ||
"serviceAccount": "emulator-account" | ||
} | ||
}, | ||
"contracts": {}, | ||
"networks": { | ||
"emulator": "127.0.0.1:3569", | ||
"testing": "127.0.0.1:3569", | ||
"localnet": "192.168.1.186:4001", | ||
"mainnet": "access.mainnet.nodes.onflow.org:9000", | ||
"testnet": "access.devnet.nodes.onflow.org:9000" | ||
}, | ||
"accounts": { | ||
"emulator-account": { | ||
"address": "f8d6e0586b0a20c7", | ||
"key": { | ||
"type": "hex", | ||
"index": 0, | ||
"signatureAlgorithm": "ECDSA_P256", | ||
"hashAlgorithm": "SHA3_256", | ||
"privateKey": "04264ea6342c0dae476c7b7d327e8ba369e605db8314758f7af7bab790ec787b" | ||
} | ||
}, | ||
"localnet-service-account": { | ||
"address": "f8d6e0586b0a20c7", | ||
"key": { | ||
"type": "hex", | ||
"index": 0, | ||
"signatureAlgorithm": "ECDSA_P256", | ||
"hashAlgorithm": "SHA2_256", | ||
"privateKey": "8ae3d0461cfed6d6f49bfc25fa899351c39d1bd21fdba8c87595b6c49bb4cc43" | ||
} | ||
}, | ||
"root-originator-account-1": { | ||
"address": "1beecc6fef95b62e", | ||
"key": { | ||
"type": "hex", | ||
"index": 0, | ||
"signatureAlgorithm": "ECDSA_secp256k1", | ||
"hashAlgorithm": "SHA3_256", | ||
"privateKey": "f0cd40495618388f333147b8b6b6be8ef5b279aed520ffa256fcb2a73cba6227" | ||
} | ||
}, | ||
"root-originator-account-2": { | ||
"address": "ff8975b2fe6fb6f1", | ||
"key": { | ||
"type": "hex", | ||
"index": 0, | ||
"signatureAlgorithm": "ECDSA_secp256k1", | ||
"hashAlgorithm": "SHA3_256", | ||
"privateKey": "4dd3d8b317934a4101c15bd1944e89f77d7062a4ad1f4b24d39191f036c9f7bd" | ||
} | ||
} | ||
}, | ||
"deployments": {} | ||
} |