Skip to content

Instantly share code, notes, and snippets.

Avatar

Loredana Cirstea loredanacirstea

View GitHub Profile
@loredanacirstea
loredanacirstea / download.js
Created Oct 20, 2020 — forked from mkaminsky11/download.js
How to manipulate Google Drive files
View download.js
/*
Download a file
*/
function downloadFile(fileId) {
var request = gapi.client.drive.files.get({
'fileId': fileId
});
request.execute(function(resp) {
window.location.assign(resp.webContentLink);
});
View YulRecursionMemoryManagement.md
View yulToEwasm_staticcall.txt
==== original source ====
object "TestWasm9" {
code {
let _calldata := 96
calldatacopy(_calldata, 0, calldatasize())
let addr := mslice(_calldata, 20)
let input_ptr := add(_calldata, 20)
View yulToEwasm_forloop_bug2.txt
====== original source =====
object "TestWasm12" {
code {
let len := 4
let result := 5
for { let i := 1 } lt(i, len) { i := add(i, 1) } {
result := add(result, i)
}
View yulToEwasm_for_bug.txt
========== original source ============
object "TestWasm11" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let len := 4
@loredanacirstea
loredanacirstea / yulToEwasm_div_bug.txt
Created May 17, 2020
yulToEwasm - div with calldata argument bug
View yulToEwasm_div_bug.txt
solc --version
0.6.8+commit.0bbfe453.Darwin.appleclang
solc --strict-assembly --optimize --yul-dialect evm --machine ewasm ./tests/contracts/taylor.yul
-> const wmodule = new WebAssembly.Module(hexToUint8Array(bytecode));
CompileError: WebAssembly.Module(): Compiling function #9 failed: expected 1 elements on the stack for return, found 0 @+987
======= ./tests/contracts/taylor.yul - initial source =======
@loredanacirstea
loredanacirstea / yulToEwasm_staticcall.txt
Last active May 19, 2020
Yul -> ewasm with staticcall (staticcall not included in the bytecode); solc 0.6.8+commit.0bbfe453.Darwin.appleclang
View yulToEwasm_staticcall.txt
======= initial Yul source =======
object "TestWasm9_2" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 96
@loredanacirstea
loredanacirstea / TaylorInteract.js
Created May 5, 2020
Script to interact with the Taylor interpreted contract
View TaylorInteract.js
const address = '0x7D4150f492f93e2eDD7FC0Fc62c9193b322f75e5'
let provider = ethers.getDefaultProvider('ropsten');
const newUint8 = '0xffffffff11000001';
const newUint32Array3 = '0xffffffff44000000ee000002000000070000000f110000030000042200000411000004';
const castArrayInt32ToUint256 = '0xffffffff77777788ee0000020000000c000000202200000844000003110000204400000312000004000000020000000500000004';
const data = castArrayInt32ToUint256;
View HOFsExample_yul.sol
object "ContractB" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 2048
let _output_pointer := 0
@loredanacirstea
loredanacirstea / CurryExample_yul.sol
Created Apr 27, 2020
Curried Function example in Yul
View CurryExample_yul.sol
object "ContractB" {
code {
datacopy(0, dataoffset("Runtime"), datasize("Runtime"))
return(0, datasize("Runtime"))
}
object "Runtime" {
code {
let _calldata := 2048
let _output_pointer := 0