Skip to content

Instantly share code, notes, and snippets.

View mratsim's full-sized avatar
:shipit:

Mamy Ratsimbazafy mratsim

:shipit:
  • Paris
View GitHub Profile
@mratsim
mratsim / UsageTrackingBlock.cs
Created January 2, 2020 23:45 — forked from anonymous/UsageTrackingBlock.cs
A tracker of slot usage for a region spanning a total of 2^14 (16384) slots, in a total of 3072 bytes using a combination of a Fenwick tree and a bitmap vector.
namespace TryOuts
{
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
/// <summary>
/// Tracks usage of a block of 2^14 (16384) slots using a bitmap that
/// contains the 16384 used/free bit flags for each slot (taking up a
/// total space of 2048 bytes, accessed as an array of 512 ints), in
import sequtils
# Producers' side
# ----------------------------------------------------
# Note, for this example, the producer and consumer are on the same thread
# In the actual implementation, "ProducersRangePromises"
# must be atomicRefCounted and the items in fulfilled must be atomic as well.
type
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 85
model name : Intel(R) Core(TM) i9-9980XE CPU @ 3.00GHz
stepping : 4
microcode : 0x2000043
cpu MHz : 1406.852
cache size : 25344 KB
physical id : 0
import tables, sequtils, sugar, macros, sets, heapqueue, strutils
## nimconstraint: A CSP-Solver written in Nim
## Author: Timothy Hornick @Xydium
## Date: 20 December, 2019
type
Variable[T] = ref object
@mratsim
mratsim / 2019-12-19 Eth2 implementer call.md
Created December 19, 2019 15:15
2019-12-19 Eth2 implementer call

ethereum/eth2.0-pm#112

—————— Nimbus

Core:

  • Started on attestation aggregation
  • benchmark tool in the zcli vein

Sysadmin:

------------------- MODULE event_notifiers -----------------------
(*
Formal specification of the event_notifiers datastructure.
It allows a single consumer to be put to sleep and being woken up
by multiple producers so that the consumer is able to consume the incoming messages (steal requests).
It combines a prepare phase "intendToSleep" with commit phase "wait".
In between the consumer sends a message to its parent that it is going to sleep.
The commit phase is aborted when any producers signal an incoming message.
There should be no deadlock, i.e. an incoming message being signaled but the consumer stays sleeping
as in the runtome the main thread may be the only one awake and wouldn't be able to awaken its children
# beacon_chain
# Copyright (c) 2018 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.
proc insertedAtExits(ast: NimNode, statement: NimNode): NimNode =
## Scan an AST, copy it with ``statement`` inserted at each exit point
##
import macros
proc foo() =
for i in 0 ..< 10:
for j in 0 ..< 10:
proc task(env: string) {.nimcall.} =
echo env
task("i: " & $i & ", j: " & $j)
foo()
@mratsim
mratsim / 2019-12-05 Eth2 Impl call 29.txt
Created December 5, 2019 14:58
2019-12-05 Eth2 Impl call 29
2019-12-05 Eth2 Impl call 29
https://github.com/ethereum/eth2.0-pm/issues/108
Nimbus updates
- Core:
Finished the last SSZ bugs on consensus objects last week so now it can be dumped
Optimizations: removing quadratic behaviours that reduced our CI time from 50min to less than 20min
@mratsim
mratsim / 2019-12-04 Eth2 Networking Call 0.txt
Created December 4, 2019 14:42
2019-12-04 Eth2 Networking Call #0
2019-12-04 - Eth2 Networking Call 0
Agenda: https://github.com/ethereum/eth2.0-pm/issues/106
——
Intro:
No one took complete ownership of networking,
—> busy
—> no p2p