Conversation
✅ Deploy Preview for gnochess-signup-form canceled.
|
✅ Deploy Preview for gnochess canceled.
|
zivkovicmilos
left a comment
There was a problem hiding this comment.
Left a few minor comments
Please add some unit tests for the migration functionality 🙏
| package chess | ||
|
|
||
| func checkMigrated() { | ||
| if migrated { |
There was a problem hiding this comment.
if !migrated {return}
...There was a problem hiding this comment.
Do you intend to handle the situation where the realm has not migrated yet? If that is the case, since migrated is a bool, the only stateful change that will happen is if it is true. Why check otherwise?
realm/migrate.gno
Outdated
| } | ||
|
|
||
| func Migrate(newRealmPath string) string { | ||
| // TODO add check for path validity |
There was a problem hiding this comment.
Not sure how to check for path validity at this point. The check should be able to see whether or not there is a ream deployed at newRealmPath.
Edit: added an empty string check for now.
| return true | ||
| } | ||
|
|
||
| func GetOwner() std.Address { |
There was a problem hiding this comment.
Why is this exported?
There was a problem hiding this comment.
So that it can be called by gnokey, as to check who is the owner of realm
realm/migrate.gno
Outdated
| return migratedTo | ||
| } | ||
|
|
||
| // testing commands, todo remove |
There was a problem hiding this comment.
Left it in so its easier for anyone to test currently, will remove before merging
Removed.
Description
This PR introduces ownership & realm migration functionality to the
chesspackage, and addresses issue #56.This PR also introduces an
initfunction to the Chess realm, setting the realm owner to its deployer keypair upon deployment. The following functionality is added:Ownership functionality:
ownervariable is added to realm state,isOwner()will check if the caller is owner and will panic if the caller is not the owner,Migration functionality:
migrateTovariable added to represent the path of new deployment of realmmigratedbool added to indicate if a migration has happened beforeMigratefunction to allow migrating, only callable by current owner of realmcheckMigrated