Skip to content

Instantly share code, notes, and snippets.

EIP-6170 Extension: Data Commitment Interface

This extension introduces the Data Commitment Interface, which handles the pre-transaction data commitment. It's designed for platforms like Solana, where dynamic data (ie accounts) needs to be known along with the transaction instruction.

Developers can use the IDataCommitment interface to commit data before processing a cross-chain message with the extended IExtendedCrossChainMessaging interface. This can be useful by allowing the extraData field to be modified to contain the data needed for processing, such as public keys and accounts.

IDataCommitment Interface

// SPDX-License-Identifier: Apache-2.0
@tavakyan
tavakyan / EvmOpcodes.sol
Created November 9, 2023 20:14
EVM Opcodes Solidity library
pragma solidity ^0.8.19;
/**
* @title EvmOpcodes contract to look up gas for an operation
* @dev Library for managing EVM opcodes, including their gas costs.
*/
contract EvmOpcodes {
// Mapping from opcode name to its gas cost
mapping(string => uint) private opcodes;
@tavakyan
tavakyan / evm_test.rs
Created June 10, 2022 02:36 — forked from andelf/evm_test.rs
How to use the evm crate
extern crate evm;
extern crate hex;
extern crate primitive_types;
use evm::backend::{MemoryBackend, MemoryVicinity, MemoryAccount};
use primitive_types::{H160, U256};
use std::error::Error;
use std::collections::BTreeMap;
use evm::executor::StackExecutor;
use evm::{Config, Runtime, Context};
@tavakyan
tavakyan / diffie_hellman_test.rs
Last active March 16, 2022 16:50
Diffie hellman shared secret
// The goal is to implement a library which does the diffie-hellman key exchange such that the test passes.
// There is an added bonus for creating an async channel and doing the key exchange through that channel.
// 1. Write the necessary code to get the diffie_hellman_shared_secret_matches() to pass
// 2. Use 'cargo test' to execute the test
// 3. Use rand = "0.8.5", glass_pumpkin = "1.2.0" and num-bigint = { version = "0.4", features = ["rand"] } as dependencies
// 4. glass_pumpkin is used for safe primes and num-bigint is used for modular arithmetic
// 5. Comment on the security assumptions for choosing a bit size inline in your code
// 6. Use a generator with a fixed value of 2 and a random safe prime
// 7. Note that in the test sk means 'secret key' and pk means 'public key'
{
"openapi": "3.0.0",
"info": {
"title": "1inch API",
"description": "1inch API for Polygon Chain",
"version": "3.0",
"contact": {}
},
"tags": [],
"servers": [],
{"openapi":"3.0.0","info":{"version":"3.0.0","title":"Standard Relayer REST API","description":"# Schemas\n\nThe [JSON schemas](http://json-schema.org/) for the API payloads and responses can be found in [@0xproject/json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas). Examples of each payload and response can be found in the library's [test suite](https://github.com/0xProject/0x-monorepo/blob/development/packages/json-schemas/test/schema_test.ts#L1).\n\n```bash\nnpm install @0xproject/json-schemas --save\n```\n\nYou can easily validate your API's payloads and responses using the [@0xproject/json-schemas](https://github.com/0xProject/0x-monorepo/tree/development/packages/json-schemas) package:\n\n```js\nimport {SchemaValidator, ValidatorResult, schemas} from '@0xproject/json-schemas';\n\nconst {relayerApiTokenPairsResponseSchema} = schemas;\nconst validator = new SchemaValidator();\n\nconst tokenPairsResponse = {\n ...\n};\nconst validatorResult: ValidatorResult =
@tavakyan
tavakyan / deposit_manager.rs
Created June 21, 2021 23:03
ex ethcontract-rs for dep manager
#[allow(dead_code)]
mod deposit_manager {
# [rustfmt :: skip] use ethcontract as ethcontract ;
#[doc = "Generated by `ethcontract`"]
#[derive(Clone)]
pub struct Contract {
methods: Methods,
}
impl Contract {
#[doc = r" Retrieves the truffle artifact used to generate the type safe"]
yarn run v1.22.10
$ ./scripts/bash/init_network.sh -n development
$ ./scripts/bash/migrate.sh -r -n development
$ yarn build:sol && yarn build:ts
$ ts-node ./scripts/build.ts
Compiling
> Warning: possible unsupported (undocumented in help) command line option: --build_directory
Compiling your contracts...
===========================
@tavakyan
tavakyan / mailto
Created October 17, 2020 00:26
mailto auto forward
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv = "refresh" content = "0; url = mailto:to@whatever.com?cc=cc@whatever.com,cc2@whatever.com&bcc=bcc@whatever.com,bcc2@whatever.com&subject=subject&body=body" />
</head>
<body>
</body>
</html>
@tavakyan
tavakyan / MutualCreditTokenEx.sol
Last active October 2, 2020 06:16
Pseudo code for a mutual credit token interface and how it can be used
// SPDX-License-Identifier: MIT
// Oct 1st 2020 - Year of the Cactus
// ERC 20 token interface taken from open zeppelin and modified:
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol
pragma solidity ^0.6.0;
/**
* Interface of a complementary (mutual credit) token.
* Essentially same as ERC20 except using signed integers