Comments (2)
A partly "Rust specific" example:
LogicSignature
is modeled after the algod REST API:
pub struct LogicSignature {
#[serde(rename = "l")]
pub logic: Vec<u8>,
pub sig: Option<Signature>,
pub msig: Option<MultisigSignature>,
#[serde(rename = "arg")]
pub args: Vec<Vec<u8>>,
}
this struct is used in the domain too, which isn't ideal. As far I understand having both sig
and msig
set is illegal (it at least fails the verification). A sum type would represent this better:
enum Sig {
Sig(Signature),
Msig(MultisigSignature),
}
New domain type:
pub struct LogicSignature {
pub logic: Vec<u8>,
pub sig: Option<Sig>,
pub args: Vec<Vec<u8>>,
}
Now we can't have the illegal state. It could be expanded further, to not need an optional:
enum Sig {
ContractAccount
Sig(Signature),
Msig(MultisigSignature),
}
pub struct LogicSignature {
pub logic: Vec<u8>,
pub sig: Sig,
pub args: Vec<Vec<u8>>,
}
And now we can remove already almost half of the Java SDK's verification method and related Unit Tests
The problem with these type of changes is that e.g. Java doesn't have sum types, so they can't be proposed there. @manuelmauro thoughts?
from algonaut.
Cleared internally:
- The SDK will prioritize idiomatic Rust.
- For refactorings not related with above, we will submit issues to the Go SDK, when it's possible to keep the APIs similar.
from algonaut.
Related Issues (20)
- `Transaction::note` is a base64 string, but should probably be decoded. HOT 1
- Indexer just launched new version. HOT 5
- ABI support
- Atomic Transaction Composer support
- Consider adding checked arithmetic operations to `MicroAlgos`
- Populate `PendingTransaction.txn`
- Newtypes for app id, asset id, tx id HOT 5
- OpenAPI basic functionality
- OpenAPI types customization
- Add traits for a leaner transaction creation API HOT 4
- Support request retry?
- Add GetApplicationAddress from Algorand SDK HOT 2
- Automated tests stopped working
- Review crate structure HOT 1
- Example `key_reg` stopped working
- Add support for Boxes HOT 11
- Build error when importing `algonaut_transaction` HOT 2
- Implement Logic Crate HOT 2
- querying by tx id fails HOT 1
- Implement Clone on Algod
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 algonaut.