-
Notifications
You must be signed in to change notification settings - Fork 39
Pause/unpause appchain contracts #1072
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
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. |
|
|
||
| // decodeBool expects the canonical encoding produced by packBool. | ||
| // It returns (bool, nil) for 0x00/0x01 in the last byte and errors otherwise. | ||
| func decodeBool(val [32]byte) (bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use the geth abi encoding for this stuff?
Something like:
typ, _ := abi.NewType("bool", "", nil)
args := abi.Arguments{{Type: typ}}
packed, _ := args.Pack(true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
func packBoolABI(b bool) ([32]byte, error) {
var out [32]byte
t, err := abi.NewType("bool", "", nil)
if err != nil { return out, err }
args := abi.Arguments{{Type: t}}
data, err := args.Pack(b) // 32 bytes for single bool
if err != nil { return out, err }
copy(out[:], data)
return out, nil
}
func unpackBoolABI(word [32]byte) (bool, error) {
t, err := abi.NewType("bool", "", nil)
if err != nil { return false, err }
args := abi.Arguments{{Type: t}}
vs, err := args.Unpack(word[:]) // returns []interface{}{bool}
if err != nil { return false, err }
return vs[0].(bool), nil
}
I feel like its even worse than the existing code :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough
Add
set-pauseandget-pauseCLI commands and implementblockchain.IAppChainAdminpause getters/setters to pause or unpause identity update and group message broadcasters in appchain contractsset-pauseandget-pausecommand handling, option parsing, and execution paths in main.go, including newCLIfields andsetPause/getPausefunctions.Target,SetPauseOptions, andGetPauseOptionsin cliOptions.go with flag validation for--targetand--paused.blockchain.IAppChainAdminand implementGetGroupMessagePauseStatus,SetGroupMessagePauseStatus,GetIdentityUpdatePauseStatus, andSetIdentityUpdatePauseStatusin appchainAdmin.go, updating on-chain parameters and invoking broadcasterUpdatePauseStatus, treating error0xa88ee577as a no-op.IDENTITY_UPDATE_PAUSED_KEY,GROUP_MESSAGE_PAUSED_KEY,GetParameterBool,SetBoolParameter, and helperspackBool/decodeBool.📍Where to Start
Start with the CLI command wiring in
parseOptionsand thesetPause/getPausepaths in main.go.Macroscope summarized 5f1f336.