Skip to content

Instantly share code, notes, and snippets.

View vivekvpandya's full-sized avatar

Vivek Pandya vivekvpandya

View GitHub Profile
@vivekvpandya
vivekvpandya / segment_tree.cpp
Created April 26, 2024 05:23
Segment Tree implementation based on idea from CP book by Steven & Felix
#include <iostream>
#include <cmath>
#include <cassert>
#include <vector>
using namespace std;
// Segment Tree
// The segment tree is stored like a heap array
// Based on idea descibed in CP book by Steven & Felix
This file has been truncated, but you can view the full file.
2022-12-01 11:23:40.614 INFO main zeitgeist::command: Parachain id: Id(2101)
2022-12-01 11:23:40.614 INFO main zeitgeist::command: Parachain Account: 5Ec4AhNwt5naTs1a8fU3thEXYAzYetm7AcYAFthSZGMX248D
2022-12-01 11:23:40.614 INFO main zeitgeist::command: Parachain genesis state: 0x000000000000000000000000000000000000000000000000000000000000000000096acb70809505e271aa67b81c203b0341f877125c4c73dcb009c2cdd27a9ef503170a2e7597b7b7e3d84c05391d139a62b157e78786d8c082f29dcf4c11131400
2022-12-01 11:23:50.781 INFO main sc_service::client::client: [🌔 Zeitgeist Parachain] 🔨 Initializing Genesis block/state (state: 0xccef…2a97, header-hash: 0x1bf2…e060)
2022-12-01 11:23:52.956 WARN tokio-runtime-worker parachain::candidate-backing: [Relaychain] Failed to fetch runtime API data for job err=Execution { runtime_api_name: "validator_groups", source: Application(Execution(Other("Exported method ParachainHost_validator_groups is not found"))) }
2022-12-01 11:23:52.956 WARN tokio-runtime-worker parachain::dispu
Compiling battery-station-runtime v0.3.6 (/home/vivek/dev/zeitgeist/runtime/battery-station)
Compiling zeitgeist-primitives v0.3.6 (/home/vivek/dev/zeitgeist/primitives)
Compiling common-runtime v0.3.6 (/home/vivek/dev/zeitgeist/runtime/common)
error[E0053]: method `transfer_non_native_currency` has an incompatible type for trait
--> runtime/common/src/weights/orml_currencies.rs:50:42
|
50 | fn transfer_non_native_currency() -> Weight {
| ^^^^^^
| |
| expected struct `frame_support::weights::weight_v2::Weight`, found struct `Weight`
Here is my work in progress PR https://github.com/zeitgeistpm/zeitgeist/pull/887
I am getting following errors,
**cargo build --features=try-runtime,parachain**
error[E0599]: the function or associated item `try_runtime_upgrade` exists for struct `frame_executive::Executive<Runtime, sp_runtime::generic::Block<sp_runtime::generic::Header<u64, sp_runtime::traits::BlakeTwo256>, sp_runtime::generic::UncheckedExtrinsic<MultiAddress<sp_runtime::AccountId32, ()>, Call, MultiSignature, (CheckNonZeroSender<Runtime>, CheckSpecVersion<Runtime>, CheckTxVersion<Runtime>, CheckGenesis<Runtime>, CheckEra<Runtime>, CheckNonce<Runtime>, CheckWeight<Runtime>, ChargeTransactionPayment<Runtime>)>>, ChainContext<Runtime>, Runtime, (frame_system::Pallet<Runtime>, pallet_timestamp::Pallet<Runtime>, pallet_randomness_collective_flip::Pallet<Runtime>, pallet_scheduler::Pallet<Runtime>, pallet_preimage::Pallet<Runtime>, pallet_balances::Pallet<Runtime>, pallet_transaction_payment::Pallet<Runtime>, pallet_treasury::Pallet<Runt
@vivekvpandya
vivekvpandya / contracts...betest.sol
Created March 21, 2022 09:55
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.9.0;
contract BETEST {
using SafeMath for uint256;
uint256 constant public INVEST_MIN_AMOUNT = 0.1 ether;
uint256[] public REFERRAL_PERCENTS = [50, 25, 5];
uint256 constant public PROJECT_FEE = 100;
uint256 constant public PERCENT_STEP = 5;
@vivekvpandya
vivekvpandya / bnbfury.sol
Created March 10, 2022 04:17
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson_v0.8.6+commit.0e36fba.js&optimize=false&gist=
/**
*Submitted for verification at BscScan.com on 2022-03-02
*/
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.6;
interface IInsuranceContract {
_quantl:
.cfi_startproc
pushq %rbp
Ltmp18:
.cfi_def_cfa_offset 16
Ltmp19:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp20:
.cfi_def_cfa_register %rbp
@vivekvpandya
vivekvpandya / mp_add
Last active July 1, 2016 13:53
This gist shows improvement in code quality due to Interprocedural Register Allocation in LLMV. These functions are taken from a pifft benchmark from llvm test-suite. However these functions are not hot paths of the executable but still runtime improvement is about 2%. Please check Revisions tab to see difference between code when IPRA is enable…
_mp_add: ## @mp_add
.cfi_startproc
## BB#0: ## %entry
pushq %rbp
Ltmp110:
.cfi_def_cfa_offset 16
Ltmp111:
.cfi_offset %rbp, -16
movq %rsp, %rbp
Ltmp112:
module d.llvm.evaluator;
import d.llvm.codegen;
import d.ir.expression;
import d.semantic.evaluator;
import util.visitor;
@vivekvpandya
vivekvpandya / GCRA.cpp
Created March 1, 2016 11:37
GCRA.cpp
//===-- GCRA.cpp - Regsiter Allocator --------------------------------===//
//
//
//
//===-----------------------------------------------------------------===//
//
// This is very simple register allocator.
//
//===-----------------------------------------------------------------===//