Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Scroll bug #32

Merged
merged 3 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Quorum/apis/block_explorers/chains_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ChainAPI:
Chain.GNO: 100,
Chain.OPT: 10,
Chain.POLY: 137,
Chain.SCR: 534352,
Chain.SCROLL: 534352,
Chain.ZK: 324
}

Expand Down
2 changes: 1 addition & 1 deletion Quorum/apis/price_feeds/chainlink_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ChainLinkAPI(PriceFeedProviderBase):
Chain.MET: "https://reference-data-directory.vercel.app/feeds-ethereum-mainnet-andromeda-1.json",
Chain.OPT: "https://reference-data-directory.vercel.app/feeds-ethereum-mainnet-optimism-1.json",
Chain.POLY: "https://reference-data-directory.vercel.app/feeds-matic-mainnet.json",
Chain.SCR: "https://reference-data-directory.vercel.app/feeds-ethereum-mainnet-scroll-1.json",
Chain.SCROLL: "https://reference-data-directory.vercel.app/feeds-ethereum-mainnet-scroll-1.json",
Chain.ZK: "https://reference-data-directory.vercel.app/feeds-ethereum-mainnet-zksync-1.json"
}

Expand Down
2 changes: 1 addition & 1 deletion Quorum/apis/price_feeds/coingecko_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CoinGeckoAPI(PriceFeedProviderBase):
Chain.MET: 'metis-andromeda',
Chain.OPT: 'optimistic-ethereum',
Chain.POLY: 'polygon-pos',
Chain.SCR: 'scroll',
Chain.SCROLL: 'scroll',
Chain.ZK: 'zksync',
}

Expand Down
17 changes: 9 additions & 8 deletions Quorum/check_proposal.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def parse_args() -> tuple[Optional[str], Optional[str], Optional[str], Optional[
parser = argparse.ArgumentParser(description="Fetch and compare smart contract source code.")
parser.add_argument('--config', type=load_config, help="Path to JSON configuration file.")
parser.add_argument('--customer', type=str, help="Customer name or identifier.")
parser.add_argument('--chain', type=str, choices=[chain.value for chain in Chain], help="Blockchain chain.")
parser.add_argument('--chain', type=Chain, choices=[chain.value for chain in Chain], help="Blockchain chain.")
parser.add_argument('--proposal_address', type=arg_valid.validate_address, help="Ethereum proposal address.")
args = parser.parse_args()

Expand All @@ -48,7 +48,7 @@ def load_config(config_path: str) -> dict[str, Any] | None:
pp.pretty_print(f"Failed to parse given config file {config_path}:\n{e}", pp.Colors.FAILURE)


def proposals_check(customer: str, chain_name: str, proposal_addresses: list[str], providers: list[PriceFeedProviderBase]) -> None:
def proposals_check(customer: str, chain: Chain, proposal_addresses: list[str], providers: list[PriceFeedProviderBase]) -> None:
"""
Check and compare source code files for given proposals.

Expand All @@ -60,7 +60,6 @@ def proposals_check(customer: str, chain_name: str, proposal_addresses: list[str
proposal_addresses (list[str]): List of proposal addresses.
providers (list[PriceFeedProviderInterface]): List of price feed providers.
"""
chain = Chain[chain_name.upper()]
api = ChainAPI(chain)

pp.pretty_print(f"Processing customer {customer}, for chain: {chain}", pp.Colors.INFO)
Expand Down Expand Up @@ -90,26 +89,28 @@ def main() -> None:
This function determines whether to run in single-task mode using command line arguments
or multi-task mode using a JSON configuration file.
"""
config_data, customer, chain_name, proposal_address = parse_args()
config_data, customer, chain, proposal_address = parse_args()

if config_data:
# Multi-task mode using JSON configuration
for customer, chain_info in config_data.items():
ground_truth_config = ConfigLoader.load_customer_config(customer)
GitManager(customer, ground_truth_config).clone_or_update()
price_feed_providers = ground_truth_config.get("price_feed_providers", [])
for chain_name, proposals in chain_info.items():
for chain, proposals in chain_info.items():
# Validate chain is supported by cast to Chain enum
chain = Chain(chain)
if proposals["Proposals"]:
proposals_check(customer, chain_name, proposals["Proposals"], price_feed_providers)
proposals_check(customer, chain, proposals["Proposals"], price_feed_providers)
else:
# Single-task mode using command line arguments
if not (customer and chain_name and proposal_address):
if not (customer and chain and proposal_address):
raise ValueError("Customer, chain, and proposal_address must be specified if not using a config file.")

ground_truth_config = ConfigLoader.load_customer_config(customer)
GitManager(customer, ground_truth_config).clone_or_update()
price_feed_providers = ground_truth_config.get("price_feed_providers", [])
proposals_check(customer, chain_name, [proposal_address], price_feed_providers)
proposals_check(customer, chain, [proposal_address], price_feed_providers)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion Quorum/execution.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"0x2dbBe7E30CD959A192FeFCEd9A5ae681d540deB4"
]
},
"SCR": {
"SCROLL": {
"Proposals": []
}
}
Expand Down
2 changes: 1 addition & 1 deletion Quorum/tests/blockchain_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@pytest.mark.parametrize(
"chain, contract_address",
[
(Chain.SCR, "0x32f924C0e0F1Abf5D1ff35B05eBc5E844dEdD2A9"),
(Chain.SCROLL, "0x32f924C0e0F1Abf5D1ff35B05eBc5E844dEdD2A9"),
(Chain.ZK, "0x162C97F6B4FA5a915A44D430bb7AE0eE716b3b87")
]
)
Expand Down
2 changes: 1 addition & 1 deletion Quorum/utils/chain_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ class Chain(StrEnum):
MET = 'MET'
OPT = 'OPT'
POLY = 'POLY'
SCR = 'SCROLL'
SCROLL = 'SCROLL'
ZK = 'ZKSYNC'
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20241219.205415.908218
20241222.122915.295415