-
Notifications
You must be signed in to change notification settings - Fork 526
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
Polkadart Milestone 1 #635
Conversation
8413def
to
56545dc
Compare
Thanks for the delivery @Lohann. We'll look into it as soon as possible. |
Hey again @Lohann, I'm your evaluator for this milestone. Thanks for the effort that went into this delivery, it looks great so far. A few comments from my side:
|
Hello @alxs, I made a change, can you give another go? If it doesn't work again can you please share with me the current environment that you are running? linux distro? windows? osx? |
Hey @leonardocustodio, of course. It didn't work again, this is a VPS running Ubuntu 20.04.
|
Odd, I've removed the |
Sure! I don't get exactly the same error, but a very similar one:
|
This one provides a bit more information because of the path. I believe I now know what is happening. No one from our team had this issue, even though Docker is supposed to run almost equally across everybody sometimes we do see differences. I will go for another fix and let you know when it is done, thank you very much |
Hey @alxs, can we try one more time? I was also wondering if this could be a CRLF issue. But you and I are both using Ubuntu so it shouldn't be that. If you can clone it again, the latest commit and make a fresh build with no cache. Thank you very much :) |
@leonardocustodio I'm sorry I don't bring better news, but it is still failing:
That is on the latest |
I'm starting to feel embarrassed... I removed this file. PR. If we still get an error. We will have to find a way to replicate it somehow. Can we give it another shot? Really sorry about making you do this. We are six people, and we have not managed to replicate this yet. |
That did the trick! No worries at all. Let me know when I should take another look at the delivery. |
@alxs ready for a second look 👀 |
@Lohann many thanks for the additional work and also for adding support for pre-v14 metadata, which wasn't even in the scope of this milestone! After reviewing the code and your latest commits, it appears that you've implemented the encoding/decoding of some of the metadata contents as you list them here, but not of all of them. To my understanding these will be necessary to construct transactions, but there's nothing else in your milestone plan between here and milestones 2 (networking) and 3 (cryptography). Am I missing something? Otherwise, could you ensure that this is fully implemented before moving on to the next milestone? You can always amend the milestone plan if you want to redistribute the work or adjust the budget. |
Hi @alxs I think there's a confusion about what curl -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"state_getMetadata","params":[]}' https://rpc.polkadot.io Parse frame-metadata is a BIG milestone, because it requires the dart scale-codec (which deserved a grant by itself), ss58 for retrieve the address public key, just then is possible to parse the frame-metadata, which is not trivial as you can check here. The metadata described here is another thing, it is the interface in Dart that allows the user to interact with the node, which includes read/mutate the chain state, similar to what polkadot-api does here: Notice that both are called To clarify, I'll send an example of what you should expect to be delivered in each milestone: Milestone 1Goal: Encode/Decode scale-codec, ss58 addresses and parse frame-metadata Scale Codec ✅// defining used types
final typesRegistry = <String, dynamic>{
'Codec': {
'd': 'Compact<u32>',
},
};
// Creates the registry for parsing the types and selecting particular schema.
final registry = TypeRegistry(types: typesRegistry);
// specifyng which schema type to use
registry.select('Codec');
// fetching the parsed types from `Json` to `Type`
final types = registry.getTypes();
// Initializing Scale-Codec object
final codec = Codec(types);
// encoding and decoding 16777215 as Compact<u32>
var encodedInt = codec.encode(registry.getIndex('Compact<u32>'), 16777215);
var decodedInt = codec.decode(registry.getIndex('Compact<u32>'), encodedInt); More examples here SS58 ✅// get registry info of given `prefix`
final polkadotRegistry = Codec.registry.getByPrefix(0);
// decoding substrate address
final String originalAddress ='5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
final List<int> publicKey = polkadotRegistry.decode(originalAddress); More examples here Parse frame-metadata ✅final decoder = MetadataDecoder();
// Really big hexadecimal string
// curl -H "Content-Type: application/json" -d '{"id":1,"jsonrpc":"2.0","method":"state_getMetadata","params":[]}' https://rpc.polkadot.io
final metadata_hex = "0x6d6574610e6908000c1c....7461"
var decodedMetadata = decoder.decode(metadata_hex); Example here Milestone 2 🟡Goal: Expose read-only methods var api = await PolkadartApi.connect("wss://rpc.polkadot.io");
// RPC
var blockHash = await api.rpc.chain.getBlockHash(1)
// Constants
var ed = await api.consts.balances.existentialDeposit()
// Storage
var balance = await api.query.balances.account(address) Milestone 3 🔴Goal: Create/manage accounts, sign and send extrinsics. // create a keyring for ALICE account
var keyring = new Keyring({ type: 'sr25519', ss58Format: 2 });
var mneumonic = "floor author slight rebuild network naive spirit climb income stool brief clay net yard document";
var alice = keyring.addFromUri(mnemonic, "ed25519");
// Connect to WS API
var api = await PolkadartApi.connect("wss://rpc.polkadot.io");
// Create transaction
var extrinsic = await api.tx.balances.transferKeepAlive(dest, amount);
// Alice sign and send transaction
await extrinsic.signAndSend(alice) Obs: the code above is just an example of which features will be delivered in each milestone, the interfaces and the final code may be different. |
@Lohann we may be talking past each other here. What I meant to say is, isn't the reason that the frame-metadata is provided so one can communicate with the node? You don't only want to parse it correctly, you want to be able to understand and represent all types and other information provided in the metadata so that you can also create and encode extrinsics, RCP calls etc. Even if you don't have JSON-RPC and can't sign transactions, you'll still want to be able to create and encode them. Am I missing something? |
Currently we don't have a way to communicate with Substrate node, once it requires a
Notice that is already possible to encode/decode extrinsics, constants and RPC calls, etc using Polkadart Metadata, as you can see here: Each metadata version expose different types depending of the version: So the Metadata is ready, it already encode/decode extrinsics, storage, constants, but this is only useful once we connect to the node, so we can effectively use this to read the chain state. |
Thanks for the explanation and for adding more examples to the documentation. That makes sense - I was able to find the functionality thanks to the new examples and a bit more digging and, as I understand it now, this list represents the functionality of the library and is otherwise unrelated to Substrate metadata. Perhaps renaming this section would prevent confusion down the line. And with this, I'm happy to let you know that the milestone has been accepted! Thank you for the great work on this milestone. You can find my evaluation notes here. I'll notify the operations team to pay out the invoice you submitted. Please allow for up to 14 days for processing. |
Congratulations on completing the first milestone of this grant! As part of the Grants Program, we want to help grant recipients acknowledge their grants publicly. To that end, we’ve created a badge for projects that successfully deliver their first milestone. Note that it must only be used within the context of the delivered work, so please do not display it on your team or project's homepage unless accompanied by a short description of the grant. |
Also please update the address with the one in your invoice. |
@alxs will do! |
I put USDT because that's the only stablecoin currently supported by statemint: |
@Lohann we try to ensure the address and currency in the invoice are always the same ones as in the application. |
@Lohann friendly reminder |
Please ping @keeganquigley when you've submitted the amendment and it's been approved and he will forward the invoice to the operations team. |
@alxs @keeganquigley Invoice updated, it can be paid in DOT instead USDT. |
Thanks @Lohann however, we don't offer payments in DOT. Please see the available payment methods. I believe Alex was not asking you to update the invoice, but rather submit an amendment to update your application to remove DOT and switch it to USDT here. Total costs should be displayed in US Dollars, therefore in addition he asked you to also remove the USDC reference here, by changing it to USD instead. I hope that makes sense and sorry for the confusion. Your original invoice should be fine. The amendment will need 5 approvals from the committee (the same as your original application) but these approvals should happen relatively quickly. Thanks and I will watch for it! |
@keeganquigley Hmm so DOT is not support anymore, ok amend PR created! |
@Lohann that's correct thank you! Please submit a new invoice accordingly since it is now USDC. |
@keeganquigley done ✅ |
Thank you @Lohann I have forwarded your invoice for payment. Please expect up to 14 days for delivery. |
hi @Lohann we just transferred the payment. Apologies for the delay! |
Milestone Delivery Checklist
Link to the application pull request: w3f/Grants-Program#1053