You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
The createTerminatedStateAccount function creates an entry in the terminated state substore.
defcreateTerminatedStateAccount(chainID: ChainID, stateRoot: bytes=EMPTY_BYTES) ->None:
ifchainAccount(chainID) exists:
chainAccount(chainID).status=CHAIN_STATUS_TERMINATEDremovetheentrywithstoreKey=chainIDfromtheoutboxrootsubstore# If no stateRoot is given as input, get it from the stateiflen(stateRoot) ==0:
stateRoot=chainAccount(chainID).lastCertificate.stateRootterminatedState= {
"stateRoot": stateRoot,
"mainchainStateRoot": EMPTY_BYTES,
"initialized": True
}
# Emit chain status updated event.emitEvent(
module=MODULE_NAME_INTEROPERABILITY,
name=EVENT_NAME_CHAIN_ACCOUNT_UPDATED,
data=chainAccount(chainID),
topics= [chainID]
)
# State root is not available, set it to empty bytes temporarily.# This should only happen on a sidechain.else:
# Processing on the mainchainifownChainAccount.chainID==CHAIN_ID_MAINCHAIN:
# If the account does not exist on the mainchain, the input chainID is invalid.raiseException('Chain to be terminated is not valid.')
terminatedState= {
"stateRoot": EMPTY_BYTES,
"mainchainStateRoot": chainAccount(CHAIN_ID_MAINCHAIN).lastCertificate.stateRoot,
"initialized": False
}
createanentryintheterminatedstatesubstorewithstoreKey=chainIDstoreValue=encode(terminatedStateAccountSchema, terminatedState)
emitEvent(
module=MODULE_NAME_INTEROPERABILITY,
name=EVENT_NAME_TERMINATED_STATE_CREATED,
data=terminatedState,
topics= [chainID]
)
(#7675)
### What was the problem?
This PR resolves#7559
### How was it solved?
- Updated `createTerminatedState`
### How was it tested?
Added unit tests
Description
The
createTerminatedStateAccount
function creates an entry in the terminated state substore.Acceptance Criteria
Additional Information
The text was updated successfully, but these errors were encountered: