Skip to content

Commit

Permalink
Qa test (#212)
Browse files Browse the repository at this point in the history
* Feature/GBI-1652 - Null script size verification (#208)

* chore: change method of setting github token in workflow

* feat: add null script content validation

* test: add test to null script content validation

* 1.1.2
  • Loading branch information
Luisfc68 authored Feb 20, 2024
1 parent 9f3f698 commit a60c2e5
Show file tree
Hide file tree
Showing 7 changed files with 436 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
node-version: '19.6.0'

- name: NPM Login
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
run: npm config set //npm.pkg.github.com/:_authToken ${{ secrets.GITHUB_TOKEN }}

- name: Install truffle
run: npm install -g truffle
Expand Down
367 changes: 367 additions & 0 deletions .openzeppelin/unknown-31.json
Original file line number Diff line number Diff line change
Expand Up @@ -2541,6 +2541,373 @@
}
}
}
},
"5f8d16007d06cb460d5d9f35efd903dca17132c79941d9ebd70b99c3b405b092": {
"address": "0xf87F5dEEd6F527C62b718a509d65494dfFB8Dc6C",
"txHash": "0x17018de742d304ef560f7a606ceb6c5335e3b47c683d3adde3f7b5f313d25107",
"layout": {
"solcVersion": "0.8.18",
"storage": [
{
"contract": "Initializable",
"label": "_initialized",
"type": "t_uint8",
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:62",
"retypedFrom": "bool"
},
{
"contract": "Initializable",
"label": "_initializing",
"type": "t_bool",
"src": "../@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:67"
},
{
"contract": "ContextUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)50_storage",
"src": "../@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol:36"
},
{
"contract": "OwnableUpgradeable",
"label": "_owner",
"type": "t_address",
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:22"
},
{
"contract": "OwnableUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)49_storage",
"src": "../@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol:94"
},
{
"contract": "ReentrancyGuardUpgradeable",
"label": "_status",
"type": "t_uint256",
"src": "../@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:38"
},
{
"contract": "ReentrancyGuardUpgradeable",
"label": "__gap",
"type": "t_array(t_uint256)49_storage",
"src": "../@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol:80"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "bridge",
"type": "t_contract(Bridge)3208",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:92"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "balances",
"type": "t_mapping(t_address,t_uint256)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:93"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "collateral",
"type": "t_mapping(t_address,t_uint256)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:94"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "pegoutCollateral",
"type": "t_mapping(t_address,t_uint256)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:95"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "liquidityProviders",
"type": "t_mapping(t_uint256,t_struct(LiquidityProvider)7056_storage)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:96"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "callRegistry",
"type": "t_mapping(t_bytes32,t_struct(Registry)7038_storage)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:97"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "resignationBlockNum",
"type": "t_mapping(t_address,t_uint256)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:98"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "minCollateral",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:100"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "minPegIn",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:101"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "rewardP",
"type": "t_uint32",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:103"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "resignDelayInBlocks",
"type": "t_uint32",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:104"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "dust",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:105"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "providerId",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:106"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "btcBlockTime",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:108"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "mainnet",
"type": "t_bool",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:109"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "processedQuotes",
"type": "t_mapping(t_bytes32,t_uint8)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:111"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "registeredPegoutQuotes",
"type": "t_mapping(t_bytes32,t_struct(PegOutQuote)10194_storage)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:112"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "pegoutRegistry",
"type": "t_mapping(t_bytes32,t_struct(PegoutRecord)7043_storage)",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:113"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "productFeePercentage",
"type": "t_uint256",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:115"
},
{
"contract": "LiquidityBridgeContractV2",
"label": "daoFeeCollectorAddress",
"type": "t_address",
"src": "../project:/contracts/LiquidityBridgeContractV2.sol:116"
}
],
"types": {
"t_contract(Bridge)3208": {
"label": "contract Bridge"
},
"t_mapping(t_address,t_uint256)": {
"label": "mapping(address => uint256)"
},
"t_address": {
"label": "address"
},
"t_uint256": {
"label": "uint256"
},
"t_mapping(t_uint256,t_struct(LiquidityProvider)7056_storage)": {
"label": "mapping(uint256 => struct LiquidityBridgeContractV2.LiquidityProvider)"
},
"t_struct(LiquidityProvider)7056_storage": {
"label": "struct LiquidityBridgeContractV2.LiquidityProvider",
"members": [
{
"label": "id",
"type": "t_uint256"
},
{
"label": "provider",
"type": "t_address"
},
{
"label": "name",
"type": "t_string_storage"
},
{
"label": "apiBaseUrl",
"type": "t_string_storage"
},
{
"label": "status",
"type": "t_bool"
},
{
"label": "providerType",
"type": "t_string_storage"
}
]
},
"t_string_storage": {
"label": "string"
},
"t_bool": {
"label": "bool"
},
"t_mapping(t_bytes32,t_struct(Registry)7038_storage)": {
"label": "mapping(bytes32 => struct LiquidityBridgeContractV2.Registry)"
},
"t_bytes32": {
"label": "bytes32"
},
"t_struct(Registry)7038_storage": {
"label": "struct LiquidityBridgeContractV2.Registry",
"members": [
{
"label": "timestamp",
"type": "t_uint32"
},
{
"label": "success",
"type": "t_bool"
}
]
},
"t_uint32": {
"label": "uint32"
},
"t_mapping(t_bytes32,t_uint8)": {
"label": "mapping(bytes32 => uint8)"
},
"t_uint8": {
"label": "uint8"
},
"t_mapping(t_bytes32,t_struct(PegOutQuote)10194_storage)": {
"label": "mapping(bytes32 => struct QuotesV2.PegOutQuote)"
},
"t_struct(PegOutQuote)10194_storage": {
"label": "struct QuotesV2.PegOutQuote",
"members": [
{
"label": "lbcAddress",
"type": "t_address"
},
{
"label": "lpRskAddress",
"type": "t_address"
},
{
"label": "btcRefundAddress",
"type": "t_bytes_storage"
},
{
"label": "rskRefundAddress",
"type": "t_address"
},
{
"label": "lpBtcAddress",
"type": "t_bytes_storage"
},
{
"label": "callFee",
"type": "t_uint256"
},
{
"label": "penaltyFee",
"type": "t_uint256"
},
{
"label": "nonce",
"type": "t_int64"
},
{
"label": "deposityAddress",
"type": "t_bytes_storage"
},
{
"label": "value",
"type": "t_uint256"
},
{
"label": "agreementTimestamp",
"type": "t_uint32"
},
{
"label": "depositDateLimit",
"type": "t_uint32"
},
{
"label": "depositConfirmations",
"type": "t_uint16"
},
{
"label": "transferConfirmations",
"type": "t_uint16"
},
{
"label": "transferTime",
"type": "t_uint32"
},
{
"label": "expireDate",
"type": "t_uint32"
},
{
"label": "expireBlock",
"type": "t_uint32"
},
{
"label": "productFeeAmount",
"type": "t_uint256"
},
{
"label": "gasFee",
"type": "t_uint256"
}
]
},
"t_bytes_storage": {
"label": "bytes"
},
"t_int64": {
"label": "int64"
},
"t_uint16": {
"label": "uint16"
},
"t_mapping(t_bytes32,t_struct(PegoutRecord)7043_storage)": {
"label": "mapping(bytes32 => struct LiquidityBridgeContractV2.PegoutRecord)"
},
"t_struct(PegoutRecord)7043_storage": {
"label": "struct LiquidityBridgeContractV2.PegoutRecord",
"members": [
{
"label": "depositTimestamp",
"type": "t_uint256"
},
{
"label": "completed",
"type": "t_bool"
}
]
},
"t_array(t_uint256)49_storage": {
"label": "uint256[49]"
},
"t_array(t_uint256)50_storage": {
"label": "uint256[50]"
}
}
}
}
}
}
1 change: 1 addition & 0 deletions contracts/LiquidityBridgeContractV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,7 @@ contract LiquidityBridgeContractV2 is Initializable, OwnableUpgradeable, Reentra
require(quote.lbcAddress != address(0), "LBC042");
BtcUtils.TxRawOutput[] memory outputs = BtcUtils.getOutputs(btcTx);
bytes memory scriptContent = BtcUtils.parseNullDataScript(outputs[QUOTE_HASH_OUTPUT].pkScript);
require(scriptContent.length == 33 && scriptContent[0] == 0x20, "LBC075");
// shift the array to remove the first byte (the size)
for (uint8 i = 0 ; i < scriptContent.length - 1; i++) {
scriptContent[i] = scriptContent[i + 1];
Expand Down
3 changes: 2 additions & 1 deletion errorCodes.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
"LBC071": "Intentional overflow on quote values",
"LBC072": "Minimum collateral for registration can't be lower than 0.6 RBTC",
"LBC073": "Resign delay blocks lower than minimal",
"LBC074": "Error sending fee to DAO"
"LBC074": "Error sending fee to DAO",
"LBC075": "Malformed BTC transaction output"
}
Loading

0 comments on commit a60c2e5

Please sign in to comment.