-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Leonard Lyubich <ctulhurider@gmail.com>
- Loading branch information
1 parent
75edfcb
commit 1cc44e9
Showing
5 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,73 @@ | ||
package container | ||
package container_test | ||
|
||
import ( | ||
"math/rand" | ||
"testing" | ||
|
||
"github.com/nspcc-dev/neo-go/pkg/util" | ||
"github.com/nspcc-dev/neofs-contract/tests/migration" | ||
) | ||
|
||
func randContractAddress() (res util.Uint160) { | ||
rand.Read(res[:]) | ||
return | ||
} | ||
|
||
func TestMigration_TestNet_0_16_0_to_0_17_0(t *testing.T) { | ||
const rootDomain = "neofs1" // must not equal to 'neofs' | ||
|
||
deployCfg := migration.DeployWithArguments( | ||
true, // Non-notary mode | ||
util.Uint160{}, // Netmap contract | ||
util.Uint160{}, // Balance contract | ||
util.Uint160{}, // NeoFSID contract | ||
util.Uint160{}, // NNS contract | ||
rootDomain, // NNS root domain | ||
) | ||
|
||
netmapContract := randContractAddress() | ||
balanceContract := randContractAddress() | ||
neoFSIDContract := randContractAddress() | ||
nnsContract := randContractAddress() | ||
|
||
validUpdCfg := migration.UpdateWithArguments( | ||
false, | ||
netmapContract, | ||
balanceContract, | ||
neoFSIDContract, | ||
nnsContract, | ||
rootDomain, | ||
) | ||
|
||
migration.TestRemoteStorageMigration(t, "https://rpc1.morph.t5.fs.neo.org:51331", "container", migration.Options{ | ||
OnNNSDeploy: func(cfg *migration.DeployConfig, nnsContract util.Uint160) { | ||
cfg.SetArgI(4, nnsContract) | ||
}, | ||
DeployConfig: deployCfg, | ||
UpdateFailures: []migration.UpdateFailScenario{ | ||
migration.InvalidConfigFailure("update to non-notary mode is not supported anymore", | ||
validUpdCfg.ReplaceArgI(0, true), | ||
), | ||
}, | ||
ValidUpdateConfig: validUpdCfg, | ||
UpdateModel: migration.MultiGroupUpdateModel( | ||
migration.RemovedSingleItem("notary"), | ||
migration.PersistedSingleItem("netmapScriptHash"), | ||
migration.PersistedSingleItem("balanceScriptHash"), | ||
migration.PersistedSingleItem("identityScriptHash"), | ||
migration.PersistedSingleItem("nnsScriptHash"), | ||
migration.PersistedSingleItem("nnsRoot"), | ||
migration.PersistedItemsWithPrefix("o"), | ||
migration.PersistedItemsWithPrefix("x"), | ||
migration.PersistedItemsWithPrefix("cnr"), | ||
migration.PersistedItemsWithPrefix("est"), | ||
migration.PersistedItemsWithPrefix("nnsHasAlias"), | ||
migration.ReplacedItemsWithKeyLength(32, func(prevKey []byte) []byte { | ||
return append([]byte{'x'}, prevKey...) | ||
}), | ||
migration.ReplacedItemsWithKeyLength(25+32, func(prevKey []byte) []byte { | ||
return append([]byte{'o'}, prevKey...) | ||
}), | ||
), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters