Git Product home page Git Product logo

Comments (6)

SkymanOne avatar SkymanOne commented on May 24, 2024 1

After some investigation, it would be difficult to support non-standard generic account types in both unit and e2e testing. This is due to the fact that the testing environment assumes AccountId: From<[u8; 32]> allowing the convert keypairs from subxt into public addresses and so on, it is also used when generating default test accounts (Alice, Bob, Dave, ...) assuming the From<[u8; 32]> implementation.

Making this generic can be done with:

  1. Introducing the const generic N for From<[u8; N]> allowing the developer to specify the size of the AccountId manually
  2. Completely removing the notion of From<> and introducing the trait DefaultAccounts and other traits allowing the developer to specify default test accounts himself

The second approach is less feasible because the E2E framework heavily relies on sr25519 for signing transactions, and uses default polakdot config.

Making this customisable would probably require a lot of configuration on the developer side, something that we want to avoid.

If you want to test your contracts with non-32-byte AccountId, I suggest you do this on the frontend side using JavaScript.

from ink.

SkymanOne avatar SkymanOne commented on May 24, 2024

It is a good spot we should make AccountId more generic. The fix in tests should easy. However, the reason why you might not be able to instantiate the contract is because pallet-contracts is configured to use the default AccountId.

If you are using some custom node configuration, can you please provide the link so I can reproduce the issue?

from ink.

Kofituo avatar Kofituo commented on May 24, 2024

The custom node is frontier. So basically that node with pallet-contracts setup (similar to this).
However, you mentioned that pallet-contracts uses AccountId. Do you mean pallet-contracts defaults to AccountId32? From what I just checked, it uses AccountId provided by frame_system pallet

from ink.

SkymanOne avatar SkymanOne commented on May 24, 2024

Do you mean pallet-contracts defaults to AccountId32

Essentially, yes, substrate-contracts-node using AccountId32 which resolves to [u8; 32].

Off-chain testing environment makes an assumption about this in order to generate a set of default accounts. I need to think about the proper way to make AccountId configurable, coz this breaks some assumptions in our testing frameworks

from ink.

Kofituo avatar Kofituo commented on May 24, 2024

Yeah. Probably AccountId should be configurable but also have a default value if none is specified

from ink.

Kofituo avatar Kofituo commented on May 24, 2024

How you suggest I do that? @SkymanOne

from ink.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.