Comments (1)
I noticed some things about utxoset that I didn't like and it turned into a fairly large refactor.
I'm sorry that I've mixed a few issues into one here, but they somehow all seemed related when I was doing all this yesterday.
There are 3 issues I've tried to tackle here:
-
The API in utxoset seemed wrong to me. This PR reduces the interface to just insert_transaction, reward_transaction, and slip_block_id. I also wasn't sure if the implementation of those was correct, so I've attempted to correct it.
-
Slip was not designed well. An Output consists of an amount, and address, and a type. An Input needs a reference to an Output, which is essentially and ID, which is a triple of block_id, tx_id, and slip_id in saito-lite. The previous Slip struct made it impossilbe to pass around references to slips without the slips themselves. Additionally, the id fields has to be zeroed or None-ed in cases where they weren't needed. This made the utxoset unnecessarily heavy and also made the Slip struct unwieldy. For example code in the add_block function was already setting these fields to 0 in some conditional. The new Structs are both easier to use and also add type-safety because there are some cases where you need a Slip/Output(address, amount, type) and other cases where you need a reference to that Slip. I've additionally named the base slip type to SaitoSlip, just to make it easier to grep for.
-
The structure for Transaction suffered from similar problems. The signature was part of the Body, which made it necessary to manage even in cases where a signature might not be needed. This is also confusing because the Body is the part that should be both serialized and signed, so the signature really should not be part of it. The new structure removes the signature from the body and also adds a new type SignedTransasction, which allows the type system to help enforce and communicate when and API expects a transaction to be signed. I've also renamed Transaction to RuntimeTransaction, which I think reflects it's usage(it will be needed by utxo set to map slips to blocks) and also makes it easier to grep for in the code.
I want to submit this PR now because I believe it's better to get it merged before the add_block_to_blockchain work is done. I still need to add comments/documentation to some things and one of the tests in utxoset needs to be written but I want to get this PR in front of the team before I go home tonight.
from saito-rust.
Related Issues (20)
- Improve Routing Hops
- connect to other nodes HOT 3
- clippy error: src/blockchain.rs:315:16 - this boolean expression contains a logic bug
- Suggest using the updated jemalloc lib HOT 4
- Update and match the Onchain Reorganization behavior in Saito-Rust with Saito-lite-rust
- Move all related global variables for peer-to-peer communication to the Network class
- Deployment of Saito-Rust in Production
- More Configuration Options If Config File Not Found In Default Location HOT 3
- Fix "Paysplit Ratio" card in PM board
- Create a proper sprint-planning process and start using it HOT 1
- Lottery Game Module HOT 1
- add_block_to_blockchain 2/4 - core algorithm of adding block: if the block(or blocks?) are valid and a new longest chain: invalidate old blocks, fire rollback events, and add the new blocks(and fire rollforward events) HOT 1
- add_block_to_blockchain 3/4 - Validate Transactions against UTXO(no sig validation)
- Serialization Benchmark Tooling HOT 1
- Make sure all code is commented and tested
- add_block_to_blockchain 3/4 - blockchain.rs manages Removing non-LC blocks from the blockchain hashmap
- Implement a Double-ended-queue-like Class to hold the Epoch HOT 1
- Naming Conventions HOT 2
- Design epoch stackqueue API HOT 1
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 saito-rust.