Skip to content
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

deploy: copy transaction expected to be changed #417

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

carpawell
Copy link
Member

The whole makeUnsignedDesignateCommitteeNotaryTx is designed to be called many times if something goes wrong. But currently neo-go's actor shares signers with TXs it produces, so the actor is broken immediately after this func is called. Can be seen only if transaction-to-sign is expired, in practice happened when deployment nodes were started with a huge delay.

@@ -831,6 +831,8 @@ func makeUnsignedDesignateCommitteeNotaryTx(roleContract *rolemgmt.Contract, com
return nil, err
}

tx = tx.Copy()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enough to copy and modify Signers if !tx.Signers[0].Account.Equals(sharedTxData.sender) only

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda hotfix to me, i do not agree with the code here, so something different can be done here in the future. do you really need one more if here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw, this func is called only if !sharedTxDataMatches so suggested if is already done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i do not agree with the code here, so something different can be done here in the future

then issue or to draft

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is kinda hotfix to me

nvm, we dont modify other ref type fields, so copy only Signers

@cthulhu-rider
Copy link
Contributor

shared memory is not the root of the problem. According to the actor concept, the resulting tx should not be modified due to calculated fees. Therefore, we should use a special actor instead of modifying the tx

the closest approach could be TransactionModifier opt, but

MakeUnsigned* methods do not run it.

lets create an issue in Neo Go project to find the best solution

The whole `makeUnsignedDesignateCommitteeNotaryTx` is designed to be called many
times if something goes wrong. But currently neo-go's actor shares signers with
TXs it produces, so the actor is broken immediately after this func is called.
Can be seen only if transaction-to-sign is expired, in practice happened when
deployment nodes were started with a huge delay.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@carpawell carpawell force-pushed the fix/role-setting-breaks-actor branch from 70357c6 to a8d7fbc Compare July 12, 2024 14:14
@carpawell carpawell changed the title deploy: copy transaction expected to be chained deploy: copy transaction expected to be changed Jul 12, 2024
@carpawell
Copy link
Member Author

shared memory is not the root of the problem

What do you mean? We are not allowed to run our tests in some cases. With this PR it can be done now. It either works or not. Do you want to change it to the actors in this PR? Why?

lets create an issue in Neo Go project to find the best solution

How should it sound?

@cthulhu-rider
Copy link
Contributor

cthulhu-rider commented Jul 12, 2024

It either works or not.

definitely it should work. But proposed solution is a crutch to me: modifying actor-prepared txs is unsafe and can lead to incorrect behavior. Since in this case the crutch is working, we can merge it only with issue+FIXME

How should it sound?

i'll do my best to create it

@carpawell
Copy link
Member Author

we can merge it only with issue+FIXME

#418. I want to be sure any bigger change works and want to see if there are more places with similar problems. Currently, I have to concentrate on deployment and just want a fix in the master.

Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roman-khimov roman-khimov merged commit 99fb86c into master Jul 16, 2024
10 checks passed
@roman-khimov roman-khimov deleted the fix/role-setting-breaks-actor branch July 16, 2024 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants