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

Stop supporting non-notary deployments #324

Merged
merged 10 commits into from
Mar 17, 2023

Conversation

cthulhu-rider
Copy link
Contributor

@cthulhu-rider cthulhu-rider commented Feb 10, 2023

  • clean storage
  • remove non-notary node from methods
  • distribute GAS on Alphabet contract update
  • unit tests

alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
audit/audit_contract.go Show resolved Hide resolved
neofsid/neofsid_contract.go Outdated Show resolved Hide resolved
netmap/netmap_contract.go Outdated Show resolved Hide resolved
netmap/netmap_contract.go Show resolved Hide resolved
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Adding these now, will check tests later.

alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
alphabet/alphabet_contract.go Outdated Show resolved Hide resolved
balance/balance_contract.go Outdated Show resolved Hide resolved
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Have you tried it on the mainnet data?


// UpdateModel describes storage migration model of some Neo contract. Zero update model
// describes empty post-update contract storage.
type UpdateModel struct {
Copy link
Member

Choose a reason for hiding this comment

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

This model describes change set in terms of KV pairs, which is fine when:

  • we delete some key or a set of keys with some prefix and want to ensure it's gone
  • we specifically add some key or a set of keys and want to ensure they're present
  • we want to make sure no excessive elements are added

But it's suboptimal when we're dealing with changes. Consider our netmap 0.16.0 migration problem (df2bad0), if we have this omission in the contract we're quite likely to have the same omission in the test, but calling contract APIs could quickly reveal the problem, so I'd say we should describe these in terms of API calls (test invocations) that should have the same (or intentionally different if needed) result before the migration and after the migration.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IMO these are two different tests:

  1. migration of storage items from one format to another
  2. ability of new contract executable to correctly decode new format

2nd won't help us if there is no corresponding values in the contract at all. But I agree that such API extra check will help us to feel more comfortable.

Copy link
Member

Choose a reason for hiding this comment

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

Well, if you're to rely on 2 then you'll catch problems with 1 as well. Contract APIs is what gives access to this data, outside users don't care much about KVs behind these APIs. So I'd say API-bound model is stronger. It may be nontrivial to test in some cases, but it's stronger in general.

tests/migration/storage.go Outdated Show resolved Hide resolved
tests/migration/storage.go Outdated Show resolved Hide resolved
// 5.
contractUpd := newContractUpdater(tb, bLocal, opts.SourceCodeDir, localContract)

for _, updFail := range opts.UpdateFailures {
Copy link
Member

Choose a reason for hiding this comment

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

These better be independent t.Run() and maybe better in the test itself.

tests/migration/storage.go Outdated Show resolved Hide resolved
@cthulhu-rider cthulhu-rider force-pushed the 303-drop-non-notary branch 5 times, most recently from a32980a to fca6c3a Compare March 3, 2023 15:56
@cthulhu-rider cthulhu-rider marked this pull request as ready for review March 16, 2023 13:21
roman-khimov added a commit to nspcc-dev/neofs-node that referenced this pull request Mar 16, 2023
@cthulhu-rider cthulhu-rider force-pushed the 303-drop-non-notary branch 3 times, most recently from 5629bfc to 04af510 Compare March 17, 2023 13:18
Upgrade to the latest revisions of `neo-go`, `pkg/interop` and `testify`
modules.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Make update routine to panic if `notaryDisabled` flag is set. Remove all
notary-less artifacts from the contract (storage and methods) on update.
Prevent from updating during pending votes. Make GAS transfers on
Alphabet contract's update.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Add `tests/dump` package with `Creator` and `Reader` types which provide
I/O operations of contract states (including storages).

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Add `cmd/dump` command which accepts Neo RPC endpoint of the NeoFS
network and dumps NeoFS contracts into `testdata` directory.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
In previous implementation `common.CheckVersion` allowed contract to be
updated to earlier versions. This could be a problem since currently
forward-only updates are supported.

Make `common.CheckVersion` to panic if original contract version is less
than `common.Version` one.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
`defaultRegisterPrice` constant is used in `_deploy` function of the NNS
contract.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@roman-khimov roman-khimov merged commit 6448e23 into nspcc-dev:master Mar 17, 2023
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Jan 12, 2024
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Jan 12, 2024
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Jan 15, 2024
After fb13ef9, it is now possible not to create
an additional notary request but to sign the original one. See also
nspcc-dev/neofs-contract#324 that includes SN in a
netmap with `AddPeer` netmap call only (without the formly required `AddPeerIR`
call). Closes #830.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
carpawell added a commit to nspcc-dev/neofs-node that referenced this pull request Jan 15, 2024
After fb13ef9, it is now possible not to create
an additional notary request but to sign the original one. See also
nspcc-dev/neofs-contract#324 that includes SN in a
netmap with `AddPeer` netmap call only (without the formly required `AddPeerIR`
call). Closes #830.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
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.

Drop notary-less code and data from all contracts except mainnet one
2 participants