make-software / casper-net-sdk

.NET SDK to interact with the Casper Network nodes via RPC
Apache License 2.0
13 stars 14 forks source link

Generate Secp256k1 #46

Open stormeye2000 opened 1 year ago

stormeye2000 commented 1 year ago

What happened?

A Secp256k1 account is created and funded via the faucet account A transfer is deployed with the new account as the approver The deploy result is returned and the approval account is analysed The signer contains the algorithm type ED25519

What did you expect to happen?

The signer contains the algorithm type Secp256k1

Thanks

Carl Norburn

davidatwhiletrue commented 1 year ago

hey @stormeye2000 . Can you share a deploy hash for which the SDK behaves as described? Thanks.

stormeye2000 commented 1 year ago

Hi David, I've attached the deploy for a failed Secp256k1 algorithm check

The feature is here

And the code here

Thanks

deploy-Secp256k1.json.zip

davidatwhiletrue commented 1 year ago

hi @stormeye2000 , the deploy is correct. I see the problem is in this assert:

    public async Task ThenTheTransferApprovalsSignerContainsTheAlgo(string algo) {
        WriteLine("the transfer approvals signer contains the {0} algo", algo);

        var matchingBlockHash =  _contextMap.Get<BlockAdded>(StepConstants.LAST_BLOCK_ADDED);

        var block = await GetCasperService().GetBlock(matchingBlockHash.BlockHash);

        Assert.That(block, Is.Not.Null);
        Assert.That(block.Parse().Block.Body.Proposer.PublicKey.KeyAlgorithm.ToString(), Is.EqualTo(algo.ToUpper()));

    }

Last assert is checking public key algorithm for the validator account that proposed the block. It's not the taking a public key from the approvals object of a deploy, which seems to be the target.