Ensure the interop types are serializable before commit#3802
Ensure the interop types are serializable before commit#3802
Conversation
|
Thank you for your PR that resolved the testnet halt issue caused by the attack. We definitely support merging it. I’d like to propose a consideration that might lead to a new PR or issue: could we allow all possible outcomes after a successful simulation and block packaging, especially when the transaction simulation results in While the likelihood of an issue like today’s happening again is quite small, logging a high-level error could serve as an early warning. Take it into today’s case: the blockchain won't be halted by the attack, the affected contract might become unreadable due to deserialization failure — which, arguably, is a slightly better outcome. What do you think? |
|
Additionally, I’m wondering if there might be other potential risks beyond the contract checks — could other Shargon has also found the |
Yes, we will deep into it |
It's certainly not an attack, just an accident. People write contracts, people try them on testnet.
Each state change is bound to some execution context by design. The core of the problem is that this assumption is broken, transaction does something and fully succeeds, but then it turns out that the state change is incorrect and should've never happened.
I don't think you can do this. It's pretty similar to the problem of insufficient GAS balance during OnPersist processing. If this happens we're toast, there is no correct behavior when we have a correctly signed block that does something wrong. This can be recovered only via a fork, throwing away a block and creating a new one. |
Perhaps, at the very least, we should have a reminder for others developers — ensuring that every new Or perhaps we should consider simulating the commit process during transaction simulation as well for all kinds of txs. If any errors occur during commit, the simulation shouldn't return a HALT state. |
This can be done in consensus, although the transaction may give a different result (not care because it's a commit test). |
|
We need |
|
But why? You can't do here. The buggy node just stops processing and can't persist this block, nothing happened. Proper ones are perfectly aligned with this PR in behavior, they fail the transaction. |
|
Agree with @roman-khimov , old node doesn't work, so no hf needed |
|
It just occured to me that we can destroy contract as well in the same transaction. Can this be a problem? Frankly I'd rather roll out the fix quickly for mainnet and be done with that. |
|
@neo-project/core please review |
It's a different behaviour and different native contract, you don't know what may happen before next release. Even stateroot is also different when resync. No doubt, it's a hardfork already. |
|
IIUC you don't have any stateroot for testnet block 5557998 with the old node because to get a state root you need a state first and you don't have a state because there is an unserializable thing in the cache. Then if we're to tie this to Echidna the question is how to process testnet block 5557998, it's certainly pre-Echidna (unless you're to set it earlier and require reprocessing), but you can't have the old behavior because it just stops the node completely. Then also mainnet, I won't talk about it much here, but you understand the current state of it perfectly with the unpatched node. |
So nothing breaks on mainnet, but a different storage from block 0 in v3.8.0. You think it works as expected? |
AnnaShaleva
left a comment
There was a problem hiding this comment.
LGTM. May I ask @superboyiii to test this implementation one more time on the "problem" block of Testnet and ensure that it still works properly, because the implementation has been slightly changed comparing to the initial fix.
|
@Jim8y Merge? |
* master: (52 commits) Add SHA512 (#3845) Clean crypto (#3844) Review of #3782 (#3843) [`Fix`] References in `StorageKey` (#3782) Ensure `IInteroperable.Clone` (#3829) Ensure the interop types are serializable before commit (#3802) fix: ModInverse extension in BigIntegerExtensions (#3840) Style: avoid allocating emtpy array (#3841) Style: format json in tests/ (#3839) Reduce mem arguments (#3838) Avoid returning the entire mempool when only `maxTransactionsPerBlock` is required (#3823) style: use proper Assert methods (#3834) Nullable and fix `lock` in `SQLiteWallet` (#3816) [`Add`]: `Witness.Empty` for simplifing somethings (#3836) Style: format too-long literal strings (#3835) Add: NotNullWhen(true) for some out parameters (#3833) Update SQLiteWallet.cs (#3830) Revert "Optimize DeleteAccount" Revert "add lock to Version" Revert "Optimize LoadAccounts" ... # Conflicts: # neo.sln
…3802) * Ensure the manifest is serializable before commit * Rename to AssertIsSerializable * Fix oracle request * Cache when seal * sealInterop * clean changes * Ensure block is serializable * Remove Set interop * Add new one * Add oracle entry * fix typo * Revert ConsensusService.OnMessage.cs * clean --------- Co-authored-by: Jimmy <jinghui@wayne.edu>
Description
Make sure the manifest is serializable before committing it.
Before this commit, a possible error will be thrown during the commit.
Type of change
How Has This Been Tested?
Test Configuration:
Checklist: