-
Notifications
You must be signed in to change notification settings - Fork 4
Comparison of two Ints leads to transaction error 9 — “Cell underflow” #3
Comments
No, this couldn't be a reason. Error is thrown somewhere else. |
@ex3ndr You are right, I found the reason. I'm using native struct DataRaw {
key: Int;
cs: Slice;
f: Int;
}
struct Data {
validUntil: Int as uint64;
payload: Slice;
}
@name(udict_get_next?)
native mapGetNext(map: map[Int]Data, keyLen: Int, pivot: Int): DataRaw;
contract HasMapContract with Deployable, Ownable {
data: map[Int]Data;
receive(msg: Delete) {
// ...code
let nextKey: DataRaw = mapGetNext(self.data, 256, -1);
if(nextKey.key == 1) {
// this if triggers error;
}
} Do you know what is wrong here? I am also looking for a proper way to iterate on the map keys without knowing them. |
I am thinking about a solution, but it is not possible for now. But your dict ops are for unsigned keys, but singed one is defined. |
@ex3ndr I tried to change different types of variables, but still getting errors when interacting with any variable from The declaration looks like this now: struct Data {
validUntil: Int as uint64;
payload: Slice;
}
struct DataRaw {
key: Int? as uint256;
cs: Slice?;
f: Int;
}
@name(udict_get_next?)
native mapGetNext(map: map[Int]Data, keyLen: Int, pivot: Int): DataRaw; I also encountered the inability to determine the dimension of Int in variable and map declaration. // Doesn't work
let key: Int as uint256 = 1;
let map: map[Int]Int = null; // impossible to create new map outside contract definition
struct Data {
map: map[Int as uint256]Int;
} |
Because it currently supports only 257 bit keys |
I'm trying to extend the map, but unfortunately, the compiler does not allow me to do this. @name(udict_get_next?)
extends native mapGetNext(self: map[Int]Int, keyLen: Int, pivot: Int): DataRaw;
As the map represents a Cell I think it is possible to save it as a ref This makes it impossible to work with map as Cell even if change declaration like this: @name(udict_get_next?)
extends native mapGetNext(self: Cell, keyLen: Int, pivot: Int): DataRaw; Because there is no way to convert Map to the Cell e.g. |
You can just create non-extended function, but a just native one |
It doesn't work, for example struct DataRaw {
key: Int;
cs: Slice;
f: Int;
}
@name(udict_get_next?)
native mapGetNext(map: map[Int]Data, keyLen: Int, pivot: Int): DataRaw;
// ...
let nextKey: DataRaw = mapGetNext(self.data, 256, key); // or 257
abi.dump(nextKey.f); Any interaction with |
|
Thanks, it's working! |
what is this code about? And using like |
Code in Tact:
Generated code in Func:
This leads to a transaction error
9
— “Cell underflow”.I suppose generated code should look like this:
The text was updated successfully, but these errors were encountered: