Comments (8)
This commit adds std::ops::{Add, AddAssign}
implementations for Key
for u32
and u64
.
- Signed versions will follow.
- Concerns about adding another
std::ops::Sub
andstd::ops::SubAssign
implementation. - Also we could add something similar to a ptrdiff with
std::ops::Sub<Key> for Key
impl. However, what return type should it have?
from ink.
Commits 8880390 and 10e5f15 remove Key::with_chunk_offset
and Key::with_offset
in favor of the new core::ops::{Add, AddAssign}
implementations.
from ink.
Commit 42c490b marks Env::load
as unsafe fn since it compares itself with a pointer deref in Rust which is also known as being an unsafe operation.
Changes to Env::store
and Env::clear
will follow with the same reasoning.
from ink.
Commit bb2e8ee marks the other Env::{store, clear}
fns as unsafe
as the previous commit.
This shall guide users of pdsl_core
to use the safer cell
, chunk
and collections
abstractions.
from ink.
Commit 89b0be5 adds core::ops::Sub impl for Key
and the KeyDiff
type.
Look at commit 4509914 on how to use this new interface.
Currently missing are some unit tests for KeyDiff
.
Edit: Commit b91fb4a adds simple unit tests for KeyDiff
.
from ink.
Missing pieces:
impl core::ops::Sub<{u32, u64, u128}> for Key
impl core::ops::Add<u128> for Key
impl core::ops::Add<{i32, i64, i128}> for Key
. Note that this hasn't been made yet since the unsigned variants can be implemented a bit more efficiently. This might not be transparent to users so could lead to a slight performance degradation when using signed instead of unsigned after implementing this. Besides that these trait implementations are for convenience. This requires abyte_utils::sign_extend
procedure to sign extend thei32
,i64
ori128
to the 32 byte of a key in order to subtract or add from or to it.
from ink.
Besides other things this commit adds core::ops::{Sub, SubAssign}
implementations for Key
.
Also during implementation we found out that core::ops::{Add,AddAssign,Sub,SubAssign}
implementations for RHS = {i32,i64,i128}
do not make sense and are semantically difficult to articulate on Key
instances so it is better to leave them away and stay with the unsigned variants that have a semantically clear usage story.
So after removing this work item what is missing is implementations of core::ops::{Add,AddAssign,Sub,SubAssign}
ofu128
for Key
and also a conversion impl from KeyDiff
to u128
.
from ink.
The remaining parts have been implemented in 966d29d, bc711cb and 09b7bbd.
from ink.
Related Issues (20)
- The function `set_contract_storage` in integration test it's missing a size check.
- Linter: Unprotected `terminate_contract`
- Linter: Unprotected `DelegateCall` call
- Immutable contracts allowed to change state via `env` HOT 4
- Add a lint for missing `no_main`
- IIP-3: Allow messages without `&self` receiver; opt out of automatic storage loading HOT 5
- Different gas value for `weight_to_fee()` in ink! integration and e2e tests HOT 6
- Split up `ink_linting` into two `dylint` libraries HOT 1
- Use standard Github's machines for test jobs
- Linter: Warn about using non-fallible APIs for `Lazy` and `Mapping` HOT 1
- Support expressions for `extension` and `function` during chain extension definition
- Event defintions with generics
- Deprecation of "legacy" inline events HOT 1
- Unify `call-runtime` and `e2e-call-runtime` examples
- Linter: Dangereous `self.env().transferred_value()` pattern
- Linter: Divide before multiply
- Add support and integration test for `caller_is_root`
- Migrate ink! CI from organization runners to standard GitHub runners
- Add links to linter warning details on use.ink
- Cross contract calling produces unsupported code 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 ink.