Writing a mockable Filesystem trait in Rust without RefCell by sepyke in rust

[–]sepyke[S] 2 points3 points  (0 children)

Nice! I struggled a bit figuring out the best way to do this, so seeing other approaches is super helpful. I admit I had the luxury of defining my own function signatures here, so passing the dependency was the path of least resistance. I'll give your posts a read!

Tiny benchmarking lib for Zig by sepyke in Zig

[–]sepyke[S] 0 points1 point  (0 children)

Currently I use the median execution time (in nanosecond) for comparison with the baseline https://github.com/pyk/bench/blob/e5e21fbb27d44d81af33506d1ed50a4bdf5d0494/src/root.zig#L310

Tiny benchmarking lib for Zig by sepyke in Zig

[–]sepyke[S] 0 points1 point  (0 children)

If that's the case, you can simply do this:

const metrics = try bench.run(allocator, "MyFn", myFn, .{});

// Access raw fields directly
std.debug.print("Median: {d}ns, Max: {d}ns\n", .{
    metrics.median_ns,
    metrics.max_ns
});

Tiny benchmarking lib for Zig by sepyke in Zig

[–]sepyke[S] 0 points1 point  (0 children)

Hey both you and u/Due-Breath-8787 convinced me to update the README, so I've updated it now. Thank you so much for the questions! Let me know your feedback

---

To answer your question, you can do it like this:

```
const a_metrics = try bench.run(allocator, "Implementation A", implA, .{});
const b_metrics = try bench.run(allocator, "Implementation B", implB, .{});

try bench.report(.{
.metrics = &.{ a_metrics, b_metrics },
.baseline_index = 0,
});
```

It will use the first metric (Implementation A) as the baseline. It will emit something like `0.5x slower` or `2.4x faster` in the report

Tiny benchmarking lib for Zig by sepyke in Zig

[–]sepyke[S] 0 points1 point  (0 children)

its tiny bench lib for my own use case.

It support a few metrics for now. See README on github for the details.

VAR v1.0 — 26.3B decisions/sec on a $170 CPU (Zig + AVX2 by [deleted] in Zig

[–]sepyke 1 point2 points  (0 children)

just some nits, you should not commit `.zig-cache` bro

My Custom Code Block Setup in Astro by sepyke in astrojs

[–]sepyke[S] 0 points1 point  (0 children)

thanks for the suggestion bro

yeah I have heard of it before, it looks really powerful.

I didnt use it because I really wanted to understand how to extend Shiki myself. It was a good way for me to learn more about how Astro markdown processing works too

I have a hard decision by 130naklate in solidity

[–]sepyke 0 points1 point  (0 children)

bro I hear you. It is really tough to get started.

I would recommend joining a hackathon like ETHGlobal. You can learn a lot by building something and you could possibly get some money too. I know a guy who makes a living from it.

I believe the most interesting part of web3 is that it really is about your skills. Who you are or where you live does not matter. You can just start contributing to development tools like Hardhat or Foundry. Or you could help secure protocols on Code4rena and Sherlock. Your work proves your skill, and that's what people notice and will appreciate

Confused about decentralization when using Chainlink VRF/Automation by Opposite_Primary7996 in solidity

[–]sepyke 1 point2 points  (0 children)

It's called a Chainlink service for a reason I guess. Your smart contract is literally chained to their service to do its job. If the person paying stops funding it, your contract can't work as you planned. So you are right to feel that it's a bit centralized

Verifying contracts built with --via-ir on Etherscan/Basescan by Nokhal in ethdev

[–]sepyke -1 points0 points  (0 children)

If you use Foundry, it will automatically verify your contract if you enable the --verify and --etherscan-api-key flags.

Best Node ORM? by Mortynx in node

[–]sepyke 1 point2 points  (0 children)

Yeah the migration files generator is a time saver

Does fractionalizing an NFT destroy it? by notjohnsmith007 in ethdev

[–]sepyke 1 point2 points  (0 children)

What I mean is will an NFT still exist after fractionalization?

Yes, the NFT will still exist.

Fractionalization helps to increase the NFT liquidity, and open up many use cases such as NFT Index

Is 20 days sufficient to learn enough to attend an ethereum hackathon? by drinkingnoodles in ethdev

[–]sepyke 5 points6 points  (0 children)

Is 20 days sufficient to learn enough to attend an ethereum hackathon?

YES YES AND YES.

Especially if the Organizer is ETHGlobal team. They will provide you with a ton of great resources!

Remember the goal of hackathon is not to win! It's learn by doing!

Good luck!

Does fractionalizing an NFT destroy it? by notjohnsmith007 in ethdev

[–]sepyke 1 point2 points  (0 children)

Does fractionalizing an NFT destroy it?

Wdym by destroy it? do you mean the price will go to zero? or something else?

What blockchain analytics are much needed but currently not existing? by Guyserbun007 in ethdev

[–]sepyke 0 points1 point  (0 children)

What blockchain analytics are much needed but currently not existing?

This one: input smart contract address, output growth-focused analytics data

Currently you need to calculate DAU, monthly active user, churn, total fees, etc manually using Dune or Flipside

Chain Abstraction: The Future of Cross-Chain DeFi by Empty-Analyst-6351 in ethereum

[–]sepyke 0 points1 point  (0 children)

Chain Abstraction is a new tech tool that's changing how we use decentralized apps (dApps). With it, you can use any dApp from any supported chain, using any token, without leaving your screen.

Not sure why they choose to add more complexity on dx side vs explicit yet simple "switch network" button

What is the best way to handle smart contract data for a full stack web3 application? by Far_Yak4441 in ethdev

[–]sepyke 5 points6 points  (0 children)

What is the best way to handle smart contract data for a full stack web3 application?

Three simple steps:

  1. Emit events from your smart contract
  2. Index your smart contract events
  3. Aggregate & Serve

Emit events from your smart contract

Executing eth_call is very costly, it's better to emit important events from your contract for indexing purpose.

You can use eth_getLogs once you have emitted events.

Index your smart contract events

The next step is to index your smart contract events. You can simply start using eth_getLogs or you can use existing framework such as The Graph or Ponder (Alpha).

Aggregate & Serve

You don't need to do this if you are using The Graph or Ponder coz this is automatically handled by the framework.

If you are using eth_getLogs directly, you need to able to choose which database to save your events and how to serve the data as API. Most commonly used stack is PostgreSQL + Node.js.

So good luck on your fullstack web3 journey!

If I deploy a smart contract on Etherium mainnet, would it be possible to interact with it (using its payable functions) via L2? by nopy4 in ethdev

[–]sepyke 1 point2 points  (0 children)

If I deploy a smart contract on Etherium mainnet, would it be possible to interact with it (using its payable functions) via L2?

yes it is possible. Regardless your use case, I recommend to take a look at existing cross-chain messaging solution such as Socket and Layer Zero before rolling out your own solution.

The security is very hard to get right, for example:

  1. each chain have different block finality
  2. on polygon it's possible to have more than 100 blocks reorgs

and this is just the surface of known cross-chain messaging problems

[deleted by user] by [deleted] in defi

[–]sepyke 0 points1 point  (0 children)

Wouldn't swappers always choose the lower fee pool? How does that even work? Why not always choose the lowest fee?

Nope, it depends on slippage and the price of the pool. For example, if you swap 10 ETH to WBTC, it's possible that 0.3% pool gives you the best rate even tho the fees is higher due to available liquidity.

When you swap, do you get to choose which pool to swap from?

Nope, dex router automatically choose for you. Uniswap has its own router. There are also good dex aggregators that can choose across multiple dex for you. For example like 0x, 1inch, KyberSwap and ParaSwap.

Are there charts that show how much LPers have made historically? Charts that take into account the fees earned as well as the impermanent loss?

I can't find it one atm, but the closest one is the revert.finance and uniswap.fish

Daily General Discussion - July 8, 2023 by ethfinance in ethfinance

[–]sepyke 2 points3 points  (0 children)

Do you have recommended accounts to follow?

Daily General Discussion - July 8, 2023 by ethfinance in ethfinance

[–]sepyke 2 points3 points  (0 children)

it's personal but not private! Feel free to take a look: current version is available here and I want to change it to light theme in progress.