-
Notifications
You must be signed in to change notification settings - Fork 221
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
_incidental_ ## Description Define a union type for for BridgeMessage that a `fromBridge` handler can narrow. That revealed an inert bug in `nonce` handling which this also fixes. ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations none ### Testing Considerations CI suffices ### Upgrade Considerations technically affects runtime of vat-bank by correcting the `nonce` handling. But since that case isn't encountered in production I think it's okay to land this and let it be included in whatever future deployment in which that vat is upgraded.
- Loading branch information
Showing
7 changed files
with
86 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { QueuedActionType } from '@agoric/internal/src/action-types.js'; | ||
import type { | ||
CoreEval, | ||
CoreEvalSDKType, | ||
} from '@agoric/cosmic-proto/agoric/swingset/swingset.js'; | ||
|
||
// TODO move `walletFlags.js` from @agoric/vats to @agoric/cosmic-proto | ||
type PowerFlag = 'SMART_WALLET' | 'REMOTE_WALLET'; | ||
|
||
// NB: keep these manually synced until we build these types out of the Golang | ||
// structs or use some other shared type truth | ||
// https://github.com/Agoric/agoric-sdk/issues/8545 | ||
|
||
interface ActionContext<T extends Uppercase<string>> { | ||
type: T; | ||
blockHeight: string; | ||
blockTime: string; | ||
} | ||
|
||
/** | ||
* @see coreEvalAction in proposal.go | ||
*/ | ||
export type CoreEvalAction = ActionContext<'CORE_EVAL'> & { | ||
evals: CoreEvalSDKType[]; | ||
}; | ||
|
||
/** | ||
* @see provisionAction in msg_server.go | ||
*/ | ||
export type PleaseProvisionAction = ActionContext<'PLEASE_PROVISION'> & { | ||
address: string; | ||
nickname: string; | ||
powerFlags: PowerFlag[]; | ||
submitter: string; | ||
autoProvision: boolean; | ||
}; | ||
|
||
/** | ||
* @see VbankBalanceUpdate in vbank.go | ||
*/ | ||
export type VbankBalanceUpdateAction = ActionContext<'VBANK_BALANCE_UPDATE'> & { | ||
nonce: string; | ||
updated: Array<{ address: string; denom: string; amount: string }>; | ||
}; | ||
|
||
export type BridgeMessage = | ||
| CoreEvalAction | ||
| PleaseProvisionAction | ||
| VbankBalanceUpdateAction; |
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// Empty JS file to correspond with types.d.ts | ||
export {}; |
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
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