Skip chain id validation in AbstractBridgeAdapter on testnets (#668)

This commit is contained in:
Kyu 2023-02-27 18:18:56 -08:00 committed by GitHub
parent 38665ffc86
commit ec82c42c1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 2 deletions

View File

@ -4,6 +4,9 @@
"changes": [ "changes": [
{ {
"note": "Add KyberElastic mixin for Ethereum, Polygon, Arbitrum, Avalanche" "note": "Add KyberElastic mixin for Ethereum, Polygon, Arbitrum, Avalanche"
},
{
"note": "Skip chain id validation in AbstractBridgeAdapter on testnets"
} }
] ]
}, },

View File

@ -23,8 +23,14 @@ abstract contract AbstractBridgeAdapter is IBridgeAdapter {
assembly { assembly {
chainId := chainid() chainId := chainid()
} }
// Allow testing on Ganache // Skip chain id validation on Ganache (1337), Anvil (31337), Goerli (5), Mumbai (80001), Base Goerli (84531)
if (chainId != expectedChainId && chainId != 1337) { bool skipValidation = (chainId == 1337 ||
chainId == 31337 ||
chainId == 5 ||
chainId == 80001 ||
chainId == 84531);
if (chainId != expectedChainId && !skipValidation) {
revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID"))); revert(string(abi.encodePacked(expectedChainName, "BridgeAdapter.constructor: wrong chain ID")));
} }
} }