Skip to content

Snapshot test for stake table events #3769

@sveitser

Description

@sveitser

Changing names or types of events changes their signatures, which will break consensus because older versions of the rust code may use outdated event signatures to filter events. We need to add snapshot tests that show when a breaking change is made to the stake table contract.

These are the signatures

.events([
ValidatorRegistered::SIGNATURE,
ValidatorRegisteredV2::SIGNATURE,
ValidatorExit::SIGNATURE,
ValidatorExitV2::SIGNATURE,
Delegated::SIGNATURE,
Undelegated::SIGNATURE,
UndelegatedV2::SIGNATURE,
ConsensusKeysUpdated::SIGNATURE,
ConsensusKeysUpdatedV2::SIGNATURE,
CommissionUpdated::SIGNATURE,
])

We should also capture the fact that these are consensus events more clearly in the code, like we do for the events themselves

#[derive(Clone, derive_more::From, PartialEq, serde::Serialize, serde::Deserialize)]
pub enum StakeTableEvent {
Register(ValidatorRegistered),
RegisterV2(ValidatorRegisteredV2),
Deregister(ValidatorExit),
DeregisterV2(ValidatorExitV2),
Delegate(Delegated),
Undelegate(Undelegated),
UndelegateV2(UndelegatedV2),
KeyUpdate(ConsensusKeysUpdated),
KeyUpdateV2(ConsensusKeysUpdatedV2),
CommissionUpdate(CommissionUpdated),
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions