From 45a7d6174d7ad8fc45fde2010f120e0241746d6a Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 28 Apr 2023 13:09:18 -0700 Subject: [PATCH 1/3] Replace ContractAuth addressWithNonce option with explicit union --- Stellar-transaction.x | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Stellar-transaction.x b/Stellar-transaction.x index d4ad0d9..9e8ffb6 100644 --- a/Stellar-transaction.x +++ b/Stellar-transaction.x @@ -540,9 +540,23 @@ struct AddressWithNonce uint64 nonce; }; +enum AuthorizerType +{ + AUTHORIZER_SOURCE_ACCOUNT = 0, + AUTHORIZER_ADDRESS = 1, +}; + +union Authorizer switch (AuthorizerType type) +{ +case AUTHORIZER_SOURCE_ACCOUNT: + void; +case AUTHORIZER_ADDRESS: + AddressWithNonce address; +}; + struct ContractAuth { - AddressWithNonce* addressWithNonce; // not present for invoker + Authorizer authorizer; AuthorizedInvocation rootInvocation; SCVec signatureArgs; }; From ea3a888f768594112844d2663da36dc3b7d7bf59 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 28 Apr 2023 14:21:44 -0700 Subject: [PATCH 2/3] Move signatureArgs into Authorizer --- Stellar-transaction.x | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Stellar-transaction.x b/Stellar-transaction.x index 9e8ffb6..2786e19 100644 --- a/Stellar-transaction.x +++ b/Stellar-transaction.x @@ -534,10 +534,11 @@ struct AuthorizedInvocation AuthorizedInvocation subInvocations<>; }; -struct AddressWithNonce +struct AddressAuthorizer { SCAddress address; uint64 nonce; + SCVec signatureArgs; }; enum AuthorizerType @@ -551,14 +552,13 @@ union Authorizer switch (AuthorizerType type) case AUTHORIZER_SOURCE_ACCOUNT: void; case AUTHORIZER_ADDRESS: - AddressWithNonce address; + AddressAuthorizer address; }; struct ContractAuth { Authorizer authorizer; AuthorizedInvocation rootInvocation; - SCVec signatureArgs; }; struct HostFunction { From 89578bfa82606fd8c7e70743664c7ab3022ee94b Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 23 May 2023 10:04:46 -0700 Subject: [PATCH 3/3] rename --- Stellar-transaction.x | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/Stellar-transaction.x b/Stellar-transaction.x index 9b4ff28..e154b6b 100644 --- a/Stellar-transaction.x +++ b/Stellar-transaction.x @@ -534,44 +534,30 @@ struct AuthorizedInvocation AuthorizedInvocation subInvocations<>; }; -struct AddressAuthorizer +struct AddressAuthorization { SCAddress address; uint64 nonce; SCVec signatureArgs; }; -enum AuthorizerType +enum AuthorizationType { - AUTHORIZER_SOURCE_ACCOUNT = 0, - AUTHORIZER_ADDRESS = 1, + AUTHORIZATION_SOURCE_ACCOUNT = 0, + AUTHORIZATION_ADDRESS = 1, }; -union Authorizer switch (AuthorizerType type) +union Authorization switch (AuthorizationType type) { -case AUTHORIZER_SOURCE_ACCOUNT: +case AUTHORIZATION_SOURCE_ACCOUNT: void; -case AUTHORIZER_ADDRESS: - AddressAuthorizer address; -}; - -enum AuthorizerType -{ - AUTHORIZER_SOURCE_ACCOUNT = 0, - AUTHORIZER_ADDRESS = 1, -}; - -union Authorizer switch (AuthorizerType type) -{ -case AUTHORIZER_SOURCE_ACCOUNT: - void; -case AUTHORIZER_ADDRESS: - AddressWithNonce address; +case AUTHORIZATION_ADDRESS: + AddressAuthorization address; }; struct ContractAuth { - Authorizer authorizer; + Authorization authorizer; AuthorizedInvocation rootInvocation; };