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

Cannot get signers of current transaction #2825

Closed
merl111 opened this issue Oct 19, 2022 · 2 comments · Fixed by #2827
Closed

Cannot get signers of current transaction #2825

merl111 opened this issue Oct 19, 2022 · 2 comments · Fixed by #2827

Comments

@merl111
Copy link

merl111 commented Oct 19, 2022

Describe the bug
The native Ledger contract has a method called GetTransactionSigners, which should return a Singer[], for the current executing transaction it returns null though. I am not sure if that's on purpose or not, if it is on purpose, maybe we can expose the signers also on the transaction I can get from Runtime.ScriptContainer.

To Reproduce

using System;
using System.Numerics;
using Neo;
using Neo.SmartContract.Framework;
using Neo.SmartContract.Framework.Native;
using Neo.SmartContract.Framework.Services;

namespace GhostMarket.Exchange;

public class TestContract : SmartContract
{
    public static bool GetSigners()
    {
        var tx = (Transaction)Runtime.ScriptContainer;
        var signers = Ledger.GetTransactionSigners(tx.Hash);
        if (signers == null)
        {
            // for demonstration purposes only
            throw new Exception("signers array is null");
        }


        return true;
    }
}

Expected behavior
Above example contract should not throw the exception, but return true.

Platform:

  • Linux x64
  • Neo.Smartcontract.Framework 3.4.0
  • Neo Express 3.4.18+f8b893e693
@roman-khimov
Copy link
Contributor

That's the same behavior as #2568, it's an intended one for the native Ledger contract. But I agree that this creates some interface asymmetry, it can be solved with another Runtime syscall.

@shargon
Copy link
Member

shargon commented Oct 20, 2022

We can fix it with the ScriptContainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants