keep-network / tbtc

Trustlessly tokenized Bitcoin on Ethereum ;)
https://tbtc.network
MIT License
213 stars 40 forks source link

Bitcoin Protocol Assumptions #32

Open prestwich opened 5 years ago

prestwich commented 5 years ago

Initial list. @mhluongo anything else you can think of?

mhluongo commented 5 years ago

If we assume the BTC supply asymptote, we can fit a TBTC balance with 3 additional decimals sub-satoshi into a uint64.... :grinning:

prestwich commented 5 years ago

but why? we don't actually get anything. a uint64 costs the same to store and basically the same to operate on as a uint256. I think we want 18 decimals for TBTC anyway

mhluongo commented 5 years ago

I assumed there was cool struct packing we can do.... Boo :(

Do you just want to list assumptions we're relying on, or assumptions we believe we can rely on?

prestwich commented 5 years ago

I assumed there was cool struct packing we can do.... Boo :(

actually maybe. bitshifts got in with constantinople, so this may be a thing now :o

Do you just want to list assumptions we're relying on, or assumptions we believe we can rely on?

I think listing assumptions we do rely on is more important, and we should try to be very aware of and closely examine any new ones

mhluongo commented 5 years ago

actually maybe. bitshifts got in with constantinople, so this may be a thing now :o

Looks like we'd have to replace the standard ERC-20 address to balance mapping to use hashed structs to get any benefit...

The naive attempt is more expensive https://ethfiddle.com/D45VXJ5QN-

I'll play around, code golf sounds fun

I think listing assumptions we do rely on is more important, and we should try to be very aware of and closely examine any new ones

Agreed. Part of why I ask is we could intentionally relax some assumptions (eg less strict difficulty SPV) to have fewer protocol assumptions in code, though the validation will be weaker

prestwich commented 5 years ago

I'll play around, code golf sounds fun

code golf is a never-ending rabbithole :)

mhluongo commented 4 years ago

I'll play around, code golf sounds fun

Narrator It wasn't.