Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Proof of Possession for Node Staking Keys #457

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/go/templates/cmd/manifest/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ func generateManifest(env templates.Environment) *manifest {
))

m.addTemplate(generateTemplate(
"SCO.17", "Register Node with PoP",
"SCO.17", "Register Node",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A wallet would use SCO.03 or SCO.17 but not both at the same time. SCO.17 is just the new "Register Node" transaction.

env,
templates.GenerateCollectionRegisterNode,
[]argument{
Expand Down
2 changes: 1 addition & 1 deletion lib/go/templates/manifest.mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@
},
{
"id": "SCO.17",
"name": "Register Node with PoP",
"name": "Register Node",
"source": "import Crypto\nimport FlowStakingCollection from 0x8d0e87b65159ae63\n\n/// Registers a delegator in the staking collection resource\n/// for the specified node information and the amount of tokens to commit\n\ntransaction(id: String,\n role: UInt8,\n networkingAddress: String,\n networkingKey: String,\n stakingKey: String,\n stakingKeyPoP: String,\n amount: UFix64,\n machineAccountKey: String, \n machineAccountKeySignatureAlgorithm: UInt8, \n machineAccountKeyHashAlgorithm: UInt8) {\n\n let stakingCollectionRef: auth(FlowStakingCollection.CollectionOwner) \u0026FlowStakingCollection.StakingCollection\n\n prepare(account: auth(BorrowValue) \u0026Account) {\n pre {\n\t\t\tmachineAccountKeySignatureAlgorithm == 1 || machineAccountKeySignatureAlgorithm == 2:\n \"Cannot register node with provided machine account key: Must provide a signature algorithm raw value that corresponds to \"\n .concat(\"one of the available signature algorithms for Flow keys.\")\n .concat(\"You provided \").concat(machineAccountKeySignatureAlgorithm.toString())\n .concat(\" but the options are either 1 (ECDSA_P256) or 2 (ECDSA_secp256k1).\")\n\t\t\tmachineAccountKeyHashAlgorithm == 1 || machineAccountKeyHashAlgorithm == 3:\n \"Cannot register node with provided machine account key: Must provide a hash algorithm raw value that corresponds to \"\n .concat(\"one of of the available hash algorithms for Flow keys.\")\n .concat(\"You provided \").concat(machineAccountKeyHashAlgorithm.toString())\n .concat(\" but the options are either 1 (SHA2_256) or 3 (SHA3_256).\")\n\t\t}\n\n self.stakingCollectionRef = account.storage.borrow\u003cauth(FlowStakingCollection.CollectionOwner) \u0026FlowStakingCollection.StakingCollection\u003e(from: FlowStakingCollection.StakingCollectionStoragePath)\n ?? panic(FlowStakingCollection.getCollectionMissingError(nil))\n\n if let machineAccount = self.stakingCollectionRef.registerNode(\n id: id,\n role: role,\n networkingAddress: networkingAddress,\n networkingKey: networkingKey,\n stakingKey: stakingKey,\n stakingKeyPoP: stakingKeyPoP,\n amount: amount,\n payer: account\n ) {\n let sigAlgo = SignatureAlgorithm(rawValue: machineAccountKeySignatureAlgorithm)!\n\n let hashAlgo = HashAlgorithm(rawValue: machineAccountKeyHashAlgorithm)!\n \n let publicKey = PublicKey(\n\t\t\t publicKey: machineAccountKey.decodeHex(),\n\t\t\t signatureAlgorithm: sigAlgo\n\t\t )\n machineAccount.keys.add(publicKey: publicKey, hashAlgorithm: hashAlgo, weight: 1000.0)\n }\n }\n}\n",
"arguments": [
{
Expand Down
2 changes: 1 addition & 1 deletion lib/go/templates/manifest.testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -1119,7 +1119,7 @@
},
{
"id": "SCO.17",
"name": "Register Node with PoP",
"name": "Register Node",
"source": "import Crypto\nimport FlowStakingCollection from 0x95e019a17d0e23d7\n\n/// Registers a delegator in the staking collection resource\n/// for the specified node information and the amount of tokens to commit\n\ntransaction(id: String,\n role: UInt8,\n networkingAddress: String,\n networkingKey: String,\n stakingKey: String,\n stakingKeyPoP: String,\n amount: UFix64,\n machineAccountKey: String, \n machineAccountKeySignatureAlgorithm: UInt8, \n machineAccountKeyHashAlgorithm: UInt8) {\n\n let stakingCollectionRef: auth(FlowStakingCollection.CollectionOwner) \u0026FlowStakingCollection.StakingCollection\n\n prepare(account: auth(BorrowValue) \u0026Account) {\n pre {\n\t\t\tmachineAccountKeySignatureAlgorithm == 1 || machineAccountKeySignatureAlgorithm == 2:\n \"Cannot register node with provided machine account key: Must provide a signature algorithm raw value that corresponds to \"\n .concat(\"one of the available signature algorithms for Flow keys.\")\n .concat(\"You provided \").concat(machineAccountKeySignatureAlgorithm.toString())\n .concat(\" but the options are either 1 (ECDSA_P256) or 2 (ECDSA_secp256k1).\")\n\t\t\tmachineAccountKeyHashAlgorithm == 1 || machineAccountKeyHashAlgorithm == 3:\n \"Cannot register node with provided machine account key: Must provide a hash algorithm raw value that corresponds to \"\n .concat(\"one of of the available hash algorithms for Flow keys.\")\n .concat(\"You provided \").concat(machineAccountKeyHashAlgorithm.toString())\n .concat(\" but the options are either 1 (SHA2_256) or 3 (SHA3_256).\")\n\t\t}\n\n self.stakingCollectionRef = account.storage.borrow\u003cauth(FlowStakingCollection.CollectionOwner) \u0026FlowStakingCollection.StakingCollection\u003e(from: FlowStakingCollection.StakingCollectionStoragePath)\n ?? panic(FlowStakingCollection.getCollectionMissingError(nil))\n\n if let machineAccount = self.stakingCollectionRef.registerNode(\n id: id,\n role: role,\n networkingAddress: networkingAddress,\n networkingKey: networkingKey,\n stakingKey: stakingKey,\n stakingKeyPoP: stakingKeyPoP,\n amount: amount,\n payer: account\n ) {\n let sigAlgo = SignatureAlgorithm(rawValue: machineAccountKeySignatureAlgorithm)!\n\n let hashAlgo = HashAlgorithm(rawValue: machineAccountKeyHashAlgorithm)!\n \n let publicKey = PublicKey(\n\t\t\t publicKey: machineAccountKey.decodeHex(),\n\t\t\t signatureAlgorithm: sigAlgo\n\t\t )\n machineAccount.keys.add(publicKey: publicKey, hashAlgorithm: hashAlgo, weight: 1000.0)\n }\n }\n}\n",
"arguments": [
{
Expand Down
Loading