-
Notifications
You must be signed in to change notification settings - Fork 100
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
Fix storage snapshot sync #898
Fix storage snapshot sync #898
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job. Correct now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix itself looks legit, let me test it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job,@cschuchardt88
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed for the events with different triggers, but still not fixed for events with the same trigger. The updated code gives wrong hash for the Neo and Gas initial supply Transfer
events (they have Management's hash in the contract
field):
Here's the full updated getapplicationlog
result for the genesis block:
anna@kiwi:~/Documents/GitProjects/nspcc-dev/neo-go$ curl -d '{ "jsonrpc": "2.0", "id": 1, "method": "getapplicationlog", "params": ["0x1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15"] }' localhost:10332 | json_pp
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2725 0 2583 100 142 613k 34558 --:--:-- --:--:-- --:--:-- 887k
{
"id" : 1,
"jsonrpc" : "2.0",
"result" : {
"blockhash" : "0x1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15",
"executions" : [
{
"gasconsumed" : "0",
"notifications" : [
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "/aP6Q0bqUyolj8SX3a3bZDfJ/f8="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "wO85zuDk6SXGwqBqeeFEDdhvzqw="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "G/V1qxGJaIQTYQo1oSiGzeC2bHI="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "vvIEMUA2KnfBUJnH5kwS9wC2Zdo="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Transfer",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "Any"
},
{
"type" : "ByteString",
"value" : "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type" : "Integer",
"value" : "100000000"
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "9WPqQLwoPU0OBcSOowWz8qBzQO8="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Transfer",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "Any"
},
{
"type" : "ByteString",
"value" : "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type" : "Integer",
"value" : "5200000000000000"
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "z3bii9AGLEpHjuNVYQETGfPPpNI="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "e8aBwKH3HVQ0V7aLuo1fn91OXsw="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "4pXjkVRMF4rZTwPsTc3/eFNOz0k="
}
]
}
},
{
"contract" : "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname" : "Deploy",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "ByteString",
"value" : "WIcXEX4KqBByr6tx0t2J/nxLkv4="
}
]
}
}
],
"stack" : [],
"trigger" : "OnPersist",
"vmstate" : "HALT"
},
{
"gasconsumed" : "0",
"notifications" : [
{
"contract" : "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname" : "Transfer",
"state" : {
"type" : "Array",
"value" : [
{
"type" : "Any"
},
{
"type" : "ByteString",
"value" : "lpSe1ILnxgqu7GkVUPGz1ZkUYZQ="
},
{
"type" : "Integer",
"value" : "50000000"
}
]
}
}
],
"stack" : [],
"trigger" : "PostPersist",
"vmstate" : "HALT"
}
]
}
}
@superboyiii, am I doing something wrong? Are you sure you've got the correct result? |
My fault, wrong data was compared in test. Yes, the |
All check out but the The reason for this is because For example block with hash of
|
@cschuchardt88, we need ApplicationLogs plugin to work correctly even for genesis block, it's important. |
This seems to be a problem with @superboyiii @AnnaShaleva var notifyItem = appExecution.Notifications[i];
logStore.PutContractState(notifyItem.ScriptHash, block.Timestamp, i, ContractLogState.Create(appExecution, notifyItem, stackItemStateIds)); |
It seems that the plugin is called before it |
@shargon any reason why |
I don't understand you, could you explain it? the hash for |
@shargon When I receive Correct response {
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Any"
},
{
"type": "Integer",
"value": "17589000"
}
]
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ready for merge.
I don't think so. #898 (review) and #898 (comment) is still not fixed.
36f8e31
76f073d
to
36f8e31
Compare
@AnnaShaleva @superboyiii Test again should be fixed now. There was a memory leak because the project isn't marked as Now I get:{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockhash": "0x1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15",
"executions": [
{
"trigger": "OnPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "/aP6Q0bqUyolj8SX3a3bZDfJ/f8="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "wO85zuDk6SXGwqBqeeFEDdhvzqw="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "G/V1qxGJaIQTYQo1oSiGzeC2bHI="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "vvIEMUA2KnfBUJnH5kwS9wC2Zdo="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "100000000"
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "9WPqQLwoPU0OBcSOowWz8qBzQO8="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "5200000000000000"
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "z3bii9AGLEpHjuNVYQETGfPPpNI="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "e8aBwKH3HVQ0V7aLuo1fn91OXsw="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "4pXjkVRMF4rZTwPsTc3/eFNOz0k="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "WIcXEX4KqBByr6tx0t2J/nxLkv4="
}
]
}
}
]
},
{
"trigger": "PostPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "lpSe1ILnxgqu7GkVUPGz1ZkUYZQ="
},
{
"type": "Integer",
"value": "50000000"
}
]
}
}
]
}
]
}
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I get:
Your result is still not correct. All Deploy notifications have invalid contract hash, and also one Transfer notification has invalid contract hash. The expected result is attached in the "Expected behaviour" section of #897.
@cschuchardt88 You could always check original one by v3.6.2 RPC:
Your current result mistakenly got wrong contract hash for NEO(Not GAS). As we all know 100000000 NEO and 52000000 GAS has been transferred into consensus multisig address in genesis block. That's where these 2 |
My bad forgot to commit. http://seed1.neo.org:10332{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockhash": "0x1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15",
"executions": [
{
"trigger": "OnPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "100000000"
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "5200000000000000"
}
]
}
}
]
},
{
"trigger": "PostPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "lpSe1ILnxgqu7GkVUPGz1ZkUYZQ="
},
{
"type": "Integer",
"value": "50000000"
}
]
}
}
]
}
]
}
} http://127.0.0.1:10332{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockhash": "0x1f4d1defa46faa5e7b9b8d3f79a06bec777d7c26c4aa5f6f5899a291daa87c15",
"executions": [
{
"trigger": "OnPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "/aP6Q0bqUyolj8SX3a3bZDfJ/f8="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "wO85zuDk6SXGwqBqeeFEDdhvzqw="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "G/V1qxGJaIQTYQo1oSiGzeC2bHI="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "vvIEMUA2KnfBUJnH5kwS9wC2Zdo="
}
]
}
},
{
"contract": "0xef4073a0f2b305a38ec4050e4d3d28bc40ea63f5",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "100000000"
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "9WPqQLwoPU0OBcSOowWz8qBzQO8="
}
]
}
},
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "axI92L7HGGSIUrvHhZXjU2oFj58="
},
{
"type": "Integer",
"value": "5200000000000000"
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "z3bii9AGLEpHjuNVYQETGfPPpNI="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "e8aBwKH3HVQ0V7aLuo1fn91OXsw="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "4pXjkVRMF4rZTwPsTc3/eFNOz0k="
}
]
}
},
{
"contract": "0xfffdc93764dbaddd97c48f252a53ea4643faa3fd",
"eventname": "Deploy",
"state": {
"type": "Array",
"value": [
{
"type": "ByteString",
"value": "WIcXEX4KqBByr6tx0t2J/nxLkv4="
}
]
}
}
]
},
{
"trigger": "PostPersist",
"vmstate": "HALT",
"gasconsumed": "0",
"stack": [],
"notifications": [
{
"contract": "0xd2a4cff31913016155e38e474a2c06d08be276cf",
"eventname": "Transfer",
"state": {
"type": "Array",
"value": [
{
"type": "Any"
},
{
"type": "ByteString",
"value": "lpSe1ILnxgqu7GkVUPGz1ZkUYZQ="
},
{
"type": "Integer",
"value": "50000000"
}
]
}
}
]
}
]
}
} |
|
||
namespace ApplicationLogs.Store.Models | ||
{ | ||
public class BlockchainEventModel | ||
{ | ||
public UInt160 ScriptHash { get; private init; } = UInt160.Zero; | ||
public UInt160 ScriptHash { get; private init; } = new(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why create a new empty instance if we have one in memory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its a memory leak. That's the reason why we had this problem with different addresses in the state. It uses the class
instance of UInt160.Zero
when doing ScriptHash.Deserialize()
. It will keep writing to the same buffer; overwriting the previous value. So i need a new instance either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we reuse the same instance, how can be a memory leak?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shargon we are using the same instance. That was the problem. The instance being UInt160.Zero
; overwriting it for each method call.
@AnnaShaleva @superboyiii any update on testing the state? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked the updated version, seems to work correctly now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good from my local results.
Change Log
Note: DO NOT need to resync
Closes #897