guardian Set Index stored at global var now.

This commit is contained in:
Hernán Di Pietro 2021-11-17 11:15:39 -03:00
parent 8bd8218d2d
commit b93fe26905
2 changed files with 14 additions and 4 deletions

View File

@ -1,3 +1,10 @@
/**
*
* Pricecaster Service Utility Library.
* (c) 2021-22 Randlabs, Inc.
*
*/
const algosdk = require('algosdk')
const fs = require('fs')
// eslint-disable-next-line camelcase
@ -231,7 +238,7 @@ class PricecasterLib {
this.createVaaProcessorApp = async function (sender, gexpTime, gkeys, signCallback) {
const localInts = 0
const localBytes = 0
const globalInts = 2
const globalInts = 4
const globalBytes = 20
// declare onComplete as NoOp
@ -544,7 +551,7 @@ class PricecasterLib {
* @param {*} gksubset An hex string containing the keys for the guardian subset in this step.
* @param {*} totalguardians The total number of known guardians.
*/
this.addVerifyTx = async function (sender, payload, gksubset, totalguardians) {
this.addVerifyTx = function (sender, payload, gksubset, totalguardians) {
const appArgs = []
appArgs.push(new Uint8Array(Buffer.from(gksubset, 'hex')), algosdk.encodeUint64(parseInt(totalguardians)))
this.groupTx.push(algosdk.makeApplicationNoOpTxn(sender,

View File

@ -77,8 +77,10 @@ VAA_RECORD_EMITTER_ADDR_LEN = 32
@Subroutine(TealType.uint64)
# Bootstrap with the initial list of guardians packed in first argument.
# Expiration time in second argument.
# Arg0: Bootstrap with the initial list of guardians packed.
# Arg1: Expiration time in second argument.
# Arg2: Guardian set Index.
#
# Guardian public keys are 20-bytes wide, so
# using arguments a maximum 1000/20 ~ 200 public keys can be specified in this version.
def bootstrap():
@ -97,6 +99,7 @@ def bootstrap():
),
App.globalPut(Bytes("gscount"), guardian_count.load()),
App.globalPut(Bytes("gsexp"), Btoi(Txn.application_args[1])),
App.globalPut(Bytes("gsindex"), Btoi(Txn.application_args[2])),
App.globalPut(Bytes("vssize"), Int(MAX_SIGNATURES_PER_VERIFICATION_STEP)),
Approve()
])