diff --git a/go.mod b/go.mod index bd2d4db5..a45c1f64 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/certusone/yubihsm-go v0.3.0 github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 github.com/ecadlabs/goblst v1.0.0 - github.com/ecadlabs/gotez/v2 v2.1.2 + github.com/ecadlabs/gotez/v2 v2.1.3 github.com/go-playground/validator/v10 v10.16.0 github.com/google/tink/go v1.7.0 github.com/google/uuid v1.4.0 diff --git a/go.sum b/go.sum index 835fea97..154e0d01 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etly github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/ecadlabs/goblst v1.0.0 h1:8/e3SQGwqbV0+ul+pg0aSNFfC3lgQcvEed3VdDBXSl8= github.com/ecadlabs/goblst v1.0.0/go.mod h1:s67gqaOol9o6fguh+evH75X5uQniOhv1HG/EU8xPLPY= -github.com/ecadlabs/gotez/v2 v2.1.2 h1:6VVORG5cFhHsTLbJ5X5SxmK6OnlpmVM5iEOXQNTm5Z4= -github.com/ecadlabs/gotez/v2 v2.1.2/go.mod h1:QypK0m1eDPmB9R7Uvgmsfm+JS7Z5Y6dIbIq1tMVYayU= +github.com/ecadlabs/gotez/v2 v2.1.3 h1:RGNtvb+UAtstTQYCsdE4XAeaEZwj3a5AliLluEOsoAg= +github.com/ecadlabs/gotez/v2 v2.1.3/go.mod h1:QypK0m1eDPmB9R7Uvgmsfm+JS7Z5Y6dIbIq1tMVYayU= github.com/ecadlabs/pretty v0.0.0-20230412124801-f948fc689a04 h1:7WdblGykGxtGGtchW4kzTaJJO8Fm+JKhLzhttOOWr9k= github.com/ecadlabs/pretty v0.0.0-20230412124801-f948fc689a04/go.mod h1:VApUlocsLMpp4hUXHxTTIlosebnwo0BM6e1hy78qTPM= github.com/enceve/crypto v0.0.0-20160707101852-34d48bb93815 h1:D22EM5TeYZJp43hGDx6dUng8mvtyYbB9BnE3+BmJR1Q= diff --git a/pkg/signatory/signatory.go b/pkg/signatory/signatory.go index 2d8d1175..d28c263c 100644 --- a/pkg/signatory/signatory.go +++ b/pkg/signatory/signatory.go @@ -143,7 +143,7 @@ func (s *Signatory) logger() log.FieldLogger { } var defaultPolicy = PublicKeyPolicy{ - AllowedRequests: []string{"block", "preendorsement", "endorsement"}, + AllowedRequests: []string{"block", "preattestation", "attestation"}, } func (s *Signatory) fetchPolicyOrDefault(keyHash crypt.PublicKeyHash) *PublicKeyPolicy { @@ -596,6 +596,18 @@ func (s *Signatory) Ready(ctx context.Context) (bool, error) { return true, nil } +func fixupRequests(req []string) { + for i := range req { + switch req[i] { + case "endorsement": + req[i] = "attestation" + case "preendorsement": + req[i] = "preattestation" + } + } + sort.Strings(req) +} + // PreparePolicy prepares policy data by hashing keys etc func PreparePolicy(src config.TezosConfig) (out Policy, err error) { policy := make(Policy, len(src)) @@ -614,7 +626,7 @@ func PreparePolicy(src config.TezosConfig) (out Policy, err error) { for req := range v.Allow { pol.AllowedRequests = append(pol.AllowedRequests, req) } - sort.Strings(pol.AllowedRequests) + fixupRequests(pol.AllowedRequests) if ops, ok := v.Allow["generic"]; ok { pol.AllowedOps = make([]string, len(ops)) @@ -625,7 +637,7 @@ func PreparePolicy(src config.TezosConfig) (out Policy, err error) { if v.AllowedOperations != nil { pol.AllowedRequests = make([]string, len(v.AllowedOperations)) copy(pol.AllowedRequests, v.AllowedOperations) - sort.Strings(pol.AllowedRequests) + fixupRequests(pol.AllowedRequests) } if v.AllowedKinds != nil { pol.AllowedOps = make([]string, len(v.AllowedKinds))