Better HN
topnewbestaskshowjobs
Log inSign up

RustyRussell

1,432 karma · joined May 20, 2011 (15y ago) · 286 submissions

[ my public key: https://keybase.io/rusty; my proof: https://keybase.io/rusty/sigs/uWS-VceJTes_fyFrtfO5WNTj-smrhHV67zLX0yUDzhI ]
Submissions

comment 1y ago · link · parent

In recent years I've come to rely on this non-initialization idiom. Both because as code paths change the compiler can warn for simple cases, and because running tests under Valgrind catches it.

comment 1y ago · link · parent

> ryao 7 hours ago | parent | context | flag | on: Hacktical C: practical hacker's guide to the C pro...

  cast a `struct Foo*` into a `struct Bar*` and access the Foo through it (in practice we teach this as the "strict aliasing" rules, and that's how all(?) compilers implement it, but that's not what §6.5 paragraph 7 of the standard says!)
Use the union type. Abusing it for aliasing violates the standard too, but GCC and Clang implement an extension that permits this. Alternatively, just allocate a char array and cast it as you please. Strict aliasing does not apply to char arrays if I recall.

  allow a signed integer to overflow
Is this still true? I thought that the reason for this is because C left the implementation to define how signed arithmetic worked, meaning you could not assume two’s complement, but the most recent C standard was supposed to mandate two’s complement.

>> pass a NULL pointer to memcpy, even if the length is zero

> There is a reason for this. memcpy is allowed to start reading early as a performance optimization, before it does a branch that checks if reading is only.

Where did you get this idea from? It's not possible, since you can hand an address at the end of an array, and length 0. The array ends at the end of a page.

You can't read extra bytes in this case!

comment 1y ago · link · parent

I don't care, as long as a commit which fixes a crash, compiler error or test failure quotes the errorv. This helps searching for issues, and also helps later if you find they mis-diagnosed the problem.

Other peeve: quote the core of the bug report you're closing, so when GitHub inevitably goes away/turns evil/starts charging, you don't lose half your knowledge. The git tree should always stand alone.

comment 1y ago · link · parent

We use the same for Lightning: even bits for incompatible changes, odd for backwards compatible changes.

comment 1y ago · link · parent

OK, the whole "I am a lawyer" was next-levelled by this closing sentence: "Not only am I unintimidated by litigation; I sometimes rather miss it."

comment 1y ago · link · parent

It's a trick I stole from ext2, and simplified. In that filesystem there are three bitsets: one for reading, one for writing, one for fsck. If you don't understand a bit you can't do that action.

For most protocols there's only reading and writing, so you can use odd bits to mean "backwards compatible features, you can read even if you don't understand" and even for "stop, we broke compat".

comment 1y ago · link · parent

These days I generally advise that you interpret the version number as odd and even bits: odd means it's compatible with readers, even means it isn't.

comment 1y ago · link · parent

I actually laughed out loud. But my wife would not understand...

comment 1y ago · link · parent

But there has to be economic incentives to maintain the data, and only Bitcoin can even to begin to make that claim, and even it is only 16 years old.

Still, Open Timestamps does exactly this, and had been running for over 8 years now.

comment 1y ago · link · parent

When I was working for a large US tech company, one of colleagues used that term to their American managers in a positive way (we were Linux people, after all): turned out he didn't know the origin. Significant faux pas!

comment 1y ago · link · parent

Worked for American companies for 25 years. Generally Americans come across as more confident, and yet conform to hierarchy in a way I've never seen en-masse in Australian culture. It always seemed to be that only the most weirdo Americans are blind to relative status, whereas for many Australians it's the norm?

Employment-at-will takes some cultural adjustment, too. But for tech folks tends to be a net win. You just need to set your expectations accordingly!

comment 2y ago · link · parent

Worth reading this silly thread to hit this gem.

Hope you have a great day!

comment 2y ago · link · parent

Don't see anything relevant in Australia...

comment 2y ago · link · parent

Please don't do this.

He's repeatedly denied it, and your ignorant claim can only bring him and his family trouble.

(Also, I've known Adam for a number of years through multiple Bitcoin conversations and I can personally vouch that it's not him!)

comment 2y ago · link · parent

Actually, it's estimated that about a quarter of mining is in China. The largest players moved, the rest are lying low, so it's hard to get exact numbers.

comment 2y ago · link · parent

When solar or wind is curtailed, I would call that wasted energy?

comment 2y ago · link · parent

Can you provide evidence of this? Thanks!

comment 2y ago · link · parent

This I'd wrong. There are at least 4 independent, FOSS implementations and an open specification and spec process.

comment 2y ago · link · parent

It was Satoshi who introduced the block size limit though. Awkward!

comment 2y ago · link · parent

If censorship resistance and reliability are your metrics, there really isn't a serious competitor. There is huge incentive to claim to be so, however!

But if you're trying to build something for decades, as you should be for internet infrastructure, there isn't much option.

comment 2y ago · link · parent

Why? Using wasted energy at scale doesn't seem to cause significant CO2 emissions, especially given that it's such a price-sensitive buyer, and curtails so well.

Curiously, this energy hunger is driving decentralization despite the otherwise inevitable benefits of scale.

comment 2y ago · link · parent

https://news.ycombinator.com/item?id=39210946

Heres the inline:

See https://github.com/rustyrussell/runes for a simpler alternative and implementation (this has C and Python, but there's also a Rust implementation because why not?)

However, the "no db access" property has proven to be untenable in practice. Users end up wanting to see what runes are issued, blacklist them, know when they were last used, and have rate limits. The last two are a killer, requiring some state to be kept (unless your system allows you to return a modified rune to the user, which is a different workflow from normal bearer creds).

comment 2y ago · link · parent

That's a long stretch from "why aren't we seeing more adoption" to your assertion that "no wallets/exchanges/no one uses it"?

Because payments happen been pairs, there's no easy count of activity. The best estimates I know of are things like https://blog.river.com/the-lightning-network-in-2023/ which is almost 12 months old.

As to "no wallets support it", that's a strange thing to say, since lightning wallets support it, obviously.

I'm yet to see any comparable statistics in L2s on Ethereum? Was hoping you'd have something there, too :(

comment 2y ago · link · parent

This does not seem accurate, but perhaps I'm too close to see it? Do you have a source for this?

comment 2y ago · link · parent

Presumably the macaroon itself contains a shortish timeout.

You can rate-limit (runes do this, which are simplified macaroons) but then the server is no longer stateless. Pretty sure I've ranted about this in HN comments before, could dig it out if you're interested?

comment 2y ago · link · parent

Different problem?

Having created a micropayment network, you quickly discover that infrastructure does not exist where you want to use it. Web APIs are kind of the obvious use case, but because there was no micropayment system they trended to an account and batch payment method by necessity.

This aims to fill that infrastructure gap. Of course, there's a huge chicken-and-egg bootstrap problem, but you have to start somewhere!

comment 2y ago · link · parent

> Even `new_pointer == old_pointer` is not allowed.

This is legal. But dereferencing old_pointer even after this check had passed is undefined.

comment 2y ago · link · parent

Yes, came here to say this too. Of course it varies, but some measurements would be nice!

comment 2y ago · link · parent

I still refer people to the classic film review of The Sound of Music:

https://www.theonion.com/the-onion-looks-back-at-the-sound-o...

comment 2y ago · link · parent

Indeed: thanks, that actually has good examples and counter-examples.
12345
10