Skip to content

Instantly share code, notes, and snippets.

View ascjones's full-sized avatar

Andrew Jones ascjones

View GitHub Profile
ink on  at/riscv [$] via 🦀 v1.73.0
➜ CARGO_TARGET_DIR=/tmp/integration-tests-target CONTRACTS_NODE=~/code/polkadot-sdk-riscv/target/release/substrate-node \
scripts/for_all_contracts_exec.sh \
--path integration-tests \
-- cargo test --all-features --manifest-path {}
Updating crates.io index
Updating git repository `https://github.com/paritytech/cargo-contract`
Updating git repository `https://github.com/koute/polkavm.git`
Updating git repository `https://github.com/koute/polkavm.git`
Running: cargo test --all-features --manifest-path integration-tests/basic-contract-caller/Cargo.toml
@ascjones
ascjones / balances.rs
Created October 19, 2022 10:22
Denominated Balances
use std::str::FromStr;
// Fast access for 10^n where n is 0-19
pub const POWERS_10: [u128; 20] = [
1,
10,
100,
1000,
10000,
100000,
@ascjones
ascjones / substrate-metadata-v14-migration.md
Last active July 22, 2022 14:08
Migration guide for Substrate Metadata V14

Substrate Runtime Builders

When updating to use the latest Substrate with V14 metadata, your runtime will fail to compile.

The following steps are required to make your pallets/runtime compatible. The compiler will guide you...

  • Remove any #[pallet::metadata(..)] attributes from the pallet Event definition.
  • Add scale-info dependency to pallet and runtime crates:
    • scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
  • std = [ "scale-info/std" ]
This file has been truncated, but you can view the full file.
[
1635018093,
{
"V14": {
"types": {
"types": [
{
"path": [
"sp_core",
"crypto",
@ascjones
ascjones / polkadot-metadata0.json
Created June 21, 2021 15:15
polkadot scale-info metadata
This file has been truncated, but you can view the full file.
[
1635018093,
{
"V14": {
"types": {
"types": [
{
"path": [
"sp_core",
"crypto",
(module
(type (;0;) (func (param i32 i32) (result i32)))
(type (;1;) (func (param i32 i32 i32) (result i32)))
(type (;2;) (func (param i32 i32)))
(type (;3;) (func (param i32 i32 i32)))
(type (;4;) (func (param i32) (result i32)))
(type (;5;) (func (param i32)))
(type (;6;) (func (result i32)))
(type (;7;) (func (param i32) (result i64)))
(import "seal0" "seal_get_storage" (func (;0;) (type 1)))
@ascjones
ascjones / metadata-v13.json
Last active April 14, 2021 12:06
Substrate `node-runtime` metadata with `scale-info` type metadata, everything except errors metadata
This file has been truncated, but you can view the full file.
[
1635018093,
{
"V13": {
"types": {
"types": [
{
"path": [
"sp_core",
"crypto",
@ascjones
ascjones / GetSystemFileCache.ps1
Created January 19, 2015 14:22
Windows File Cache Scripts
$source = @"
using System;
using System.Runtime.InteropServices;
namespace MyTools
{
public static class cache
{
[DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
use std::any;
struct Type;
trait TypeInfo {
fn type_info() -> Type;
fn wrapped_type_id() -> Option<any::TypeId> {
None
}
use std::any;
mod meta_type {
use super::*;
use super::TypeInfo;
use std::cmp::Ordering;
#[derive(Clone, Eq, PartialEq, PartialOrd, Ord, Debug)]
pub enum MetaType {
Parameter(MetaTypeParameter),