Comments (12)
Should be easy enough. int
and uint
already cause panics if you try to marshal them.
What about length-prefixes? Should they all be 8 bytes too?
Also, I'm confused a bit by "we don't need to send the marshalled types over a wire." How else would we encode them?
from sia.
json or msgpack. we could also use a compressed version of the marshalled stuff, or uncompressed. When sending over a wire you have much better flexibility.
We'll use the marshalled stuff at first but we can change how we send messages without breaking the protocol.
from sia.
hmm. I don't really see the value in using a different serialization format for the network stuff, except to make the API a bit friendlier. And even then, the flexibility of json or msgpack seems unnecessary when we only have 4 or 5 message types. That's few enough that you could decode each of them manually without too much trouble.
I'd be wary of compression too, since it means another step and another library for library writers. It might be worth it if the size reduction is significant, but my gut feeling is that most of our messages are moderately entropic already.
from sia.
It's all stuff for later anyway. Just using normal sia marshalling is good enough for now.
from sia.
So..., in the process of implementing, it suddenly doesn't seem like such a bad thing to let int
and uint
get marshalled. Before it was bad because they had an undefined size, but we've since enforced that all integer types get encoded as 8 bytes, which means it no longer seems like a crime to marshal an int
. Forcing everything to come out as 8 bytes makes life easier.
from sia.
I think that EncUint64 and it's 3 cousin functions should all be non-exported from the encoding package.
I don't like seeing EncUint64 being used within the Sia package because it reduces modularity - if for whatever reason we decide to do something different for encoding, there are a lot more places to hunt down the functions. But if they always use Marshal and Unmarshal, then changing how the marshalling works won't cause problems elsewhere in the codebase.
from sia.
Want to close this issue, but want to first check that it's been fixed.
All numbers are always 8 bytes?
I'm also tossing around the idea that they should always be signed, but not fully sold on that idea.
from sia.
Everything is encoded as 8 bytes, yes. int_s are encoded as int64s and uint_s are encoded as uint64s. However, length prefixes are only 4 bytes. We might want to change this to 8 for consistency.
from sia.
Sounds good to me.
Ultimately I thinking to encoding all ints as int64's (uint64 included) is going to be the right move, but there are a lot of things you need to be careful about with regards to wrapping, so we're just going to leave that out for now, and let ints and uints be different.
I can close this issue once length prefixes are 8 bytes.
from sia.
Update on this?
from sia.
length prefixes are still 4 bytes, and encoding prefixes are just 1 byte. I'll make them both 8 bytes in my next PR.
from sia.
Fixed by #88
from sia.
Related Issues (20)
- localhost:9980/consensus HOT 3
- how to launch SIA daemon using SiaJs?
- A critical error loading Sia has occured: Siad unexpectedly exited. Error log: Sia Daemon v1.3.3
- Can't use wallet with SiaCoins - Siad has exited unexpectedly.
- A critical error loading Sia has occured: Siad unexpectedly exited. "are you running another instance of siad?" HOT 1
- Crash upon non bootstrapped blockchain download
- 'A critical error loading Sia has occurred: Siad unexpectedly exited.'
- ./siac wallet transactions method issue HOT 1
- Siad has exited unexpectedly. Please submit a bug report including the error log here.
- How to run ./siad daemon on testnet ?
- Changehero_get listed at the list of exchanges
- siad loading transaction pool HOT 2
- Siad has exited unexpectedly. Please submit a bug report including the error log here. HOT 3
- BUG REPORT Sia Daemon v1.3.3 Git Revision 94ea84e Loading... (0/6) Loading siad... (1/6) Loading gateway... (2/6) Loading consensus... (3/6) Loading transaction pool... (4/6) Loading wallet... (5/6) Loading host... (6/6) Loading renter... Finished loading in 1.6310935 seconds
- error while loading the WAL at startup: failed to recover WAL: walFile metadata mismatch
- siad.exe error
- you 1.3 update locked my wallet and the password i used before does not work. you are to send me a way to unlock may wallet and no I am not redownloading anything else!!!!
- typographic error "shudown"
- WAL file is still present after clean shutdown/ causes WARN messages in log
- the password I created does not work and the long list of encryption words does not work. my walet is locked. I have been running JSE miner for days and have nowhere to put my coins. I had faith in JSE as like a cround floor botcoin, then you locked my wallet and screwed me. Thank God I had put no coins in it. YOU WILL PROVIDE ME A WAY TP UNLOCK MY WALLET OR I WILL ERASE JSE AND AGREE WITH MANY EXPERTS THAT SAY CYBERCURRENY IF JUST ANOTHER FIAT CURRENCY AS USELESS AS THE U.S. DOLLAR WITH NOT BACKING OTHER THAN THE FAITH FOOLS LIKE ME PUT IN IT! I do not want instructions to redowload this or that. I did everything you told me to do. You JSE Siacoin wil fix my wallet.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sia.