def secret_registry_batch_happy_path( web3: Web3, secret_registry_proxy: SecretRegistry) -> None: secrets = [make_secret() for i in range(4)] secrethashes = [sha256_secrethash(secret) for secret in secrets] secret_registered_filter = secret_registry_proxy.secret_registered_filter( GENESIS_BLOCK_NUMBER) secret_registry_proxy.register_secret_batch(secrets=secrets) logs = [ secret_registry_proxy.proxy.decode_event(log) for log in secret_registered_filter.get_new_entries(web3.eth.blockNumber) ] for secrethash in secrethashes: secret_registered = must_have_event(logs, { "event": "SecretRevealed", "args": { "secrethash": secrethash } }) assert secret_registered, "All secrets from the batch must be registered" block = secret_registry_proxy.get_secret_registration_block_by_secrethash( secrethash=secrethash, block_identifier="latest") msg = "Block number reported by the proxy and the event must match" assert block == secret_registered["blockNumber"], msg
def secret_registry_batch_happy_path( proxy_manager: ProxyManager, secret_registry_proxy: SecretRegistry) -> None: secrets = [make_secret() for i in range(4)] secrethashes = [sha256_secrethash(secret) for secret in secrets] secret_registry_proxy.register_secret_batch(secrets=secrets) logs = get_secret_registry_events( proxy_manager=proxy_manager, secret_registry_address=secret_registry_proxy.address, contract_manager=secret_registry_proxy.contract_manager, ) for secrethash in secrethashes: secret_registered = must_have_event(logs, { "event": "SecretRevealed", "args": { "secrethash": secrethash } }) assert secret_registered, "All secrets from the batch must be registered" block = secret_registry_proxy.get_secret_registration_block_by_secrethash( secrethash=secrethash, block_identifier=BLOCK_ID_LATEST) msg = "Block number reported by the proxy and the event must match" assert block == secret_registered["block_number"], msg