ethereum: Use chainId() getter in initialize

This commit is contained in:
Kevin Peters 2022-09-09 15:04:08 +00:00 committed by kev1n-peters
parent e21d701443
commit 099756fe68
7 changed files with 9 additions and 9 deletions

View File

@ -33,7 +33,7 @@ contract Implementation is Governance {
function initialize() initializer public virtual {
// this function needs to be exposed for an upgrade to pass
uint256 evmChainId;
uint16 chain = _state.provider.chainId;
uint16 chain = chainId();
// Wormhole chain ids explicitly enumerated
if (chain == 2) { evmChainId = 1; // ethereum

View File

@ -163,7 +163,7 @@ contract BridgeGovernance is BridgeGetters, BridgeSetters, ERC1967Upgrade {
require(encoded.length == index, "wrong length");
}
/// @dev Parse a recoverChainId (action 5) with minimal validation
/// @dev Parse a recoverChainId (action 3) with minimal validation
function parseRecoverChainId(bytes memory encodedRecoverChainId) public pure returns (BridgeStructs.RecoverChainId memory rci) {
uint index = 0;
@ -173,7 +173,7 @@ contract BridgeGovernance is BridgeGetters, BridgeSetters, ERC1967Upgrade {
rci.action = encodedRecoverChainId.toUint8(index);
index += 1;
require(rci.action == 5, "wrong action");
require(rci.action == 3, "wrong action");
rci.evmChainId = encodedRecoverChainId.toUint256(index);
index += 32;

View File

@ -18,7 +18,7 @@ contract BridgeImplementation is Bridge {
function initialize() initializer public virtual {
// this function needs to be exposed for an upgrade to pass
uint256 evmChainId;
uint16 chain = _state.provider.chainId;
uint16 chain = chainId();
// Wormhole chain ids explicitly enumerated
if (chain == 2) { evmChainId = 1; // ethereum

View File

@ -100,7 +100,7 @@ contract BridgeStructs {
// Governance Header
// module: "TokenBridge" left-padded
bytes32 module;
// governance action: 5
// governance action: 3
uint8 action;
// EIP-155 Chain ID

View File

@ -160,7 +160,7 @@ contract NFTBridgeGovernance is NFTBridgeGetters, NFTBridgeSetters, ERC1967Upgra
require(encoded.length == index, "invalid UpgradeContract: wrong length");
}
/// @dev Parse a recoverChainId (action 5) with minimal validation
/// @dev Parse a recoverChainId (action 3) with minimal validation
function parseRecoverChainId(bytes memory encodedRecoverChainId) public pure returns (NFTBridgeStructs.RecoverChainId memory rci) {
uint index = 0;
@ -170,7 +170,7 @@ contract NFTBridgeGovernance is NFTBridgeGetters, NFTBridgeSetters, ERC1967Upgra
rci.action = encodedRecoverChainId.toUint8(index);
index += 1;
require(rci.action == 5, "invalid RecoverChainId: wrong action");
require(rci.action == 3, "invalid RecoverChainId: wrong action");
rci.evmChainId = encodedRecoverChainId.toUint256(index);
index += 32;

View File

@ -18,7 +18,7 @@ contract NFTBridgeImplementation is NFTBridge {
function initialize() initializer public virtual {
// this function needs to be exposed for an upgrade to pass
uint256 evmChainId;
uint16 chain = _state.provider.chainId;
uint16 chain = chainId();
// Wormhole chain ids explicitly enumerated
if (chain == 2) { evmChainId = 1; // ethereum

View File

@ -56,7 +56,7 @@ contract NFTBridgeStructs {
// Governance Header
// module: "NFTBridge" left-padded
bytes32 module;
// governance action: 5
// governance action: 3
uint8 action;
// EIP-155 Chain ID