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

Allow LogicSigs to sign txns with a different AuthAddr #268

Merged
merged 2 commits into from
Feb 10, 2021

Conversation

jasonpaulos
Copy link
Contributor

Currently if you attempt to use the signLogicSigTransaction function to make a LogicSig contract account sign a transaction whose sender is not the LogicSig's computed address, an error will be thrown. This means that sending transactions form an account rekeyed to a LogicSig is not possible.

This PR fixes this issue by allowing non-delegated LogicSigs to sign transactions from any address, adding in the AuthAddr field to the signed transaction if necessary.

@jasonpaulos jasonpaulos self-assigned this Jan 20, 2021
@ian-algorand ian-algorand added this to the Sprint 17 milestone Jan 25, 2021
const actual = algosdk.signLogicSigTransaction(txn, lsig);
const expected = {
txID: 'A6G4CMEV7QHLTMWDGU6BRYYVG3IXSSFTVDISEPALUHKIP4DNHQ4A',
blob: new Uint8Array(Buffer.from('g6Rsc2lngaFsxAUBIAEBIqRzZ25yxCD2di2sdbGZfWwslhgGgFB0kNeVES/+f7dgsnOK+cfxraN0eG6Ko2FtdM0DT6NmZWXNCniiZnYzomdoxCAmCyAJoJOohot5WHIvpeVG7eftF+TYXEx4r7BFJpDt0qJsdj2kbm90ZcQDewzIo3JjdsQgoImqaSLjuZj63/bNSAjd+eAh5JROOJ6j1cY4eGaJGX6lcmVrZXnEIDAhUOuXI/Dnhg1MAE4rbltxOOB+7lUduJbsxucZf2DUo3NuZMQguw62NBVKGAtqJ03XdSlcNtO6eq5rXbDMEMVGLbDzMN+kdHlwZaNwYXk=', 'base64')),
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this address do the right thing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the lsig's address is 6Z3C3LDVWGMX23BMSYMANACQOSINPFIRF77H7N3AWJZYV6OH6GWTJKVMXY, and since the transaction's sender is different we should expect the signed transaction to contain a AuthAddr/sgnr field with the lsig's address.

This is the decoded expected txn g6Rs...:

{
  "lsig": {
    "l": "// version 1\nintcblock 1\nintc_0\n"
  },
  "sgnr": "6Z3C3LDVWGMX23BMSYMANACQOSINPFIRF77H7N3AWJZYV6OH6GWTJKVMXY",
  "txn": {
    "amt": 847,
    "fee": 2680,
    "fv": 51,
    "gh": "JgsgCaCTqIaLeVhyL6XlRu3n7Rfk2FxMeK+wRSaQ7dI=",
    "lv": 61,
    "note": "ewzI",
    "rcv": "UCE2U2JC4O4ZR6W763GUQCG57HQCDZEUJY4J5I6VYY4HQZUJDF7AKZO5GM",
    "rekey": "GAQVB24XEPYOPBQNJQAE4K3OLNYTRYD65ZKR3OEW5TDOOGL7MDKABXHHTM",
    "snd": "XMHLMNAVJIMAW2RHJXLXKKK4G3J3U6VONNO3BTAQYVDC3MHTGDP3J5OCRU",
    "type": "pay"
  }
}

src/logicsig.js Outdated Show resolved Hide resolved
@jasonpaulos jasonpaulos merged commit 44cc595 into develop Feb 10, 2021
@jasonpaulos jasonpaulos deleted the jason/allow-logicsig-rekey branch February 10, 2021 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants