-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Strange Packed Encoding Output #94
Comments
Copying from #103 When running RibbonThetaVault the struct at index StorageSlot {
index: 203,
offset: 0,
typ: Mapping {
key_type: Address,
value_type: Struct {
elements: [
StructElement {
offset: 0,
typ: Any,
},
StructElement { // first appearance
offset: 16,
typ: Any,
},
StructElement {
offset: 104,
typ: Any,
},
StructElement { // second appearance
offset: 16,
typ: Bytes {
length: Some(
16,
),
},
},
StructElement {
offset: 144,
typ: Any,
},
],
},
},
}, Run the contract Bytecode
Expected BehaviourOffset |
I've not spent time digging into this, but I have a suspicion as to why it is arising:
I'm not sure exactly how to fix this right now, but one thought I have is to add a final loop over type variables to forcibly flatten these things and then run unification again. This will likely have performance impact, but the infrequency of these cases should keep it relatively small. |
Another contract with a similar issue Running DRPToken outputs offsets Bytecode
Output // prev slot
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 0,
"type": "address"
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 160,
"type": {
"bytes": {
"length": 2
}
}
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 176,
"type": {
"u_int": {
"size": 16
}
}
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 192,
"type": "any"
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 192,
"type": {
"number": {
"size": 8
}
}
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 200,
"type": {
"number": {
"size": 8
}
}
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 208,
"type": {
"number": {
"size": 8
}
}
},
{
"index": "0x000000000000000000000000000000000000000000000000000000000000000c",
"offset": 352, // greater than 256 which should not be possible
"type": "infinite_type"
},
// next slot |
Describe the Bug
Sometimes we infer extra members in packed encodings that change their length (e.g.
kakigori.rs
slot 15's struct) or duplicate entries at a given offset (e.g.uniswap_v3_pool.rs
slot 0).To Reproduce
Steps to reproduce the behavior:
Expected Behaviour
We don't have spurious trailing items in structs that change the number of words it should take up. Similarly, we don't have duplicate or bogus entries in structs.
Note that this is not talking about the same thing as #80 as in that case the extra tails still fit within the overall word length of the struct.
The text was updated successfully, but these errors were encountered: