Skip to content

Instantly share code, notes, and snippets.

View helderjnpinto's full-sized avatar
☢️

ħþ helderjnpinto

☢️
View GitHub Profile
@helderjnpinto
helderjnpinto / StackTooDeepError.md
Last active January 26, 2024 18:10
Solidity stack too deep errors and solutions.

Solving “Stack too deep” Errors in Solidity EVM

This error typically occurs when a function has too many local variables, and the Ethereum Virtual Machine (EVM) imposes a limit on the number of variables that can be pushed onto the stack.

Here the follows investigation that I made today.

References of some examples are given here:

@helderjnpinto
helderjnpinto / Error.sol
Last active October 11, 2023 16:33
test of solidity costs when reverts and deployed transaction gas for require, revert custom errors
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// tx costs when reverts + deployed tx cost
// deployed gas cost 202596
contract Error {
uint num = 0;
// transaction cost 21910 gas
#pragma version 8
if Txn.ApplicationID == 0:
# Handle Create App
exit(1)
end
switch Txn.OnCompletion:
NoOp: main
OptIn: opt_in
@helderjnpinto
helderjnpinto / main.rs
Created May 3, 2023 21:39
MQTT rust wip
use std::collections::HashMap;
use std::io::{ self, Read, Write };
use std::net::{ TcpListener, TcpStream };
use std::sync::{ Arc, Mutex };
use std::thread;
#[derive(Clone)]
struct Broker {
subscribers: HashMap<String, Vec<Arc<Mutex<TcpStream>>>>,
}
@helderjnpinto
helderjnpinto / Auction.sol
Created January 27, 2023 11:13
Simple auction solidity
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;
contract SimpleAuction {
address payable public beneficiary;
uint public auctionEndTime;
address public highestBidder;
uint public highestBid;
@helderjnpinto
helderjnpinto / PSQL stats blockscout.txt
Last active January 23, 2023 21:35
PSQL stats blockscout tst
pid,query
218,"SELECT a0.""id"", a0.""name"", a0.""primary"", a0.""metadata"", a0.""address_hash"", a0.""inserted_at"", a0.""updated_at"", a0.""address_hash"" FROM ""address_names"" AS a0 WHERE (a0.""address_hash"" = $1) ORDER BY a0.""address_hash"""
210,"SELECT t0.""hash"", t0.""block_number"", t0.""cumulative_gas_used"", t0.""earliest_processing_start"", t0.""error"", t0.""gas"", t0.""gas_price"", t0.""gas_used"", t0.""index"", t0.""created_contract_code_indexed_at"", t0.""input"", t0.""nonce"", t0.""r"", t0.""s"", t0.""status"", t0.""v"", t0.""value"", t0.""revert_reason"", t0.""max_priority_fee_per_gas"", t0.""max_fee_per_gas"", t0.""type"", t0.""has_error_in_internal_txs"", t0.""old_block_hash"", t0.""inserted_at"", t0.""updated_at"", t0.""block_hash"", t0.""from_address_hash"", t0.""to_address_hash"", t0.""created_contract_address_hash"", t0.""block_hash"" FROM ""transactions"" AS t0 WHERE (t0.""block_hash"" = $1) ORDER BY t0.""block_hash"""
225,"SELECT a0.""hash"", a0.""fetched_coin_balance"", a0.""fet
@helderjnpinto
helderjnpinto / postgres_queries_and_commands.sql
Last active January 25, 2023 16:31 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@helderjnpinto
helderjnpinto / docker-compose.yml
Created December 9, 2022 22:01 — forked from barnybug/docker-compose.yml
Docker compose for a Docker-in-docker gitlab runners setup
# Docker-in-Docker Gitlab runners setup taken from:
# https://medium.com/@tonywooster/docker-in-docker-in-gitlab-runners-220caeb708ca
dind:
restart: always
privileged: true
volumes:
- /var/lib/docker
image: docker:17.09.0-ce-dind
command:
- --storage-driver=overlay2
Random Value : ok
Compare XOR : ok
Compare SUB : ok
Compare MUL : ok
Compare DIV : ok
Compare OR : ok
Compare AND : ok
Sequential Increment: ok
Solid Bits : ok
Block Sequential : ok
@helderjnpinto
helderjnpinto / gist:1a7f0ab78a676544c12f684c5ad25e73
Last active November 17, 2022 22:36
memtesterSlot1 22191413495
FAILURE: 0x76ffa13a12f7ec54 != 0x76ffa13a12f5ec54 at offset 0xa1d1b230.
FAILURE: 0x76ffa13a12f7ec55 != 0x76ffa13a12c7ec55 at offset 0xa1d1b238.
FAILURE: 0x76ffa13a12f7ec57 != 0x76ffa13a12ffec57 at offset 0xa1d1b248.
FAILURE: 0x76ffa13a12f7ec59 != 0x76ffa13a12e6ec59 at offset 0xa1d1b258.
FAILURE: 0x76ffa13a12f7ec5b != 0x76ffa13a12faec5b at offset 0xa1d1b268.
FAILURE: 0x76ffa13a12f7ec5d != 0x76ffa13a1267ec5d at offset 0xa1d1b278.
FAILURE: 0x76ffa13a12f7ec5f != 0x76ffa13a12dfec5f at offset 0xa1d1b288.
FAILURE: 0x76ffa13a12f7ec60 != 0x76ffa13a12f5ec60 at offset 0xa1d1b290.
FAILURE: 0x76ffa13a12f7ec61 != 0x76ffa13a1266ec61 at offset 0xa1d1b298.
FAILURE: 0x76ffa13a12f7ec62 != 0x76ffa13a12f5ec62 at offset 0xa1d1b2a0.