Skip to content
Open
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
26 changes: 16 additions & 10 deletions tests/test_before_pectra_upgrade_holesky.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
CS_VERIFIER_ADDRESS_OLD = "0x6FDAA094227CF8E1593f9fB9C1b867C1f846F916"
CSM_ADDRESS = "0x4562c3e63c2e586cD1651B958C22F88135aCAd4f"

WITHDRAWAL_QUEUE_IMPL = "0xFF72B5cdc701E9eE677966B2702c766c38F412a4"
VALIDATORS_EXIT_BUS_ORACLE_IMPL = "0x210f60EC8A4D020b3e22f15fee2d2364e9b22357"
CSMODULE_IMPL = "0x4f1A40030DEF950B9F7f76D035E2e2FBE0DBda2c"
CSACCOUNTING_IMPL = "0x1AbB5aB020aA436fa69d6143EDA8C641f8E9B29B"
CS_FEE_ORACLE_IMPL = "0x931B4eD8d556944dfE93694fdB94a0AD08c0F625"

DAI_TOKEN = "0x2EB8E9198e647f80CCF62a5E291BCD4a5a3cA68c"
USDT_TOKEN = "0x86F6c353A0965eB069cD7f4f91C1aFEf8C725551"
USDC_TOKEN = "0x9715b2786F1053294FC8952dF923b95caB9Aac42"
Expand Down Expand Up @@ -373,25 +379,25 @@ def test_vote(helpers, accounts, vote_ids_from_env, bypass_events_decoding, stra
)

# Grant PAUSE_ROLE on WithdrawalQueue for the new GateSeal
validate_grant_role_event(events[18], PAUSE_ROLE, NEW_GATE_SEAL, contracts.agent)
validate_grant_role_event(events[18], PAUSE_ROLE, NEW_GATE_SEAL, contracts.agent, WITHDRAWAL_QUEUE_IMPL)
# Grant PAUSE_ROLE on ValidatorExitBusOracle for the new GateSeal
validate_grant_role_event(events[19], PAUSE_ROLE, NEW_GATE_SEAL, contracts.agent)
validate_grant_role_event(events[19], PAUSE_ROLE, NEW_GATE_SEAL, contracts.agent, VALIDATORS_EXIT_BUS_ORACLE_IMPL)
# Revoke PAUSE_ROLE on WithdrawalQueue from the old GateSeal
validate_revoke_role_event(events[20], PAUSE_ROLE, OLD_GATE_SEAL, contracts.agent)
validate_revoke_role_event(events[20], PAUSE_ROLE, OLD_GATE_SEAL, contracts.agent, WITHDRAWAL_QUEUE_IMPL)
# Revoke PAUSE_ROLE on ValidatorExitBusOracle from the old GateSeal
validate_revoke_role_event(events[21], PAUSE_ROLE, OLD_GATE_SEAL, contracts.agent)
validate_revoke_role_event(events[21], PAUSE_ROLE, OLD_GATE_SEAL, contracts.agent, VALIDATORS_EXIT_BUS_ORACLE_IMPL)
# Grant PAUSE_ROLE on CSModule for the new CSMGateSeal
validate_grant_role_event(events[22], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent)
validate_grant_role_event(events[22], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent, CSMODULE_IMPL)
# Grant PAUSE_ROLE on CSAccounting for the new CSMGateSeal
validate_grant_role_event(events[23], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent)
validate_grant_role_event(events[23], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent, CSACCOUNTING_IMPL)
# Grant PAUSE_ROLE on CSFeeOracle from the old CSMGateSeal
validate_grant_role_event(events[24], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent)
validate_grant_role_event(events[24], PAUSE_ROLE, NEW_CSM_GATE_SEAL, contracts.agent, CS_FEE_ORACLE_IMPL)
# Revoke PAUSE_ROLE on CSModule from the old CSMGateSeal
validate_revoke_role_event(events[25], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent)
validate_revoke_role_event(events[25], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent, CSMODULE_IMPL)
# Revoke PAUSE_ROLE on CSAccounting from the old CSMGateSeal
validate_revoke_role_event(events[26], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent)
validate_revoke_role_event(events[26], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent, CSACCOUNTING_IMPL)
# Revoke PAUSE_ROLE on CSFeeOracle from the old CSMGateSeal
validate_revoke_role_event(events[27], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent)
validate_revoke_role_event(events[27], PAUSE_ROLE, OLD_CSM_GATE_SEAL, contracts.agent, CS_FEE_ORACLE_IMPL)

# Validate EasyTrack events
validate_evmscript_factory_added_event(
Expand Down
8 changes: 6 additions & 2 deletions utils/test/event_validators/permission.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def validate_permission_grantp_event(event: EventDict, p: Permission, params: Li
assert event["SetPermissionParams"]["paramsHash"] == params_hash


def validate_grant_role_event(events: EventDict, role: str, grant_to: str, sender: str) -> None:
def validate_grant_role_event(events: EventDict, role: str, grant_to: str, sender: str, emitted_by: str=None) -> None:
# this event chain is actual if grant role is forvarded through
_events_chain = ["LogScriptCall", "LogScriptCall", "RoleGranted", "ScriptResult"]

Expand All @@ -96,9 +96,11 @@ def validate_grant_role_event(events: EventDict, role: str, grant_to: str, sende
assert events["RoleGranted"]["role"] == role, "Wrong role"
assert events["RoleGranted"]["account"] == grant_to, "Wrong account"
assert events["RoleGranted"]["sender"] == sender, "Wrong sender"
if emitted_by is not None:
assert events["RoleGranted"]["_emitted_by"] == emitted_by, "Wrong event emitter"


def validate_revoke_role_event(events: EventDict, role: str, revoke_from: str, sender: str) -> None:
def validate_revoke_role_event(events: EventDict, role: str, revoke_from: str, sender: str, emitted_by: str=None) -> None:
_events_chain = ["LogScriptCall", "LogScriptCall", "RoleRevoked", "ScriptResult"]

validate_events_chain([e.name for e in events], _events_chain)
Expand All @@ -108,3 +110,5 @@ def validate_revoke_role_event(events: EventDict, role: str, revoke_from: str, s
assert events["RoleRevoked"]["role"] == role, "Wrong role"
assert events["RoleRevoked"]["account"] == revoke_from, "Wrong account"
assert events["RoleRevoked"]["sender"] == sender, "Wrong sender"
if emitted_by is not None:
assert events["RoleRevoked"]["_emitted_by"] == emitted_by, "Wrong event emitter"
8 changes: 8 additions & 0 deletions utils/test/tx_tracing_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ def display_voting_events(tx: TransactionReceipt) -> None:

def group_voting_events(tx: TransactionReceipt) -> List[EventDict]:
events = tx_events_from_trace(tx)

def add_event_emitter(event):
event['data'].append({'name': '_emitted_by', 'type': 'address', 'value': event['address'], 'decoded': True})
return event

# manually add event emitter address because it is dropped by EventDict class
events = [add_event_emitter(e) for e in events]

groups = [_vote_item_group, _service_item_group]

grouped_events = group_tx_events(events, EventDict(events), groups)
Expand Down
Loading